Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| formation:astrosim2017gpu4dummies [2017/07/07 06:37] – [What inside my host ?] equemene | formation:astrosim2017gpu4dummies [2017/07/10 16:52] (Version actuelle) – [NBody, a simplistic simulator] equemene | ||
|---|---|---|---|
| Ligne 10: | Ligne 10: | ||
| * **What ?** Test with dummie examples | * **What ?** Test with dummie examples | ||
| * **When ?** Friday, the 7th of July in the afternoon | * **When ?** Friday, the 7th of July in the afternoon | ||
| - | * **How much ?** Nothing, Blaise Pascal Center provides workstations & cluster nodes | + | * **How much ?** Nothing, Blaise Pascal Center provides |
| * **Where ?** On workstations, | * **Where ?** On workstations, | ||
| * **Who ?** For people who want to open the hood | * **Who ?** For people who want to open the hood | ||
| - | * **How ?** Applying some simples | + | * **How ?** Applying some simple |
| ===== Session Goal ===== | ===== Session Goal ===== | ||
| Ligne 40: | Ligne 40: | ||
| * **p100alpha**, | * **p100alpha**, | ||
| * **k40m** : virtual workstations with dedicated one Nvidia Tesla K40m | * **k40m** : virtual workstations with dedicated one Nvidia Tesla K40m | ||
| + | |||
| + | Have a look to [[http:// | ||
| === Prerequisite for humanware === | === Prerequisite for humanware === | ||
| Ligne 188: | Ligne 190: | ||
| On the workstations in CBP, all available implementations of OpenCL are available. | On the workstations in CBP, all available implementations of OpenCL are available. | ||
| - | The command '' | + | The command '' |
| < | < | ||
| Platform #0: Clover | Platform #0: Clover | ||
| Ligne 214: | Ligne 216: | ||
| The command '' | The command '' | ||
| - | On the example platform, the command '' | + | On the example platform, the command '' |
| | | ||
| Platform Name | Platform Name | ||
| Ligne 239: | Ligne 241: | ||
| </ | </ | ||
| - | === Exercice #6 : get the informations with '' | + | === Exercice #6 : get the informations with the previous and filtered |
| * Compare the informations between CPU implementations. Why these differencies ? | * Compare the informations between CPU implementations. Why these differencies ? | ||
| Ligne 247: | Ligne 249: | ||
| ===== Exploration with original one : xGEMM ===== | ===== Exploration with original one : xGEMM ===== | ||
| - | In the lecture about the GPUs, we present the GPU as a great matrix multiplier. In ''/ | + | ==== From BLAS to xGEMM : implementations ==== |
| - | ===== Exploration with dummie codes ===== | + | In the lecture about the GPUs, we present the GPU as a great matrix multiplier. On of the most common Linear Algebra librairies is BLAS one, formelly [[https:// |
| - | ==== A GPU, a performant | + | These subprograms can be considered as // |
| + | |||
| + | On CPU, Intel sells its optimized implementation in [[https:// | ||
| + | |||
| + | The implementation on Matrix Multiply in BLAS librairies is '' | ||
| + | |||
| + | ==== Test examples | ||
| + | |||
| + | Inside ''/ | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | The source code and '' | ||
| + | * on workstations: | ||
| + | * on website: [[http:// | ||
| + | |||
| + | The program call with '' | ||
| + | * size of square matrix | ||
| + | * number of iterations | ||
| + | |||
| + | The output provides: | ||
| + | * the mean elapsed time of each cycle | ||
| + | * the number of estimated GFlops | ||
| + | * the error estimated by the difference between trace of matrix multiply results | ||
| + | |||
| + | Examples on runs on the several implementations:< | ||
| + | # ./ | ||
| + | Using FBLAS: 10 iterations for 1000x1000 matrix | ||
| + | |||
| + | Duration of each cycle : 0.2133281000 s | ||
| + | Number of GFlops : 18.741 | ||
| + | Error 0.0000000000 | ||
| + | |||
| + | # ./ | ||
| + | Using GSL: 10 iterations for 1000x1000 matrix | ||
| + | |||
| + | Duration of each cycle : 8.1447937000 s | ||
| + | Number of GFlops : 0.491 | ||
| + | Error 0.0000000000 | ||
| + | |||
| + | # ./ | ||
| + | Using CBLAS: 1000 iterations for 1000x1000 matrix | ||
| + | |||
| + | Duration of each cycle : 0.0161011820 s | ||
| + | Number of GFlops : 248.305 | ||
| + | Error 0.0000000000 | ||
| + | |||
| + | # ./ | ||
| + | Using CuBLAS: 1000 iterations for 1000x1000 matrix | ||
| + | |||
| + | Duration of memory allocation : 0.6675190000 s | ||
| + | Duration of memory free : 0.0004700000 s | ||
| + | Duration of each cycle : 0.0005507960 s | ||
| + | Number of GFlops : 7258.586 | ||
| + | Error 0.0000000000 | ||
| + | |||
| + | # ./ | ||
| + | Using CuBLAS/ | ||
| + | |||
| + | Duration of each cycle : 0.0143951160 s | ||
| + | Number of GFlops : 277.733 | ||
| + | Error 0.0000000000 | ||
| + | |||
| + | # ./ | ||
| + | Using CLBLAS: 1000 iterations for 1000x1000 matrix on (1,0) | ||
| + | Device (1,0): GeForce GTX 1080 Ti | ||
| + | |||
| + | Duration of memory allocation : 0.6057190000 s | ||
| + | Duration of memory free : 0.0049670000 s | ||
| + | Duration of each cycle : 0.0029998720 s | ||
| + | Number of GFlops : 1332.724 | ||
| + | Error 0.0000000000 | ||
| + | </ | ||
| + | |||
| + | === Exercice #6 : launch '' | ||
| + | |||
| + | * Which on the CPU implementations is the powerful | ||
| + | * Increase the size of matrix | ||
| + | * Move from simple precision to double precision (SP to DP) and examine the elapsed time on CPU | ||
| + | * Move from simple precision to double precision (SP to DP) and examine the elapsed time on GPU | ||
| + | |||
| + | ===== Exploration with dummie codes ===== | ||
| ==== Pi Monte Carlo, a Compute Bound Example ==== | ==== Pi Monte Carlo, a Compute Bound Example ==== | ||
| + | The '' | ||
| + | |||
| + | It's available on: | ||
| + | * on file: ''/ | ||
| + | * on website: [[http:// | ||
| + | |||
| + | Copy the '' | ||
| + | mkdir / | ||
| + | cd / | ||
| + | cp / | ||
| + | </ | ||
| + | |||
| + | The documentation is available by the call of ''/ | ||
| + | PiXPU.py -o (Out of Core Metrology) -c (Print Curves) -d < | ||
| + | |||
| + | Informations about devices detected under OpenCL API: | ||
| + | Device #0 from The pocl project of type *PU : pthread-Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz | ||
| + | Device #1 from NVIDIA Corporation of type *PU : GeForce GTX TITAN | ||
| + | Device #2 from Intel(R) Corporation of type *PU : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz | ||
| + | Device #3 from Advanced Micro Devices, Inc. of type *PU : Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz | ||
| + | |||
| + | Informations about devices detected under CUDA API: | ||
| + | Device #0 of type GPU : GeForce GTX TITAN | ||
| + | </ | ||
| + | |||
| + | The '' | ||
| + | Devices Identification : [0] | ||
| + | GpuStyle used : OpenCL | ||
| + | Iterations : 1000000 | ||
| + | Number of Blocks on begin : 1 | ||
| + | Number of Blocks on end : 1 | ||
| + | Step on Blocks : 1 | ||
| + | Number of Threads on begin : 1 | ||
| + | Number of Threads on end : 1 | ||
| + | Step on Threads : 1 | ||
| + | Number of redo : 1 | ||
| + | Metrology done out of XPU : False | ||
| + | Type of Marsaglia RNG used : MWC | ||
| + | Type of variable : FP32 | ||
| + | Device #0 from The pocl project of type xPU : pthread-Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz | ||
| + | Device #1 from NVIDIA Corporation of type xPU : GeForce GTX 1080 Ti | ||
| + | Device #2 from Intel(R) Corporation of type xPU : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz | ||
| + | Device #3 from Advanced Micro Devices, Inc. of type xPU : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz | ||
| + | (' | ||
| + | Pi estimation 3.14192800 | ||
| + | 0.03 0.03 0.00 0.03 0.03 37357749 37357749 0 37357749 37357749 | ||
| + | </ | ||
| + | |||
| + | Two file are created by default: | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | === Exercice #7 : explore '' | ||
| + | |||
| + | * Without any parameters (the default ones) : | ||
| + | * what is the selected device ? How many itops (iterative operations per second) do you reach ? | ||
| + | * With only the device parameter as '' | ||
| + | * What are the different ratios between the devices ? Which one is the most powerful ? | ||
| + | * With the selector of device and increasing the number of iterations and the number of redo : | ||
| + | * What arrive to itops values ? What is the typical variability on results ? | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | === Exercice #8 : explore '' | ||
| + | |||
| + | * With a PR from '' | ||
| + | * How decrease the elapsed time of | ||
| + | * With the selector of device and increasing the number of iterations and the number of redo : | ||
| + | * What arrive to itops values ? What is the typical variability on results ? | ||
| + | |||
| + | < | ||
| + | |||
| + | In this case, we define a gnuplot config file as follow. Adapt to your files and configuration. | ||
| + | < | ||
| + | set xlabel ' | ||
| + | set ylabel ' | ||
| + | plot ' | ||
| + | </ | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | === Exercice #9 : explore '' | ||
| + | |||
| + | * Explore with '' | ||
| + | * For which '' | ||
| + | |||
| + | To explore on this platform the GPU device (device #1) from 2048 to 32768 as parallel rates with a step of 128 and 1000000000 iterations: < | ||
| + | ./PiXPU.py -d 1 -b 2048 -e $((2048*16)) -s 128 -i 10000000000 -r 10 | ||
| + | </ | ||
| + | |||
| + | Output files are: | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | In this case, you can define a gnuplot config file | ||
| + | < | ||
| + | set xlabel ' | ||
| + | set ylabel ' | ||
| + | plot ' | ||
| + | </ | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | === Exercice #10 : explore '' | ||
| + | |||
| + | < | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | In this case, you can define a gnuplot config file | ||
| + | < | ||
| + | set xlabel ' | ||
| + | set ylabel ' | ||
| + | plot ' | ||
| + | </ | ||
| + | |||
| + | {{ : | ||
| ==== NBody, a simplistic simulator ==== | ==== NBody, a simplistic simulator ==== | ||
| + | The '' | ||
| + | |||
| + | It's available on: | ||
| + | * on file: ''/ | ||
| + | * on website: [[http:// | ||
| + | |||
| + | Launch the code with a '' | ||
| + | < | ||
| + | python NBody.py -n 2 -g -i 1000 | ||
| + | </ | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | === Exercice #10 : explore '' | ||
| + | |||
| + | === Exercice #11 : explore '' | ||
| + | |||
| + | === Exercice #12 : explore '' | ||
| ===== Exploration with production codes ===== | ===== Exploration with production codes ===== | ||
| ==== PKDGRAV3 ==== | ==== PKDGRAV3 ==== | ||
| + | |||