Message Boards Message Boards

Avoid errors with CUDAFunctionLoad in Mathematica


Before with Mathematica my CUDA was working fine. Now with Mathematica, CUDAFunctionLoad gives errors. Take this simple example from Mathematica documentation:

code = "
  __global__ void addTwo(mint * in, mint * out, mint length) {
    int index = threadIdx.x + blockIdx.x*blockDim.x;
    if (index < length)
     out[index] = in[index] + 2;
cudaFun = 
  "addTwo", {{_Integer, _, "Input"}, {_Integer, _, 
    "Output"}, _Integer}, 256]

This is gives issues with StringJoin, StringTrim and an internal error

CCompilerDriver`CCompilerDriverBase`InvokeCompiler::cmdstr: An internal error occurred while generating compilation commands. The InputForm of the generated command list is StringTrim[StringJoin["\n\n", CCompilerDriver`CCompilerDriverBase`BaseDriver["CreateExecutableCommands"][CUDAFunctionLoad, <<20>>, {"CreateBinary" -> True, "CUDAArchitecture" -> {}, "Defines" -> {"USING_CUDA_FUNCTION" -> 1, <<2>>, "USING_DOUBLE_PRECISIONQ" -> 1}, <<17>>, "XCompilerInstallation" -> Automatic}], "\n"]]

CUDAFunctionLoad::cmpf: The kernel compilation failed. Consider setting the option "ShellOutputFunction"->Print to display the compiler error message.

This is with CUDA paclet 10.5.0 still based on the old CUDA 7.5.18 toolkit in stead of CUDA 8.0. Compiler is from Microsoft Visual Studio 2015 Community Edition. OS is Windows 10. nVIDIA driver is latest 378.78 with CUDA 8.0 in the driver.

Update 27/03/2017:

In the meantime I also have Mathematica running in CentOS 7.3 x86_64 linux with gcc 4.8 as compiler and latest nVIDIA driver 375.39. I can confirm the same string errors happen. It seems internal Mathematica processing that goes wrong.

POSTED BY: Bert Aerts
3 months ago

I found the same thing a few minutes ago. Sent in the same example to Premier Service. I have a whole suite of CUDA functions which work perfectly in 11.0.1, but they give the same string messages in 11.1.

POSTED BY: Robert Rimmer
3 months ago

With the yesterday released Mathematica 11.1.1 CUDAFunctionLoad works again. I tested it on CentOS 7.3 64 bit Linux with gcc 4.8.

But still the CUDA paclet is version 10.5.0 based on CUDA Toolkit 7.5. In Windows 10 Microsoft Visual Studio 2013 is needed to use CUDAFunctionLoad. I hope that Wolfram soon releases a new paclet based on CUDA Toolkit 8.0. Then Microsoft Visual Studio 2015 update 3 can be used.

POSTED BY: Bert Aerts
2 months ago

Group Abstract Group Abstract