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?

  • 1
    $\begingroup$ Try running Needs["CCompilerDriver"];CCompilers[]` and also read this tutorial on installing a C compiler. See also NVCCCompiler[] $\endgroup$ – Ajasja Jul 3 '12 at 11:54
  • $\begingroup$ What does CUDACCompilers[] give? An empty list? $\endgroup$ – Sjoerd C. de Vries Jul 3 '12 at 18:54
  • 2
    $\begingroup$ 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. $\endgroup$ – Sjoerd C. de Vries Jul 3 '12 at 18:57
  • $\begingroup$ Sjoerds Yes if I run CUDACCompilers[] I get an empty list {} $\endgroup$ – YnceraJ Jul 3 '12 at 20:35
  • $\begingroup$ I should state the obvious. My machine got a Cuda capable Nvidia card. The driver number is CUDA Driver Version: 4.2.10 $\endgroup$ – YnceraJ Jul 3 '12 at 20:42

Your Answer

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

Browse other questions tagged or ask your own question.