You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 24 Next »

The following guide shows you how to spawn a GPU-instance in skyhigh. There are GPU's available within some of our openstack-clouds, and access are given by request (we do not have GPU's for all projects unfortunatley).

GPU Flavors

Currently we have the following GPU's available:

  • At SkyHiGh (IIK's production instance):
    • dx5.8c90r.v100-8g: A flavor with 90GB RAM, 8 vCPU's and a 1/4 of a Tesla v100 (8GB GPU-RAM).
    • de3.12c60r.a100-10g: A flavor with 60GB RAM, 12 vCPUs and 1/4 of a Tesla A100 (10GB GPU-RAM)
    • de3.24c120r.a100-20g: A flavor with 120GB RAM, 24 vCPUs and 1/2 of a Tesla A100 (20GB GPU-RAM)
      • Only available for SFI NORCICS
    • de3.48c240r.a100-40g: A flavor with 240GB RAM, 48 vCPUS and 1/1 of a Tesla A100 (40GB GPU-RAM)
      • Only available for SFI NORCICS
    • dx5.24c60r.p40-24g: A flavor with 60GB RAM, 24 vCPUs and 1/1 of a Tesla P40 (24GB GPU-RAM)
      • Only available for Norwegian Biometrics Lab
    • de2.24c240r.a100-20g: A flavor with 240GB RAM, 24 vCPU's and 1/2 of a Tesla A100 (20GB GPU-RAM)
      • Only available for Norwegian Biometrics Lab
    • de3.24c120r.a100d-20g: A flavor with 120GB RAM, 24 vCPU's and 1/4 of a Tesla A100 80GB (20GB GPU-RAM)
      • Only available for Norwegian Biometrics lab
  • At SkyLow (IIK's development instance):
    • dx4.8c20r.m10-8G: A flavor with 20GB RAM, 8 vCPU's and one core of a Tesla M10 card (8GB GPU-RAM).
  • At stackit (NTNU IT's production platform):
    • dx4.28c120r.a100-20g: A flavor with 120GB RAM, 28vCPU's and 1/2 of a Tesla a100 (20GB GPU-RAM)
    • dx5s.96c470r.a100d-80g.e3400g: A flavor with 470GB RAM, 96 vCPUs and a Tesla a100d (80 GB GPU-RAM) and 3.4TiB with compute-local flash storage.
      • Only available for an IV-EPT project.

GPU-enabled images

We provide images with pre-installed Nvidia driver and CUDA package. These images contains the word "GRID" in their names and are regular ubuntu/centOS images with the following additions:

  • There is a script which installs the correct version of the Nvidia GRID driver at boot. After a driver-update on the hypervisor this script will also update the driver in the VM.
  • The CUDA-tools are pre-installed.

The installation of the drivers requires a restart; så the newly created instance will reboot shortly after creation.

Starting a GPU-instance

To start a GPU-enabled instance you simply create a VM as you usually would, but make sure to select:

  • a GPU-enabled flavor
  • a GRID-enabled image

After creating the VM it will boot, install the GRID-driver, and then reboot. So, do not be supprised if you suddenly loose access to your freshly booted machine. It will come back! (tongue)

It is vital that the VM uses the same driver as the hypervisor. If you update this driver your vGPU will cease to function. When the driver is updated on the hypervisor a new driver will also be installed in your VM.

Do not install nvtop. Its dependencies will break the driver.

CUDA-versions are tightly coupled with the driver version. The CUDA-version bundled with the image is proved working. You can therfore not expect that a newer CUDA-version would work.

cuDNN

Many of our GPU users will probably need Nvidia's cuDNN library. This is not pre-installed in our images, because Nvidia requires all users to register for the Nvidia Developer Program before dowloading. So, please follow the instructions here, to install it on your VM; and use tar file options. DO NOT USE THE DEB OR RPM ALTERNATIVE. Be sure to download the cuDNN version that corresponds to our current CUDA version.

Verify the GPU instance

After installation the presence of a GPU can be verified with lspci:

ubuntu@gputest:~$ lspci | grep NVIDIA 
00:05.0 3D controller: NVIDIA Corporation Device 20f1 (rev a1)

You can also verify that a license for the GPU is acquired successfully (yes, we need licences to use our GPUs...):

ubuntu@gputest:~$ journalctl -u nvidia-gridd | tail
 .... 
Jan 05 07:44:57 gputest nvidia-gridd[694]: Acquiring license. (Info: http://openstack-nvidia.lisens.ntnu.no:7070/request; NVIDIA Virtual Compute Server)
Jan 05 07:44:57 gputest nvidia-gridd[694]: Calling load_byte_array(tra)
Jan 05 07:44:59 gputest nvidia-gridd[694]: License acquired successfully. (Info: http://openstack-nvidia.lisens.ntnu.no:7070/request; NVIDIA Virtual Compute Server)

The "nvidia-smi" tool will show you the GPU status

ubuntu@gputest:~$ nvidia-smi
Thu Jan  5 07:46:10 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.82.01    Driver Version: 470.82.01    CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GRID A100-4C        On   | 00000000:00:05.0 Off |                    0 |
| N/A   N/A    P0    N/A /  N/A |    407MiB /  4091MiB |      0%      Default |
|                               |                      |             Disabled |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

There are some CUDA-tools installed in /root of your VM that can be used to test that the GPU works. For instance you could do like so:

ubuntu@gputest:~$ sudo su -
root@gputest:~# cd NVIDIA_CUDA-11.4_Samples/1_Utilities/deviceQuery
root@gputest:~/NVIDIA_CUDA-11.4_Samples/1_Utilities/deviceQuery# make
 ... lots-of-text-from-make ...
root@gputest:~/NVIDIA_CUDA-11.4_Samples/1_Utilities/deviceQuery#./deviceQuery
./deviceQuery Starting...

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

Detected 1 CUDA Capable device(s)

Device 0: "GRID A100-4C"
  CUDA Driver Version / Runtime Version          11.4 / 11.4
  CUDA Capability Major/Minor version number:    8.0
  Total amount of global memory:                 4092 MBytes (4290641920 bytes)
  (108) Multiprocessors, (064) CUDA Cores/MP:    6912 CUDA Cores
  GPU Max Clock rate:                            1410 MHz (1.41 GHz)
  Memory Clock rate:                             1215 Mhz
  Memory Bus Width:                              5120-bit
  L2 Cache Size:                                 41943040 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
  Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total shared memory per multiprocessor:        167936 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  2048
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 3 copy engine(s)
  Run time limit on kernels:                     No
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Enabled
  Device supports Unified Addressing (UVA):      Yes
  Device supports Managed Memory:                No
  Device supports Compute Preemption:            Yes
  Supports Cooperative Kernel Launch:            Yes
  Supports MultiDevice Co-op Kernel Launch:      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 0 / 5
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 11.4, CUDA Runtime Version = 11.4, NumDevs = 1
Result = PASS

If the output results in a "PASS" you should be fine. The GPU is then ready to use.


Using Docker

Our GPU-enabled VMs altso supports NVIDIA Container Toolkit in order to use docker with GPUs. Rule of thumb is to follow the current installation guide from NVIDIA. Don't bother with the driver pre-requsities. We have already sorted those out for you in our image. You will of course need to install docker before you begin. That part is also described in NVIDIA's documentation. We've summed up the commands below. The examples is for Ubuntu only.

Install docker

curl https://get.docker.com | sh && sudo systemctl --now enable docker

Install Nvidia Container Toolkit

# Enable the repositories
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
   && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
   && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

# Install the package
sudo apt update && sudo apt -y install nvidia-docker2

# Restart the docker daemon
sudo systemctl restart docker

# Run a test to verifiy that it works
sudo docker run --rm --gpus all nvidia/cuda:11.4.0-base nvidia-smi

# Optionally run a test with Tensorflow that actually runs a bit of code on the GPU via docker
sudo docker run --gpus all -it --rm tensorflow/tensorflow:latest-gpu \
   python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"



  • No labels