MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: nVidia Optumus prevents using CUDA?

"Oleksandr Rasputinov" <oleksandr_rasputinov at> writes:

> Minimal installation of Microsoft Visual C++ 10.0 (2010) SP1

There are two additional steps that I had to take in order to make the
64bit VC compiler work with CUDA:

1. Create the file

   C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat 

   containing one line:

   CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
2. Modify the file (substitute your home directory instead of C:\Users\alex of course)


   so that the INCLUDES line looks like this:

   INCLUDES        +=  "-I$(TOP)/include" "-I$(TOP)/include/cudart" "-IC:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include" $(_SPACE_)

   Apparently there is a problem with configuration of NVIDIA CUDA tools
   shipped with Mathematica.
   I am not sure it is relevant in this case but if the directory with
   nvcc.profile is not there, in Mathematica try

   CUDAResourcesInstall[Update -> True]

With the two additions a lot of examples in Mathematica Help involving
compilation of CUDA functions (e.g. those in documentation for
CUDAFunctionLoad) work. 
> Personally, I use MinGW-w64 GCC  
> 4.6.1 rather than Visual C++; this works perfectly well also but does  
> require modifications to Mathematica which I will not discuss here other  
> than to say that it would be nice if this compiler could be supported  
> without need of modifications in a future release.

The way to deal with MinGW-w64 is described in the documentaion. Specifically,
either define $CCompiler: 



$CCompiler = {"Name" -> "MinGW64", "Compiler" -> GenericCCompiler, 
   "CompilerInstallation" -> "C:/MinGW64", 
   "CompilerName" -> "x86_64-w64-mingw32-gcc.exe"};

or use the options, e.g.

greeter = CreateExecutable[StringJoin[
   "#include <stdio.h>\n",
   "int main(){\n",
   "  printf(\"Hello MinGW-w64 world.\\n\");\n",
  "hiworld", "Compiler" -> GenericCCompiler, 
  "CompilerInstallation" -> "C:/MinGW64", 
  "CompilerName" -> "x86_64-w64-mingw32-gcc.exe"]

Unfortunately that makes the compiler work everywhere in Mathematica (I
tested both 8.0.1 and 8.0.4) but not in CUDALink. I suspect the reason
is that the NVCCCompiler should be pointed to MinGW-w64 somehow and the
documentation is unclear on how to do that. There is an option
"XCompilerInstallation" to CUDAFunctionLoad documented as "the directory
where NVCC will find the C compiler is installed" but there is neither
corresponding "XCompilerName" option nor an example on how to use it.


  • Prev by Date: Re: How to eliminate noises? A better way perhaps.
  • Next by Date: Re: Import files on accessible URL and save in
  • Previous by thread: Re: nVidia Optumus prevents using CUDA?
  • Next by thread: Re: nVidia Optumus prevents using CUDA?