rsnk96 / Ubuntu-Setup-Scripts

Scripts to help you set up your Ubuntu quickly, especially if you're in any subfield of Data Science or AI!
Apache License 2.0
126 stars 76 forks source link

Auto-install the latest cuda #75

Closed rsnk96 closed 4 years ago

rsnk96 commented 4 years ago

Can attempt to auto-install the latest cuda by scraping the cuda install web-page for the <pre class="cudaBashBlock"> block, which would contain the commands we need. Ex:

<pre class="cudaBashBlock">
    <code>
        <span class="cudaBash">wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run</span>
        <span class="cudaBash">sudo sh cuda_10.2.89_440.33.01_linux.run</span>
    </code>
</pre>

This can be done in a manner similar to how the latest anaconda version is fetched

rajat2004 commented 4 years ago

Could be done, but should be an optional element only Have faced issues where using a specific method didn't work out properly, and had to go for alternative ways

rsnk96 commented 4 years ago

Have you faced issues with the runfile method? imo, that's been a sure-shot way to do it. I have faced issues with the .deb file method in the past too.

The runfile method also lets you run it entirely in the command line, as detailed in Section 4.6 of their manual. Sample usage for our use case would be

sudo sh cuda_10.2.89_440.33.01_linux.run --silent --toolkit --run-nvidia-xconfig # if the display is connected to an Nvidia GPU

or 

sudo sh cuda_10.2.89_440.33.01_linux.run --silent --toolkit --no-opengl-libs  # if display cannot be driven by a Nvidia GPU, e.g. if an AMD CPU with integrated graphics is detected

This has to be followed up with adding CUDA to the path as is being done in the ML-Build/Basic-ML scripts

rajat2004 commented 4 years ago

I've used the .deb packages only, so can't say about the runfile method. But still, I think it should be optional only, since we don't want to mess things up if it's already installed, doesn't want to install or maybe a different version is required

rsnk96 commented 4 years ago

The runfile method allows users to switch between cuda versions, and removing the runfile-cuda from being detected is as simple as just removing it from the path. Ex: Two we can switch between cuda-10.1 and cuda-10.2 on the fly by just changing the symlink /usr/local/cuda in this case: 20-02-19_897_336

(since /usr/local/cuda is what is added to the PATH)

I think we can update the README to show how to enable/disable/switch cuda installed via runfiles