Difference between revisions of "Submitting GPU Jobs"
From UFAL AIC
Line 1: | Line 1: | ||
Start by reading [[Submitting CPU Jobs]] page. | Start by reading [[Submitting CPU Jobs]] page. | ||
− | The GPU jobs are submitted to <code>gpu | + | The GPU jobs are submitted to <code>gpu</code> partition. |
− | To ask for | + | To ask for one GPU card, use <code>#SBATCH --gres=gpu:1</code> directive or <code>--gres=gpu:1</code> option on the command line. The submitted job has <code>CUDA_VISIBLE_DEVICES</code> set appropriately, so all CUDA applications should use only the allocated GPUs. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Rules == | == Rules == | ||
− | * Always use GPUs via '' | + | * Always use GPUs via ''sbatch'' (or ''srun''), never via ''ssh''. You can ssh to any machine e.g. to run ''nvidia-smi'' or ''htop'', but not to start computing on GPU. |
− | * Don't forget to specify you RAM requirements with e.g. ''- | + | * Don't forget to specify you RAM requirements with e.g. ''--mem=10G''. |
− | + | * Always specify the number of GPU cards (e.g. ''--gres=gpu:1''). Thus e.g. <code>srun -p gpu --mem=64G --gres=gpu:2 --pty bash</code> | |
− | * Always specify the number of GPU cards (e.g. ''gpu | + | * For interactive jobs, you can use ''srun'', but make sure to end your job as soon as you don't need the GPU (so don't use srun for long training). |
− | * For interactive jobs, you can use '' | ||
* In general: don't reserve a GPU (as described above) without actually using it for longer time, e.g., try separating steps which need GPU and steps which do not and execute those separately on our GPU resp. CPU cluster. | * In general: don't reserve a GPU (as described above) without actually using it for longer time, e.g., try separating steps which need GPU and steps which do not and execute those separately on our GPU resp. CPU cluster. | ||
− | * If you know an approximate runtime of your job, please specify it with ''- | + | * If you know an approximate runtime of your job, please specify it with ''-t <time>''. Acceptable time formats include "minutes", "minutes:seconds", "hours:minutes:seconds", "days-hours", "days-hours:minutes" and "days-hours:minutes:seconds". |
== CUDA and cuDNN == | == CUDA and cuDNN == | ||
Line 33: | Line 25: | ||
* for CUDA 9.0, 9.2, 10.0 and 10.1, cuDNN is available directly in ''lib64'' directory of the respective CUDA, so no need to configure it specifically; | * for CUDA 9.0, 9.2, 10.0 and 10.1, cuDNN is available directly in ''lib64'' directory of the respective CUDA, so no need to configure it specifically; | ||
* for CUDA 10.1 and later, cuDNN is available in ''cudnn/VERSION/lib64'' subdirectory of the respective CUDA, so you need to add <code>LD_LIBRARY_PATH="/lnet/aic/opt/cuda/cuda-X.Y/cudnn/VERSION/lib64:$LD_LIBRARY_PATH"</code> to your configuration. | * for CUDA 10.1 and later, cuDNN is available in ''cudnn/VERSION/lib64'' subdirectory of the respective CUDA, so you need to add <code>LD_LIBRARY_PATH="/lnet/aic/opt/cuda/cuda-X.Y/cudnn/VERSION/lib64:$LD_LIBRARY_PATH"</code> to your configuration. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 16:23, 16 November 2022
Start by reading Submitting CPU Jobs page.
The GPU jobs are submitted to gpu
partition.
To ask for one GPU card, use #SBATCH --gres=gpu:1
directive or --gres=gpu:1
option on the command line. The submitted job has CUDA_VISIBLE_DEVICES
set appropriately, so all CUDA applications should use only the allocated GPUs.
Rules
- Always use GPUs via sbatch (or srun), never via ssh. You can ssh to any machine e.g. to run nvidia-smi or htop, but not to start computing on GPU.
- Don't forget to specify you RAM requirements with e.g. --mem=10G.
- Always specify the number of GPU cards (e.g. --gres=gpu:1). Thus e.g.
srun -p gpu --mem=64G --gres=gpu:2 --pty bash
- For interactive jobs, you can use srun, but make sure to end your job as soon as you don't need the GPU (so don't use srun for long training).
- In general: don't reserve a GPU (as described above) without actually using it for longer time, e.g., try separating steps which need GPU and steps which do not and execute those separately on our GPU resp. CPU cluster.
- If you know an approximate runtime of your job, please specify it with -t . Acceptable time formats include "minutes", "minutes:seconds", "hours:minutes:seconds", "days-hours", "days-hours:minutes" and "days-hours:minutes:seconds".
CUDA and cuDNN
Default CUDA (currently 11.2 as of Nov 2021) is available in
/opt/cuda
Specific version can be found in
/lnet/aic/opt/cuda/cuda-{9.0,9.2,10.0,10.1,10.2,11.2,...}
Depending on what version you need, you should add LD_LIBRARY_PATH="/lnet/aic/opt/cuda/cuda-X.Y/lib64:$LD_LIBRARY_PATH"
to your configuration.
Regarding cuDNN:
- for CUDA 9.0, 9.2, 10.0 and 10.1, cuDNN is available directly in lib64 directory of the respective CUDA, so no need to configure it specifically;
- for CUDA 10.1 and later, cuDNN is available in cudnn/VERSION/lib64 subdirectory of the respective CUDA, so you need to add
LD_LIBRARY_PATH="/lnet/aic/opt/cuda/cuda-X.Y/cudnn/VERSION/lib64:$LD_LIBRARY_PATH"
to your configuration.