4
$\begingroup$

I am exploring the Nvidia GTX 1070 with Mathematica, I tried this example from the Help guide and it fails with a nvcc complier error. A little google research seems to indicate that I need the nvcc complier included with the CUDA Toolkit v8 Release Candidate. The nvcc that Mathematica is executing seems to be embeded somewhere with Mathematica files. I see the CCompilers[] function has abilities to change executable and options, but not sure if this is right path just to see a demo. Any help on best way to proceed would be great, thx!

Generate a Mandelbulb Set with CUDA Functionality example/GenerateAMandelbulbSetWithCUDAFunctionality

mandelbulb = 
 CUDAFunctionLoad[{srcf}, 
  "MandelbulbGPU", {{"Float", _, "Output"}, {"Float", _, 
    "Input"}, {"Integer32", _, "Input"}, "Integer32", "Float", 
   "Float"}, {16}, "UnmangleCode" -> False, 
  "ShellOutputFunction" -> Print]

nvcc fatal: Value 'sm_61' is not defined for option 'gpu-architecture'

Ubunutu 16.04, GeForce GTX 1070 NVIDIA driver 367.44, Mathematica 11.0

I have not installed the CUDA Toolkit, either version 7.5 or 8.0 RC, so I am guessing the nvcc complier is installed by Mathematics software download, which occured for me when I requested the CUDAInformation[] function.

{1 -> {"Name" -> "GeForce GTX 1070", "Clock Rate" -> 1683000, 
   "Compute Capabilities" -> 6.1, "GPU Overlap" -> 1, 
   "Maximum Block Dimensions" -> {1024, 1024, 64}, 
   "Maximum Grid Dimensions" -> {2147483647, 65535, 65535}, 
   "Maximum Threads Per Block" -> 1024, 
   "Maximum Shared Memory Per Block" -> 49152, 
   "Total Constant Memory" -> 65536, "Warp Size" -> 32, 
   "Maximum Pitch" -> 2147483647, 
   "Maximum Registers Per Block" -> 65536, "Texture Alignment" -> 512,
    "Multiprocessor Count" -> 15, "Core Count" -> 480, 
   "Execution Timeout" -> 1, "Integrated" -> False, 
   "Can Map Host Memory" -> True, "Compute Mode" -> "Default", 
   "Texture1D Width" -> 131072, "Texture2D Width" -> 131072, 
   "Texture2D Height" -> 65536, "Texture3D Width" -> 16384, 
   "Texture3D Height" -> 16384, "Texture3D Depth" -> 16384, 
   "Texture2D Array Width" -> 32768, 
   "Texture2D Array Height" -> 32768, 
   "Texture2D Array Slices" -> 2048, "Surface Alignment" -> 512, 
   "Concurrent Kernels" -> True, "ECC Enabled" -> False, 
   "TCC Enabled" -> False, "Total Memory" -> 8505589760}}
$\endgroup$

1 Answer 1

5
$\begingroup$

Yes, the nvcc compiler is installed with Mathematica, but you can specify the use of another one.

For you the problem seems to be that the architecture sm_61 (this refers to "Compute Capabilities" -> 6.1) is not supported by CUDA 7.5, which is the versions installed with Mathematica 11.0.0. To use sm_61 you have to install CUDA 8 and specify it via "CompilerInstallation" as an option to CUDAFunctionLoad. This is if you really want to use the most recent CUDA features added to CUDA 8 and only available in the NVIDIA Pascal series GPUs. (Note: I do not know if this really works as I have not tested Mathematica 11 with CUDA 8, there might be some other incompatibility).

Unless you are using advanced features of the architecture, which you are not with the mandelbulb example, you should just manually specify a different architecture by using the "CUDAArchitecture" Option of CUDAFunctionLoad. In most cases compute capability 3.5 should be sufficient, which corresponds to setting "CUDAArchitecture"->"sm_35". Most graphics cards support at least "sm_30", so I would choose this if your kernel does not use any advanced features for downwards compatibility reasons.

$\endgroup$
2
  • $\begingroup$ Thanks for your insight & ideas! The CUDA stuff is very exciting & interesting, but very fragile right now. At least GTX 1070 hardware/software on Linux. I did try CUDA 8 RC (note 7.5 not supported on Ubuntu 16.04). The v8 install caused Mathematic kernel to simply exit (crash w/ no message) on 1st call to any Mathematica CUDA fun. The GPU driver & CUDA SDK library combos are all over the place. Not sure if it is better on other platforms, I picked Linux hoping it was the most stable, but not proven to be so. Thank goodness for Linux package manager to unwind installs w/ very good robustness! $\endgroup$
    – Dave
    Commented Aug 26, 2016 at 21:13
  • $\begingroup$ Your Linux experience actually surprises me. Should not be that way, though the last time I actually worked with CUDA and Mathematica on Linux has been quite some time ago and was with CUDA 4. I am pretty sure you should be able to get this one running. My own experience though is that working with CUDA ist the easiest on Windows, because this is the primary development platform for NVidia. I personally am working on MacOS and Windows and did not encounter major problems so far. $\endgroup$
    – Wizard
    Commented Aug 26, 2016 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.