Self-contained projects that show how to install GPU programming frameworks, build
GPU-accelerated programs, and execute them. Click on the links in the index table below to access
the readme
file of each project for more information.
Note: The projects are minimal examples, not complete tutorials. The readme
files in each
subdirectory provide references to more detailed resources.
Framework | Applications | Devices | Operating Systems | |||||
---|---|---|---|---|---|---|---|---|
Graphics | General-purpose | CPU | Nvidia | Intel | AMD | Apple Silicon | ||
OpenGL | Y | Y | N | Y | Y | Y | N | Any (deprecated on Mac) |
DirectX | Y | Y | N | Y | Y | Y | N | Windows |
Vulkan | Y | Y (implemented with kompute) | N | Y | Y | Y | N | Any (deprecated on Mac) |
Metal | Y* | Y* | N | N | N | N | Y | Mac / iOS |
WebGPU | Y | Y | N | Y | Y | Y | Y | Any |
CUDA | N | Y | N | Y | N | N | N | Windows, Linux |
OpenCL | N | Y | Y | Y | Y | Y | Y | Any (deprecated on Mac) |
SYCL | N | Y$ | Y | Y | Y | Y | Y | Any (CPU-only on Mac) |
Triton | N | Y | N | Y | N | Y | N | Linux |
CPU | N | Y | Y | N | N | N | N | Any |
- The sign
*
indicates that the corresponding example is not implemented in the project. - The sign
$
indicates that I did not manage to make it work!
The following table compares the performances of some backends to calculate the sum of elements in an array through sum reduction. Keep in mind that results vary depending on the system and are influenced by memory transfer overheads. This table is provided only as an indication.
Framework | Sum Reduction Time (s) for Array Sizes | |||
---|---|---|---|---|
256 | 1024 | 1e6 | 1e7 | |
C++ (1 CPU thread) | 1e-06 | 1e-06 | 0.000191 | 0.001341 |
OpenGL | 0.000605 | 0.000563 | 0.000582 | 0.000567 |
Run the Python script benchmark.py
to compare how performances vary depending on the number of
threads running on CPU:
# Linux
python3 benchmark.py
# OS that begins with the letter W
py benchmark.py
Ce dépôt contient des projets sans dépendances qui montrent comment installer un cadre logiciel de programmation de GPU, comment construire des programmes accélérés par GPU, et comment les exécuter. Cliquez sur les liens dans le tableau ci-dessous pour accéder à des informations supplémentaires sur chaque projet.
Note: Ces projets sont des exemples minimalistes et non des tutoriels complets. Les fichiers
readme
dans chaque sous-répertoire fournissent des ressources plus détaillées.
Cadre logiciel | Applications | Appareils | Systèmes d'exploitation | |||||
---|---|---|---|---|---|---|---|---|
Graphique | Calculs généraux | CPU | Nvidia | Intel | AMD | Apple Silicon | ||
OpenGL | O | O | N | O | O | O | N | Tous (réprouvé sur Mac) |
DirectX | O | O | N | O | O | O | N | Windows |
Vulkan | O | O (avec kompute) | N | O | O | O | N | Tous (réprouvé sur Mac) |
Metal | O* | O* | N | N | N | N | O | Mac / iOS |
WebGPU | O | O | N | O | O | O | O | Tous |
CUDA | N | O | N | O | N | N | N | Windows, Linux |
OpenCL | N | O | O | O | O | O | O | Tous (réprouvé sur Mac) |
SYCL | N | O$ | O | O | O | O | O | Tous (CPU seulement sur Mac) |
Triton | N | O | N | O | N | O | N | Linux |
CPU | N | O | O | N | N | N | N | Tous |
- Le signe
*
indique que l'exemple correspondant n'est pas inclus dans le projet. - Le signe
$
indique que je n'ai pas réussi à le faire fonctionner!