[Developers] c++ amp with admb
dave fournier
davef at otter-rsch.com
Tue Sep 16 11:35:42 PDT 2014
A while back Matthrew pointed out to me that development on C++AMP for
linux is an ongoing project which should be watched.
For those whio don't know AMP is a microsoft development which is
supposed to greatly
simplify parallel processing on GPU's/CPUs.
Having done the LU decopmposition code I wondered it it could benefit
from C++ AMP.
that is a bit difficult for a newbie sio I decided to start with a
simple matrix multiplication example.
I have attached the code. the zip file includes a script for compiling
the example.
class dvector
{
// ....................
public:
double * data (void) const { return v+index_min; }
};
class dmatrix
{
// ............................................
public:
double * data (void) const { return m[index_min].data(); }
};
One technicality is that the AMP library expects the matrix or vector
class to have a member function data
which returns a pointer to the numbers in the vector. I added this to
the dvector and dmatrix classes.
Another technicality is that the AMP library expects the matrix to be
stored in
contiguous memory. I have accomplished this for the dmatrices in the
example by using the make_dmatrix function.
Otherwise all seems to work except that the AMP code for a 2,000 x 2,000
matrix runs less than half as fast as the
ADMB matrix multiply. I have no GPU driver on my laptop so AMP is using
the CPU. This works as top
reports CPU usage of 792% which indicates that 8 threads are running.
Suggestions for improvements would be welcome.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: amp_mpy.zip
Type: application/zip
Size: 1984 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20140916/d0fb5092/attachment.zip>
More information about the Developers
mailing list