CFSworks / nvml_fix

A workaround for an annoying bug in nVidia's NVML library. Allows nvidia-smi to work once more!
98 stars 19 forks source link

install without sudo #7

Closed HoldenCaulfieldRye closed 5 years ago

HoldenCaulfieldRye commented 10 years ago

Hello, I'd like to install without root privileges.

I found the libnvidia-ml.so.1 symlink in /usr/lib/nvidia-337/libnvidia-ml.so.1 and /usr/lib32/nvidia-337/libnvidia-ml.so.1 and I can't delete either of them without sudo.

But I thought that if I did make install PREFIX=~/.local (which contains bin,include,lib,share directories) then it would create the executable ~/.local/bin/nvidia-smi which I could run by setting up an alias in bashrc.

However, that didn't happen. Is there still a way to get around this without root privileges? Thanks!

linxichen commented 10 years ago

I don't think that's likely. Without root access you can't do anything inside /usr/

tofurky commented 5 years ago

this can be done with the LD_LIBRARY_PATH env variable. for example:

matt@aquos:~$ git clone https://github.com/CFSworks/nvml_fix.git
Cloning into 'nvml_fix'...
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 87 (delta 9), reused 17 (delta 9), pack-reused 67
Unpacking objects: 100% (87/87), done.
matt@aquos:~$ cd nvml_fix/
matt@aquos:~/nvml_fix$ make TARGET_VER=418.43
gcc  -shared -fPIC -s empty.c -o libnvidia-ml.so.418.43 
gcc  -Wl,--no-as-needed -shared -fPIC -s -o libnvidia-ml.so.1 -DNVML_PATCH_418 -DNVML_VERSION=\"418.43\" libnvidia-ml.so.418.43 nvml_fix.c
matt@aquos:~/nvml_fix$ rm libnvidia-ml.so.418.43
matt@aquos:~/nvml_fix$ cd
matt@aquos:~$ LD_LIBRARY_PATH=/home/matt/nvml_fix/ nvidia-smi 
Mon Mar 18 20:13:05 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.43       Driver Version: 418.43       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 650...  Off  | 00000000:01:00.0  On |                  N/A |
| 30%   32C    P8    13W / 144W |    601MiB /  1991MiB |     18%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1190      G   /usr/lib/xorg/Xorg                           206MiB |
|    0      2526      G   ...quest-channel-token=8585002751369782194   344MiB |
|    0     25357      G   ...-token=236E989D3357B6971BE13D35BDC46997    27MiB |
+-----------------------------------------------------------------------------+
matt@aquos:~$ nvidia-smi 
Mon Mar 18 20:13:08 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.43       Driver Version: 418.43       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 650...  Off  | 00000000:01:00.0 N/A |                  N/A |
| 30%   32C    P8    N/A /  N/A |    601MiB /  1991MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0                    Not Supported                                       |
+-----------------------------------------------------------------------------+
matt@aquos:~$ 

note that it's necessary to remove the libnvidia-ml.so.418.43 file (or similarly named, if using a different driver version) else you will run into issues.