Hyper-Q / MPS/fr: Difference between revisions
No edit summary |
(Created page with "Le script suivant est un exemple pour configurer le farming avec GPU.") |
||
Line 39: | Line 39: | ||
</div> | </div> | ||
Le script suivant est un exemple pour configurer le farming avec GPU. | |||
{{File|name=script.sh | {{File|name=script.sh | ||
Line 68: | Line 66: | ||
</div> | </div> | ||
[[Category:Software]] | [[Category:Software]] | ||
Revision as of 22:29, 4 December 2023
Aperçu
Hyper-Q (ou MPS) est une fonctionnalité des GPU de NVIDIA avec capacité de calcul CUDA 3.5 et plus,[1] ce qui est le cas pour toutes nos grappes d'usage général (Béluga, Cedar, Graham et Narval).
- The MPS runtime architecture is designed to transparently enable co-operative multi-process CUDA applications, typically MPI jobs, to utilize Hyper-Q capabilities on the latest NVIDIA (Kepler and later) GPUs. Hyper-Q allows CUDA kernels to be processed concurrently on the same GPU; this can benefit performance when the GPU compute capacity is underutilized by a single application process.
In our tests, MPS may increase the total GPU flop rate even when the GPU is being shared by unrelated CPU processes. That means that MPS is great for CUDA applications with relatively small problem sizes, which on their own cannot efficiently saturate modern GPUs with thousands of cores.
MPS is not enabled by default, but it is straightforward to do. Execute the following commands before running your CUDA application:
[name@server ~]$ export CUDA_MPS_PIPE_DIRECTORY=/tmp/nvidia-mps
[name@server ~]$ export CUDA_MPS_LOG_DIRECTORY=/tmp/nvidia-log
[name@server ~]$ nvidia-cuda-mps-control -d
Then you can use the MPS feature if you have more than one CPU thread accessing the GPU. This will happen if you run a hybrid MPI/CUDA application, a hybrid OpenMP/CUDA application, or multiple instances of a serial CUDA application (GPU farming).
Pour plus d'information sur MPS, voir la documentation de NVIDIA.
GPU farming
One situation when the MPS feature can be very useful is when you need to run multiple instances of a CUDA application, but the application is too small to saturate a modern GPU. MPS allows you to run multiple instances of the application sharing a single GPU, as long as there is enough of GPU memory for all of the instances of the application. In many cases this should result in a significantly increased throughput from all of your GPU processes.
Le script suivant est un exemple pour configurer le farming avec GPU.
#!/bin/bash
#SBATCH --gpus-per-node=v100:1
#SBATCH --time=0-10:00
#SBATCH --mem-per-cpu=8G
#SBATCH --cpus-per-task=8
mkdir -p $HOME/tmp
export CUDA_MPS_LOG_DIRECTORY=$HOME/tmp
nvidia-cuda-mps-control -d
for ((i=0; i<8; i++))
do
echo $i
./my_code $i &
done
wait
In the above example, we share a single V100 GPU between 8 instances of my_code
(which takes a single argument-- the loop index $i). We request 8 CPU cores (#SBATCH -c 8) so there is one CPU core per application instance. The two important elements are &
on the code execution line, which sends the code processes to the background, and the wait
command at the end of the script, which ensures that the job runs until all background processes end.
- ↑ Voir le tableau des modèles, architectures et capacités de calcul CUDA dans https://en.wikipedia.org/wiki/Nvidia_Tesla.