CUDALink is properly installed and up to date, all built-in functions work fine, and all little functions I did worked fine... Until I tried using shared memory. The only example I found on the help doesn't work for more than one reason. It declares the memory without a type and my compiler complains. So that's a bad start. Anyway, I'm trying the most basic function I can, and I can't make it work.

I would appreciate if anyone could tell me what's wrong, or if it works (or doesn't) for you, or give me an example that does work... Sample code I'm trying

    testf = CUDAFunctionLoad["__global__ void test(int* out)
    extern __shared__ int smem[];
      }", "test", {{_Integer, "Output"}}, 16];

When I run it I get a CUDAFunction::internal: CUDALink experienced an internal error. >> and then I need to restart the kernel to make CUDALink work again

testf[Range[16], 16]

Just commenting out the line with the smem[threadIdx.x]=7 assignment makes it work. The compiler issues no warnings


This Mathematica 8 documentation should answer your question.

  • $\begingroup$ +1 I can't believe I didn't see that section of "Scope" that looks helpful... Thanks... Edit your answer that I had to add "Shared" at the end of the list of arguments in CUDAFunctionLoad and you get an accept $\endgroup$
    – Rojo
    Feb 9 '12 at 8:41
  • $\begingroup$ Can you please summarize the answer or at least, address the "I would appreciate if anyone could tell me what's wrong..." part of the question? Mere link only answers are not encouraged here :) $\endgroup$
    – rm -rf
    Mar 23 '12 at 3:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.