5
$\begingroup$

I have CUDA 6.5 working fine on Ubuntu 14.04. Mathematica recognizes the driver (Nvidia 340), but CUDAQ[] returns False and I cannot get any CUDA functions to work in Mathematica.

I have created symbolic links to /usr/lib64/ for the CUDA libraries.

Has anyone successfully gotten CUDA 6.5 to work with Mathematica in Ubuntu 14.04?

$\endgroup$
4
  • $\begingroup$ I couldn't get it to work with exactly the same setup, so I too am interested if anyone has! $\endgroup$ Feb 21, 2015 at 11:42
  • 1
    $\begingroup$ I noticed that the library libcuda.so is not in the cuda directory except as a stub. Since CUDA is working great for me outside of Mathematica, I do not think this is a compiling issue (although to be sure I did re-iinstall CUDA a few times). According to the CUDALink help page Mathematica is looking explicitly for this library. Perhaps that is the problem. If so, and this library is no longer under this name in CUDA 6.5, then perhaps CUDALink needs to be updated for this version. I am just guessing. $\endgroup$ Feb 21, 2015 at 20:41
  • $\begingroup$ Let me ask this: In the directory /cuda-6.5/lib64, is the file libcuda.so there? I have libcudart.so, is that the new name or a different library $\endgroup$ Feb 23, 2015 at 20:55
  • $\begingroup$ Possible duplicate of Mathematica cannot find CUDA driver. $\endgroup$
    – halirutan
    Feb 24, 2015 at 0:44

2 Answers 2

3
$\begingroup$

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;

Needs["CUDALink`"]
CUDADriverVersion[]
CUDAResourcesInformation[]
SystemInformation[]
CUDAQ[]
$\endgroup$
2
$\begingroup$

I figured it out.

The library file libcuda.so was in /usr/lib/x86_64-linux-gnu

I just created a sym link there and Mathematica was able to find it and it is working fine now.

$\endgroup$
1
  • $\begingroup$ Can you give a description that's a bit more detailed, so others can use this answer? $\endgroup$
    – Szabolcs
    Feb 23, 2015 at 23:45

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.