7

On my hardware I have a CUDA enabled video card an ASUS GTX460, yet Mathematica does not seem to recognize this.

I have:

  • CUDA Toolkit 4.1
  • CUDA SDK 4.0
  • NVIDIA Driver 295.49

on Sabayon Linux 64 bit with Mathematica 8.0.0.

For example, following the CUDALink Setup, I get

Needs["CUDALink`"]
CUDAQ[](* False *)
CUDADriverVersion[] (* CUDADriverVersion::nodriv message raised. *)

The NVIDIA command /opt/cuda/sdk/C/bin/linux/release/deviceQuery finds the card and reports "passed" as well as listing the card capabilities.

Examples from /opt/cuda/sdk/C/bin/linux/release directory, such as smokeParticles, scan, randomFog, run well.

The relevant shell variables are set as follows:

export CUDA_LIBRARY_PATH=/usr/lib64/libcuda.so

export NVIDIA_DRIVER_LIBRARY_PATH=/usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.*

Additional Information

Supported Hardware

The Wolfram CUDA reference page CUDA Reference does not explicitly list the GTX 460 GPU. It does list the GTX 460M, the mobile version, and a mysterious GTS 460.

The Wolfram linked NVIDIA CUDA GPUs lists the popular GTX 460 but has no entry at all for the GTS 460. Perhaps this is a typo in the Wolfram documentation, as it would seem unlikely that they wouldn't support a commonplace NVIDIA GPU whilst supporting a seemingly non-existent GPU. If this isn't the case - I'm clearly stuck.

Problems finding the NVIDIA driver

Some poking around suggests that one sticking point is that

GPUTools`Internal`$NVIDIADriverLibraryVersion

is set to $Failed.

Would anyone know where this is set? From trying to Trace CUDADriverVersion it isn't obvious to me where things go wrong.

