To find NVIDIA kernel modules:
bash
Copy code
find /lib/modules/$(uname -r)/kernel/drivers -type f -name 'nvidia*.ko*'
To find NVIDIA libraries in /usr/lib and /usr/lib64:
bash
Copy code
find /usr/lib /usr/lib64 -type f -name 'libnvidia*'
To find NVIDIA binaries in /usr/bin:
bash
Copy code
find /usr/bin -type f -name 'nvidia*'
To find NVIDIA driver files in /usr/lib/xorg/modules/extensions:
bash
Copy code
find /usr/lib/xorg/modules/extensions -type f -name 'libglx.so.*'
To find NVIDIA configuration and other miscellaneous files in /etc:
bash
Copy code
find /etc -type f -name '*nvidia*'
To check if nvidia-smi is installed in /usr/bin:
bash
Copy code
ls /usr/bin/nvidia-smi
Please note that these commands will only find files that are named with 'nvidia' in their names. There may be other files associated with the NVIDIA driver that do not have 'nvidia' in their names.
Also, you need root permissions to access some of these files. You may need to prefix the commands with sudo if you get a permission denied error.
User
To find NVIDIA driver files in /usr/lib/xorg/modules/extensions is not working in ubuntu. On what other locations they could be stayed at?
ChatGPT
On some Linux distributions, including Ubuntu, the Xorg NVIDIA driver files might be located in a slightly different location.
You can find these files generally in the /usr/lib/xorg/modules/drivers/ directory. The NVIDIA Xorg driver file is usually called nvidia_drv.so.
So, you can check this file with the command:
bash
Copy code
ls /usr/lib/xorg/modules/drivers/nvidia_drv.so
If this file exists, it means that the NVIDIA Xorg driver is installed. If the file does not exist, it could mean that the driver is not installed or the installation path is different.
Remember that the exact locations can vary depending on the distribution, the specific version of the driver, and how the driver was installed. If you installed the driver manually from a runfile or a .deb package, it should be in the location mentioned above. If you installed it some other way, such as through a package manager or a third-party repository, it could be somewhere else.
If you're having trouble locating these files, you can use the find command to search for them in the /usr directory:
bash
Copy code
sudo find /usr -name 'nvidia_drv.so'
This command will search for the nvidia_drv.so file in the /usr directory and all its subdirectories. Be aware that this command can take some time to run because it searches through many files.
User
Now you tell me how could I install those in a seperate folder and still able run cuda driver and toolkit properly using the option --installpath=/opt/CUDA. How could I set path for all these files (.so) lib and include files and other kernel modules related file to appropiately work in ubuntu
ChatGPT
Installing CUDA to a custom directory involves a few more steps than a standard installation. Here's how you can do it:
Download the CUDA Toolkit runfile installer: You can download the runfile installer from the NVIDIA CUDA Toolkit website. Make sure to select the version that is appropriate for your system and your needs.
Run the installer with the --installpath option: You can specify a custom installation directory using the --installpath option. For example, if you want to install CUDA to the /opt/CUDA directory, you would run:
bash
Copy code
sudo sh cuda_12.1.0_xxx.run --installpath=/opt/CUDA
Replace cuda_12.1.0_xxx.run with the name of the runfile you downloaded.
Update your environment variables: After the installation is complete, you need to update your PATH and LD_LIBRARY_PATH environment variables to include the CUDA binaries and libraries. You can do this by adding the following lines to your .bashrc file:
bash
Copy code
export PATH=/opt/CUDA/bin:$PATH
export LD_LIBRARY_PATH=/opt/CUDA/lib64:$LD_LIBRARY_PATH
Then, apply the changes with:
bash
Copy code
source ~/.bashrc
Manage NVIDIA Kernel Modules: Kernel modules are installed in system directories and are managed by the system, not by individual users. Therefore, you cannot change the installation location of the kernel modules. Instead, what you can do is to make sure the system is properly configured to load the correct version of the modules when needed.
You should now be able to run CUDA programs using the version of CUDA installed in the /opt/CUDA directory.
Please note that if you want to have multiple versions of CUDA installed at the same time, you will have to manage your PATH and LD_LIBRARY_PATH environment variables to point to the version you want to use. It's also important to note that while multiple versions of the CUDA Toolkit can be installed and used on the same system, the CUDA driver (part of the NVIDIA driver) can only have one active version at a time.
User
How could I make sure of "the CUDA driver (part of the NVIDIA driver) can only have one active version at a time" and what if I would use toolkitpath=/opt/Cuda ?
ChatGPT
The CUDA driver is part of the NVIDIA graphics driver, and only one version of the graphics driver can be loaded by the operating system at a time. This means that all CUDA programs running on a system must use the same CUDA driver, even if they use different versions of the CUDA Toolkit.
The version of the CUDA driver that is loaded by the system is determined by the NVIDIA graphics driver that is installed on the system. You can check the version of the NVIDIA driver (and thus the CUDA driver) using the nvidia-smi command:
bash
Copy code
nvidia-smi
This command will show information about your NVIDIA GPUs and the driver version. The "Driver Version" listed in the output is the version of the CUDA driver.
If you want to use a different version of the CUDA driver, you will need to install a different version of the NVIDIA graphics driver. This typically involves uninstalling the current driver and then installing the new driver.
As for the --toolkitpath option in the CUDA installer, it specifies the installation location for the CUDA Toolkit, which includes the nvcc compiler, CUDA libraries, header files, and other development tools. You can use it to install the CUDA Toolkit to a custom location, like /opt/Cuda. However, this does not change the location of the CUDA driver, which is installed as part of the NVIDIA graphics driver.
User
this does not change the location of the CUDA driver, which is installed as part of the NVIDIA graphics driver. where is the default localtion. Also what if I want to install that using --installpath=/opt/CUDA. ANd is this recommended?
ChatGPT
The CUDA driver, as part of the NVIDIA graphics driver, is typically installed in system-level directories, such as /usr/lib or /usr/lib64 for libraries and /usr/bin for executables. Kernel modules are typically installed in /lib/modules/<kernel-version>/kernel/drivers/.
While the --installpath option for the CUDA Toolkit runfile installer allows you to install the toolkit to a custom location, it is generally not recommended to try and install the CUDA driver to a non-default location. The reason is that the CUDA driver (which is part of the NVIDIA graphics driver) interacts with the Linux kernel and needs to be in specific locations where the kernel and other system components can find it.
When it comes to CUDA development, it's generally fine, and often recommended, to install multiple versions of the CUDA Toolkit side by side in different directories if needed. However, there should be only one version of the NVIDIA graphics driver (and hence the CUDA driver) installed at a given time. The installed driver should be compatible with all installed versions of the CUDA Toolkit that you plan to use.
If you want to install the CUDA Toolkit to a custom directory like /opt/CUDA, you can do so using the --toolkitpath or --installpath option with the runfile installer, as described in previous responses. This should not affect the operation of the CUDA driver or the NVIDIA graphics driver.
Created
May 11, 2023 08:13
-
-
Save ehzawad/782c428fbd92cc3c14e5ad9c2be77c0b to your computer and use it in GitHub Desktop.
cuda shi..
Author
Author
$ cd ~/
$ git clone https://github.com/NVIDIA/TensorRT.git
$ docker pull nvcr.io/nvidia/tensorflow:22.03-tf2-py3
$ docker run -it --runtime=nvidia --gpus all --net host -v ~/TensorRT/tools/tensorflow-quantization:/home/tensorflow-quantization nvcr.io/nvidia/tensorflow:22.03-tf2-py3 /bin/bash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
export CUDA_HOME=/usr/local/cuda
export PATH=$PATH:$CUDA_HOME/bin
export C_INCLUDE_PATH=$C_INCLUDE_PATH:$CUDA_HOME/include
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$CUDA_HOME/include
export LIBRARY_PATH=$LIBRARY_PATH:$CUDA_HOME/lib64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64