Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc 24 many tasks per gpu #228

Merged
merged 13 commits into from
Nov 6, 2023

Conversation

notoraptor
Copy link
Contributor

Salut @lebrice ! Voici du code de base pour DOC-24 (Exemple: utiliser un gros GPU de manière efficace en lancant plusieurs jobs par GPU, avec des "task" SLURM).

Je ne suis pas sûr que le code soit bon: quand je le tests, j'ai l'impression que les tasks sont toujours roulées de façon séquentielle. Je ne comprends pas encore pourquoi.

Copy link
Contributor

@lebrice lebrice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merci!
@obilaniu si jamais tu as un meilleur wording à proposer pour index.rst ça pourrait être utile. Sinon no worries.

@obilaniu
Copy link
Contributor

Êtes-vous au courant de

       --ntasks-per-gpu=<ntasks>
              Request  that  there  are ntasks tasks invoked for every GPU.  This
              option can work in two ways: 1) either specify  --ntasks  in  addi‐
              tion, in which case a type-less GPU specification will be automati‐
              cally determined to satisfy --ntasks-per-gpu,  or  2)  specify  the
              GPUs   wanted  (e.g.  via  --gpus  or  --gres)  without  specifying
              --ntasks, and the total task count  will  be  automatically  deter‐
              mined.   The  number of CPUs needed will be automatically increased
              if necessary to allow for any calculated task count.   This  option
              will  implicitly  set  --gpu-bind=single:<ntasks>,  but that can be
              overridden with an explicit --gpu-bind specification.  This  option
              is  not  compatible with a node range (i.e. -N<minnodes-maxnodes>).
              This   option   is    not    compatible    with    --gpus-per-task,
              --gpus-per-socket,  or  --ntasks-per-node.  This option is not sup‐
              ported unless SelectType=cons_tres is configured  (either  directly
              or indirectly on Cray systems).

?

@notoraptor
Copy link
Contributor Author

Salut, @obilaniu ! En effet, je ne connaissais pas --ntasks-per-gpu. Je l'ai testé, et ça fonctionne ! Cf dernier commit. Rendu ici: https://mila-docs--228.org.readthedocs.build/en/228/examples/good_practices/many_tasks_per_gpu/index.html

Je note par contre que le combo --gpus=1 --ntasks=1 semble équivalent au combo --gpus=1 --ntasks-per-gpu=2, en tout cas dans cet exemple!

Comment on lines 39 to 43
-#SBATCH --gpus-per-task=rtx8000:1
-#SBATCH --cpus-per-task=4
-#SBATCH --ntasks-per-node=1
+#SBATCH --gpus=1
+#SBATCH --ntasks-per-gpu=2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi pas garder --gres=gpu:rtx8000:1 --ntasks-per-gpu=2 --cpus-per-task=4? Ils servent tous à quelque chose.

J'ai une légère aversion à --gpus/-G parce que ce flag-là indique le nombre de GPUs total dans la job, et ne contraint pas SLURM à les allouer tous sur un noeud, ou même également sur plusieurs noeuds.

Copy link
Contributor

@lebrice lebrice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Un petit détail: C'est important que dans cet exemple les gens demandent un type de GPU spécifique à sbatch, parce qu'on veut qu'ils aient une idée de combien de VRAM une "task" a besoin, et donc on veut qu'ils sachent combien de tasks ils pourraient fitter confortablement sur le type de GPU choisi.

BTW, pas rapport, mais je vais faire un autre PR bientôt qui change un peu la narrative des exemples, pour rendre ça plus comme un "walkthrough", où les usagers commencent par apprendre à monitor leur utilisation des ressources et identifier les bottlenecks, ensuite comment utiliser efficacement le GPU (cet exemple-ci), et ensuite lancer plusieurs jobs avec un job array.
Ceci serait une des "trames narratives" présentes dans les exemples.

@notoraptor
Copy link
Contributor Author

@obilaniu @lebrice Mis à jour !

@lebrice lebrice changed the title (WIP) Doc 24 many tasks per gpu Doc 24 many tasks per gpu Nov 6, 2023
@lebrice lebrice self-requested a review November 6, 2023 22:13
@lebrice lebrice merged commit 6e9f6eb into mila-iqia:master Nov 6, 2023
4 checks passed
@notoraptor notoraptor deleted the doc-24-many-tasks-per-GPU branch November 7, 2023 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants