Setting up Nvidia CUDA for Mathematica 9.01 on Linux Mint 13

Questions about applications and software
Forum rules
Before you post please read this

Setting up Nvidia CUDA for Mathematica 9.01 on Linux Mint 13

Postby Tschibi2000 on Mon Sep 02, 2013 9:02 am

Hi to all,
As a new user of Linux Mint 15 Cinnamon 64-bit I have porblems with setting up Nvidia CUDA for Mathematica 9.01.
My System is a Dell XPS 15 with including a Intel Core i7 2760 and aNvidia Gforce Gt 540M. I was able to make Mathematica using CUDA on Win7 with this computer but with Linux I have some problem:

I was able to install the Nvidia Driver using the sudo apt-get install nvidia-current. By using bumblebee i was able to see, that my computer uses the Gforce Card if i start applications with optirun.

Unfortunally I was not able to install nvidia CUDA without problems. After Downloading the latest version and following the manual on the nvidia hompage Cinnamon crashes after starting. I was only able to solve this problem by reinstalling the nvida driver.

My question to you: Has anyone an idea how i could make this things work. How can I install the driver without crashing my system and what configurations have to be done to make Mathematica using CUDA.

*edit* edited wrong Linux Mint version number


Thank you very much.

Best regards
Tschibi2000
Tschibi2000
Level 1
Level 1
 
Posts: 5
Joined: Mon Sep 02, 2013 8:34 am

Linux Mint is funded by ads and donations.
 

Re: Setting up Nvidia CUDA for Mathematica 9.01 on Linux Min

Postby trapperjohn on Mon Sep 02, 2013 11:08 pm

Here's an article I wrote a year ago that includes material on getting cuda up and running. I have run through the proecees with serveral machines sucessfully. I have heard the Bumlebee sucess story for hybrid GPUs, but I never bothred to go down that road. I am told (but onlu half beleive) that the NVidia Developer driver works without the bunbleebee apprach.
http://www.codeproject.com/Articles/513265/CPU-Computing-Using-CUDA-Eclipse-and-Java-with-JCu

Since the article's writing there have been a few emerging hot spots in the install. Nouveau it seems is becoming harder and harder to hack out of the way. The other glitch is that sometimes a given kernel runnung on a machine was infact compiled with an older complier(gcc) than the install itself put un. The NVidia developer driver's installe will bark about the incompatibl gcc versions, Both of these can be beaten, but let's see if you encounyer them first..

Give the tutorial a read.You'll only need to focus on the stuff in the beginning. As you can see from the tutorial, I won't be much help in getting the Mathmatica aspect integrated. But the foundation block, Cuda, can be installed this way... perhaps with a little extra fussing on killing Nouveau through grub before boot. If a gcc compiler version mismatch shows an inconsistenly, the we'll need to create a system alternative for installing/running an earlier version.

Try the tutorial, make not of the process and post the outcomes.
trapperjohn
Level 5
Level 5
 
Posts: 686
Joined: Wed Jul 11, 2012 4:10 pm

Re: Setting up Nvidia CUDA for Mathematica 9.01 on Linux Min

Postby Tschibi2000 on Tue Sep 03, 2013 9:19 am

Dear trapperjohn,
thank you very much for your help.

Unfortunally i was not able to set CUDA by following your instructions. I did everything as you described, but after installing the developer-driver my system crashed again. I was not able to start cinnamon again and the only way to restore i found was to remove and reinstall nvidia-current and bumblebee.

Now i found the .deb package at https://developer.nvidia.com/cuda-downloads and was able to install cuda through sudo apt-get install cuda

After this installation (nvidia-current, bumblebee,cuda) my system still works and cinnamon does not crash, so i followed the instructions of your tutorial and try to set the additonal paths.

I'm not sure if this went very well because their is no feedback from the command line. When I try now to run the example the following message is dsiplayed:

./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

FATAL: Module nvidia not found.
cudaGetDeviceCount returned 38
-> no CUDA-capable device is detected
Result = FAIL

Best regards
Tschibi2000
Tschibi2000
Level 1
Level 1
 
Posts: 5
Joined: Mon Sep 02, 2013 8:34 am

Re: Setting up Nvidia CUDA for Mathematica 9.01 on Linux Min

Postby trapperjohn on Tue Sep 03, 2013 10:48 am

...was to remove and reinstall nvidia-current and bumblebee


My understanding is that, to run Cuda examples, you must have the NVidia Developer Driver installed. I have never seen the vanilla graphics driver (nvidia-current) work.

As for Optimus hybrids, some machines allow you to set discrete mode for the hybrid GPU in the BIOs.

I'm sure there are other approaches with bumblebbe that allow using the NVidia Developer Driver with bumblebee, but I have never gone down that road. There are several hits on cuda development with Optimus bumblebee in a web search but most are forum posts and not tutorials. As usual with multiple forum solutions, there are many conflicting posts. Also, the usual spam posts that tell the OP to search Google cloud the path. (I wish folks wouldn't do that because it really makes for a lot of dead-end searching.)

Perhaps someone will respond to this post who does have a sucessfull Cuda development environment working with Bumblebee provides a step-by-step reply. If not, and you do get to to work, I hope you write a tutorial.

But... definitely start by going to the BIOS and see if you can un-couple your hybrid.
trapperjohn
Level 5
Level 5
 
Posts: 686
Joined: Wed Jul 11, 2012 4:10 pm

Re: Setting up Nvidia CUDA for Mathematica 9.01 on Linux Min

Postby Tschibi2000 on Fri Sep 06, 2013 8:28 am

Dear trapperjohn,
again thank you for your support. I was looking in my BIOS settings but my Laptop does not support this feature. I will see if I'm able to find a solution. Maybe someone else over here nows what to do ...

Again thank you very much for you help. I will post what i have done if I'm able to make it work.

Best regards
Tschibi2000
Tschibi2000
Level 1
Level 1
 
Posts: 5
Joined: Mon Sep 02, 2013 8:34 am

Re: Setting up Nvidia CUDA for Mathematica 9.01 on Linux Min

Postby trapperjohn on Fri Sep 06, 2013 9:21 am

HI

I found this http://ammar.gr/?p=679. It looks like the author got the toolkit to run on a very close cousin with Optimus hardware. I almost wish I has one kicking around so I could work at it too.
trapperjohn
Level 5
Level 5
 
Posts: 686
Joined: Wed Jul 11, 2012 4:10 pm

Re: Setting up Nvidia CUDA for Mathematica 9.01 on Linux Min

Postby Tschibi2000 on Fri Sep 06, 2013 9:24 am

Hi to all,
this seems to be a successfull day. As far as I can see i was able to set up CUDA make it run. Here is what I did:

I went to

https://developer.nvidia.com/cuda-downloads

and downloaded the DEB file for Ubuntu 12.10 (and installed it) then I add the repository for bumblebee with

Code: Select all
sudo add-apt-repository ppa:bumblebee/stable


also in a previous try I added

Code: Select all
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates


as far as I understand, this should not be necessary, but I'm new in Linux and so I write down everything I did. Now I closed the xserver and start to install cuda by using:

Code: Select all
sudo apt-get install cuda


after this I was not able to run the xserver without crashing cinnamon, so i installed bumblebee with:

Code: Select all
sudo apt-get install bumblebee


Afterwards I was able to run bumblebee and cinnamon was not crashing anymore. (checking with
glxspheres
and
optirun glxspheres
shows difference in Performance.


Now i had to make CUDA working by following the tutorial of trapperjohn (http://www.codeproject.com/Articles/513265/CPU-Computing-Using-CUDA-Eclipse-and-Java-with-JCu) from the point "Save time and frustration". Checking the path by
Code: Select all
echo $PATH
returns "... :/usr/lib/nvidia-current" and
Code: Select all
echo $LD_LIBRARY_PATH
returns ":/usr/lib/nvidia-current".

Now I was following the instruction of trapperjohns tutorial in his section "Step 4: Test CUDA Using NVidia CUDA Samples" I compiled the deviceQuery example using make and started it by using
Code: Select all
optirun devicequery
. Then it gave me the following output:

./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GT 540M"
CUDA Driver Version / Runtime Version 5.5 / 5.5
CUDA Capability Major/Minor version number: 2.1
...

So far this is all I was able to do. I would be open if someone has an idea about mathematica, if I'm able to solve it i will post it here.

Best Regards
Tschibi2000
Tschibi2000
Level 1
Level 1
 
Posts: 5
Joined: Mon Sep 02, 2013 8:34 am

Re: Setting up Nvidia CUDA for Mathematica 9.01 on Linux Min

Postby trapperjohn on Fri Sep 06, 2013 7:31 pm

This is a great result! I am happy that you posted your steps. There are likely to be many users who want to do Cuda development with their Optimus GPUs. I plan to update my CodeProject article and I will include a link to this post for other hybrid users.

I think it is fair to say that you are no longer new to Linux after having completed the gymnastics of this task. I hope you will watch the forums and bail out others that stumble over the process.

I stick to C and Java and have never gone down the Mathmatica trail. So, as for the Cudalink Mathmatica-Cuda handshake, perhaps another user on this forum will have some insight, but the querry will most likely be better understood by the GPGPU community.
trapperjohn
Level 5
Level 5
 
Posts: 686
Joined: Wed Jul 11, 2012 4:10 pm

Re: Setting up Nvidia CUDA for Mathematica 9.01 on Linux Min

Postby Tschibi2000 on Thu Sep 12, 2013 10:00 am

Good news ...

fortunally i was able to run CUDA with Mathematica successfully. Therefore I followed the instructions in this tutorial,

http://mathematica.stackexchange.com/questions/23032/mathematica-cannot-find-cuda-driver


The problem is, that Mathematica is looking for the files libnvidia-tls.so.* and your libcuda.so

Unfortunally those files are not in their standard paths, thats why you have to tell Mathematica where to find them. To check it run the Terminal and type in the following commands
export NVIDIA_DRIVER_LIBRARY_PATH=/usr/lib/nvidia-current/libnvidia-tls.so.319.37

and
export CUDA_LIBRARY_PATH=/usr/lib/nvidia-current/libcuda.so


Please consider that youre Version numbers and paths could be different. Search the files before and adapt the paths in the right way after you found them.

to check if the System is working start Mathematica in the same console with optirun using

optirun mathematica


Now test with CUDAQ[] if the device is working.

To enable CUDA function you have to write this two commands always before you start mathematica. Im sure there is a more elegant way, but im really not an expert in this. Maybe some other user can tell us how we start a program with different Variables from startup.

I hope I could help you with your problems.

Greatings
Tschibi2000
Tschibi2000
Level 1
Level 1
 
Posts: 5
Joined: Mon Sep 02, 2013 8:34 am

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: No registered users and 20 guests