Linux/Nvidia

nvidia commands

Naranjito 2022. 3. 15. 11:28
  • install pytorch with cuda

Go this : https://pytorch.org/

 

  • install cuda

Go this : https://developer.nvidia.com/cuda-11-6-2-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=runfile_local 

$ wget https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux.run
$ sudo sh cuda_11.6.2_510.47.03_linux.run

 

  • CUDA_VISIBLE_DEVICES

Control GPU visibility to selected GPU server.

$ CUDA_VISIBLE_DEVICES=3 python mnist.py

>>>

...

-> device: 0 # It shows 0 even I allocate 3 because device 0, 1, 2 masked.

...

If I select 2 devices.

$ CUDA_VISIBLE_DEVICES=2,3 python mnist.py

>>>

2022-03-14 17:53:51.571206: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 22302 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3090, pci bus id: 0000:c1:00.0, compute capability: 8.6
2022-03-14 17:53:51.571605: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-03-14 17:53:51.572698: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:1 with 22302 MB memory:  -> device: 1, name: NVIDIA GeForce RTX 3090, pci bus id: 0000:c2:00.0, compute capability: 8.6

...

# It appears device: 0, device: 1

 

'Linux > Nvidia' 카테고리의 다른 글

nvidia-smi, nvtop  (0) 2023.04.14
error : cublas needs some free memory when you initialize it  (0) 2022.07.26