Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6285

Re: nVidia Optumus prevents using CUDA?

From Alexander Vorobiev <alexander.vorobiev@removethis.gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: nVidia Optumus prevents using CUDA?
Date 2011-11-09 11:34 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j9dofm$b3o$1@smc.vnet.net> (permalink)
References <j8nuj1$ee5$1@smc.vnet.net> <j8r9hu$3jk$1@smc.vnet.net>

Show all headers | View raw


"Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> 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)

   C:\Users\alex\AppData\Roaming\Mathematica\Paclets\Repository\CUDAResources-Win64-8.0.4.1\CUDAToolkit\bin\nvcc.profile

   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: 

Needs["CCompilerDriver`"]

Needs["CCompilerDriver`GenericCCompiler`"]

$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",
   "}\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.

Regards,
Alex

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-01 05:03 +0000
  Re: nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-02 11:24 +0000
  Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-02 11:29 +0000
    Re: nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-03 08:48 +0000
    Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-04 11:00 +0000
      Re: nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-10 12:07 +0000
    Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-07 11:03 +0000
    Re: nVidia Optumus prevents using CUDA? Alexander Vorobiev <alexander.vorobiev@removethis.gmail.com> - 2011-11-09 11:34 +0000
    Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-10 11:56 +0000
    Re: nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-11 09:55 +0000
    Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-12 12:39 +0000

csiph-web