How do I convince Mathematica that my card supports CUDA?

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
image_doctor
  • 10,234
  • 23
  • 40
  • This might be a silly question as I don't even have an nVidia graphics card, but what if you update your CUDA toolkit to version 4.2? There seem to be newer drivers too: http://www.nvidia.com/object/linux-display-amd64-295.53-driver.html – Szabolcs Jun 05 '12 at 15:35
  • @Szabolcs It's possible, but that version isn't marked as stable for my distribution, Toolit 4.1 is the latest approved version. This is an ongoing problem and has persisted over several toolkit and driver versions, so unless there is something particular in 4.2 that addresses this I'd rather not adopt an unstable version, does that seem reasonable ? – image_doctor Jun 05 '12 at 15:39
  • 1
    I needed to set the variables NVIDIA_DRIVER_LIBRARY_PATH and CUDA_LIBRARY_PATHas mentioned towards the end of the page you mention. – b.gates.you.know.what Jun 05 '12 at 22:06
  • @b.gatessucks Thanks, I've checked and the shell variables are set as per the question update. The result is still the same. – image_doctor Jun 06 '12 at 07:00
  • I realize this might sound extreme and is a lot of work, but given that you have already researched the issue well and made sure that CUDA works on your machine (apart from CUDALink), the next step might be finding out how CUDAQ works and where/why it returns False. – Szabolcs Jun 06 '12 at 07:34
  • @Szabolcs How might I go about that challenge ? :) – image_doctor Jun 06 '12 at 07:35
  • My feeling is that because CUDAInformation[] and CUDAQ[] both throw no driver messages that the procedure that finds the CUDA driver is not working correctly. – image_doctor Jun 06 '12 at 07:45
  • 1
    @image_doctor I don't have a CUDA compatible card, so I can't do this. But the first thing would be finding the source code of CUDAQ. It's in SystemFiles/Links/CUDALink/CUDALink.m. You'll see it's defined in terms of DeviceCount which then uses iDeviceCount. These seem to be defined in SystemFiles/Links/GPUTools/WGLPrivate.m and use WGLQuery. You can try calling these functions manually as well as applying Trace or TracePrint to them to find out where things go wrong. It'll be a lot of work, but I think you get the idea ;-) I did it with ClusterIntegration`. – Szabolcs Jun 06 '12 at 07:53
  • @Szabolcs Thanks, I'll see how far I get :) – image_doctor Jun 06 '12 at 08:00
  • 1
    @image_doctor On my system (the equivalent of) your export NVIDIA_DRIVER_LIBRARY_PATH=/usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.* does not work. I have to point to the specific library (ending in .so). – b.gates.you.know.what Jun 06 '12 at 19:56
  • @b.gatessucks Thank you very much for that information. It looked slightly odd when I saw it and on reflection I should have experimented more with it. Setting NVIDIA_DRIVER_LIBRARY_PATH=/usr/lib64/opengl/nvidia/lib/libnvidia-tls.so solves the problem and allows the driver to be found :) So it looks like a typo in the Wolfram CUDA setup documentation that prevents the install from working. If you would like to make your comment an answer I'll accept it, thanks again. – image_doctor Jun 07 '12 at 09:44

2 Answers2

5

Try setting your shell variable to

NVIDIA_DRIVER_LIBRARY_PATH=/usr/lib64/opengl/nvidia/lib/libnvidia-tls.so

i.e. point it to a specific library.

b.gates.you.know.what
  • 20,103
  • 2
  • 43
  • 84
0

I have managed to get CUDALink working on an ubuntu 14.04 with an NVidia GTX 750 Ti with CUDA 7 toolkit (installed the toolkit following these instructions; http://www.r-tutor.com/gpu-computing/cuda-installation/cuda7.0-ubuntu ).

I have never been able to change NVIDIA_DRIVER_LIBRARY_PATH and CUDA_LIBRARY_PATH using env variables and get CUDALink to work.

I assume the Mathematica CUDA and Nvidia library paths as hardwired and I use symlinks from the libraries to the default locations where Mathematica is looking. It works for me! Mathematica is looking in /usr/lib64, this does not exist on my system, so;

cd /usr
sudo mkdir lib64

Locate your libnvidia-tls.so file, I used find

stuart@stuart-2015:~$ find / -name libnvidia-tls.so* 2>/dev/null
/usr/lib/nvidia-346/libnvidia-tls.so.346.82
/usr/lib/nvidia-346/tls/libnvidia-tls.so.346.82
/usr/lib32/nvidia-346/libnvidia-tls.so.346.82
/usr/lib32/nvidia-346/tls/libnvidia-tls.so.346.82

I have a 64bit system, I ignore the lib32 libraries, I have 2 choices;

/usr/lib/nvidia-346/libnvidia-tls.so.346.82
/usr/lib/nvidia-346/tls/libnvidia-tls.so.346.82

these are actually different files, I dont know what the difference is, or which is preferred, but there are only two choices, so I try the second file first and symlink like so;

sudo ln -s /usr/lib/nvidia-346/tls/libnvidia-tls.so.346.82 /usr/lib64/libnvidia-tls.so.346.82

With the cuda library, we find these files;

find / -name libcuda.so 2>/dev/null
/usr/lib/i386-linux-gnu/libcuda.so
/usr/lib/x86_64-linux-gnu/libcuda.so
/usr/local/cuda-7.0/targets/x86_64-linux/lib/stubs/libcuda.so

I need the 64-bit version, issue the symlink command;

 sudo ln -s /usr/lib/x86_64-linux-gnu/libcuda.so.346.82 /usr/lib64/libcuda.so

Now open Mathematica and test; enter image description here

  • Thank you for your contributions, although please note that it is extremely poor form to post identical answers to multiple questions. If you really think the question is a duplicate and can be answered identically, then flag it as such. I have upvoted one of your three answers (since it is obviously a good answer), but the other two (this one and this one) do not seem appropriate to their respective questions, i.e. the issue encountered by the OP was obviously different. – Oleksandr R. Aug 22 '15 at 15:43