Troubles to make a kernel in dll on VS2010 c ++

Hi!!

I’m starting with CUDA C++.

I am working on the dot product between two matrices, I don’t found a function to do in CUBLAS, so i had to do a kernel. Now I try to convert that .cu file to a dynamic library (dll) to call from a main in another project.

When I compile the .cpp file I get “Error c2065 ‘blockidx’ undeclared identifier”, same error for blockDim and threadIdx.

Is posible make a dynamic library (dll) in VS2010 using a kernel, or i have problems in shaping the VS2010?

What I try to do is

A=[1,2;3,4];
B=[1,2;3,4];

C=[1,4;9,16];

Thanks!!

of course cuBLAS has a dot product:

[url]cuBLAS :: CUDA Toolkit Documentation

It looks like you are trying to make a MATLAB mex dll, so follow this guide:

[url]http://www.orangeowlsolutions.com/archives/498[/url]

A Google search will pull up all this same info… I guess I am the one of the few who uses Google search.

And if you intend to do the element wise multiply (dot product) of the matrices, like this in MATLAB:

C=A.*B;

Then you still can use the above cuBLAS call, but you need to use streams to batch the element wise multiplication.

[url]cuBLAS :: CUDA Toolkit Documentation

And if you are indeed using MATLAB and it stores the matrices in contigous column-major format, you theoretically can use just one cublasSdot() with the size of the ‘vector’ being (N*M). Since it is element wise it will be like doing this in MATLAB:

Assuming A(N,M) and B(N,M)

C=A(:).*B(:);
C=reshape(C(:),N,M);

I think that should work, but make sure you get the input parameters right.

Thank you very much.

Now I will review the information.