-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chap 5 - Conclusion et informations supplémentaires
- Loading branch information
Showing
3 changed files
with
171 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "60341bdf-a714-4257-a24f-36e78071faff", | ||
"metadata": {}, | ||
"source": [ | ||
"# Conclusion\n", | ||
"\n", | ||
"Rappel de quelques concepts du parallélisme :\n", | ||
"\n", | ||
"* Communications et synchronisations\n", | ||
" * Dépendances entre processeurs\n", | ||
"* [Scalabilité](https://docs.alliancecan.ca/wiki/Scalability/fr) et\n", | ||
" [loi d'Amdahl](https://fr.wikipedia.org/wiki/Loi_d%27Amdahl)\n", | ||
" * Granularité - quantité minimale de travail à faire de manière autonome\n", | ||
" * Répartition de la charge" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c13f5761-af71-4529-a701-c836fe1cfb1f", | ||
"metadata": {}, | ||
"source": [ | ||
"## MPI dans les autres langages\n", | ||
"\n", | ||
"* Fortran : le standard MPI est déjà défini en Fortran\n", | ||
"* C++ :\n", | ||
" * MPI 3.0 a éliminé les interfaces C++\n", | ||
" * [Boost MPI](https://www.boost.org/doc/libs/release/libs/mpi/) :\n", | ||
" bibliothèque pratique et très puissante\n", | ||
" pour les développeurs en C++\n", | ||
" * [Midi-conférence Boost-MPI](https://www.youtube.com/watch?v=U0axIKTO3wM)\n", | ||
"\n", | ||
"```C++\n", | ||
"boost::mpi::environment env(argc, argv);\n", | ||
"boost::mpi::communicator world;\n", | ||
"std::string s;\n", | ||
"\n", | ||
"if (world.rank() == 0)\n", | ||
" world.recv(boost::mpi::any_source, 746, s);\n", | ||
"\n", | ||
"```\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "b1069897-835c-4e43-ba78-00f5430a841f", | ||
"metadata": {}, | ||
"source": [ | ||
"## Défis de parallélisation supplémentaires\n", | ||
"\n", | ||
"Les codes suivants fonctionnent déjà en mode séquentiel.\n", | ||
"C'est maintenant à vous de les paralléliser avec MPI :\n", | ||
"\n", | ||
"* [Écoulement de chaleur](https://github.com/calculquebec/cq-formation-ecoulement-chaleur)\n", | ||
"* [Convolution sur une image](https://github.com/calculquebec/cq-formation-convolution/tree/main/defi-mpi)\n", | ||
"* [Problème à N corps](https://github.com/calculquebec/cq-formation-nbody)\n", | ||
"\n", | ||
"Pour mesurer le temps d’exécution d’un programme,\n", | ||
"la commande `time srun` doit être dans un\n", | ||
"[script de tâche](https://docs.alliancecan.ca/wiki/Running_jobs/fr#T.C3.A2che_MPI)\n", | ||
"soumis avec la commande `sbatch` :\n", | ||
"\n", | ||
"```Bash\n", | ||
"#!/bin/bash\n", | ||
"#SBATCH --ntasks=4\n", | ||
"#SBATCH … # temps, mémoire, etc.\n", | ||
"\n", | ||
"time srun ./programme\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ef2704f6-5e88-4a23-90f6-66619b2c86d7", | ||
"metadata": {}, | ||
"source": [ | ||
"## Bonus - Notions avancées\n", | ||
"\n", | ||
"MPI possède d'autres fonctionnalités :\n", | ||
"\n", | ||
"* collectives à partitions inégales\n", | ||
"* collectives non bloquantes (MPI 3)\n", | ||
"* entrées-sorties parallèles (MPI-IO)\n", | ||
"* **groupes, communicateurs, topologie**\n", | ||
"* types dérivés\n", | ||
"* accès distant (one-sided communication)\n", | ||
"* communications persistantes\n", | ||
"* processus dynamiques et fils" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3dcbe303-04d4-4397-8083-78c64cdab612", | ||
"metadata": {}, | ||
"source": [ | ||
"### Collectives à partitions inégales\n", | ||
"\n", | ||
"* Les fonctions de communication collective vues jusqu'ici envoyaient\n", | ||
" des données de **même taille** pour chaque processus MPI\n", | ||
"* Lorsque les données varient en taille, il faut dans certains\n", | ||
" cas utiliser des fonctions avec des arguments supplémentaires :\n", | ||
" * [MPI_Scatterv](https://www.mpi-forum.org/docs/mpi-4.1/mpi41-report.pdf#page=252)\n", | ||
" * [MPI_Gatherv](https://www.mpi-forum.org/docs/mpi-4.1/mpi41-report.pdf#page=242)\n", | ||
" * [MPI_Allgatherv](https://www.mpi-forum.org/docs/mpi-4.1/mpi41-report.pdf#page=258)\n", | ||
" * [MPI_Alltoallv](https://www.mpi-forum.org/docs/mpi-4.1/mpi41-report.pdf#page=262)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "d3240603-afa3-47b6-965a-d64617fd64b8", | ||
"metadata": {}, | ||
"source": [ | ||
"* Chaque processus a alors besoin de la position\n", | ||
" (**déplacement**) du premier élément qui le concerne et\n", | ||
" du nombre (**compte**) d'éléments à envoyer ou recevoir\n", | ||
"* Tous les processus doivent calculer ces **déplacements**\n", | ||
" et **comptes** dans une étape préliminaire" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "432539d9-1704-4cd5-8602-53ff50cd9a89", | ||
"metadata": {}, | ||
"source": [ | ||
"`rank` | 0 | 1 | 2\n", | ||
":---------------------:|:--------:|:--------:|:--------:\n", | ||
"vecteur (`n` éléments) | 5 8 3 12 | 34 12 45 | 43 65 2 1\n", | ||
"Indices | 0 1 2 3 | 4 5 6 | 7 8 9 10\n", | ||
"déplacement (`debut`) | 0 | 4 | 7\n", | ||
"compte (`fin-debut`) | 4 | 3 | 4" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ac6d33b7-c3e5-4a57-acc3-ad8030104ed9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.7" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ chapters: | |
- file: 2-mpi | ||
- file: 3-point-a-point | ||
- file: 4-collectives | ||
- file: 5-conclusion | ||
- file: 99-references |