Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Ok I am trying to follow the examples of Cuda Code in the docummentation

Run the CUDAQ[] and get back a True

and run some of the first examples of Cuda code in the documentation and they also work

but when I try

doubleFun = CUDAFunctionLoad["
  __global__ void doubleVec(mint * in,  mint length) {
      mint index = threadIdx.x + blockIdx.x * blockDim.x;  
        if (index < length)
          in[index] = 2*in[index];
    }", "doubleVec", {{_Integer}, _Integer}, 256]

This example is to multiply a vector by 2

I get the following error code

CUDAFunctionLoad::noxcomp: A C compiler was not found in specified directory `1`. 
Set"XCompilerInstallation" to the directory containing a supported C compiler.    
Supported C compilers are detailed in the NVCCCompiler documentation page. >>

It looks like mathematica does not know where my C compiler is at and needs to be define I look in the documentation and I do not see how to do that. I am using OS X for Mac and from the above error message they are asking me to set

XCompilerInstallation to the directory containing the C compiler, I also have installed XCode. What should I do next?

share|improve this question
Try running Needs["CCompilerDriver"];CCompilers[]` and also read this tutorial on installing a C compiler. See also NVCCCompiler[] –  Ajasja Jul 3 '12 at 11:54
What does CUDACCompilers[] give? An empty list? –  Sjoerd C. de Vries Jul 3 '12 at 18:54
By the way, welcome to Mathematica.SE! If you consider visiting this place regularly we'd appreciate if you could choose some kind of user name more distinguishable than user+number. I don't like to be a number, and almost certainly you don't either. –  Sjoerd C. de Vries Jul 3 '12 at 18:57
Sjoerds Yes if I run CUDACCompilers[] I get an empty list {} –  YnceraJ Jul 3 '12 at 20:35
I should state the obvious. My machine got a Cuda capable Nvidia card. The driver number is CUDA Driver Version: 4.2.10 –  YnceraJ Jul 3 '12 at 20:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.