Using GPU

From HPC Guide
Revision as of 08:32, 1 May 2023 by Dvory (talk | contribs) (Created page with "Please note that if you do not ask for a specific gpu, your code asks by default the first one, which may be busy, or using all its memory. In order to specify a gpu to be use...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Please note that if you do not ask for a specific gpu, your code asks by default the first one, which may be busy, or using all its memory. In order to specify a gpu to be used, please define it (using the environment variable: CUDA_VISIBLE_DEVICES) e.g.

export CUDA_VISIBLE_DEVICES=2

If you would like to use more than 1 gpu, you may type them separated with comma, e.g. export CUDA_VISIBLE_DEVICES="2,4"

In order to know which gpus are free, you may copy python script to your disk and activate it:

module load python/python-anaconda_3.7
python /powerapps/scripts/check_avail_gpu.py

It will output the first free gpu (in its last line) If you need more than one gpu, please overwrite parameter num_gpus in line 96 num_gpus = 1 Change it to the number you need