Message Boards Message Boards

Avoid errors with CUDAFunctionLoad in Mathematica 11.1.0.0?

GROUPS:

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

Needs["CUDALink`"]
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 = 
 CUDAFunctionLoad[code, 
  "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 11.1.0.0 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
Answer
9 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
Answer
9 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
Answer
8 months ago

With the release of Mathematica 11.2 Wolfram also released new CUDA paclets. In Windows 10 the version number of the paclet is 11.2.22. In Linux it is 11.2.63. Both are based on nVIDIA's CUDA 8 Toolkit, finally Wolfram made it available. In Windows 10 Microsoft Visual Studio 2013 is no longer needed, version 2015 can be used now. One strange thing though CUDACCompilers[] is an empty list in Windows 10, while in Linux it lists gcc.

POSTED BY: Bert Aerts
Answer
3 months ago

Group Abstract Group Abstract