Difference between revisions of "GPU Tutorial/SAXPY CUDA C"
GPU Tutorial/SAXPY CUDA C
Jump to navigation
Jump to search
m |
m |
||
Line 68: | Line 68: | ||
{ | { | ||
|type="()"} | |type="()"} | ||
− | - MyKernel() | + | - MyKernel(); |
|| Wrong. This would just execute an ordinary function. | || Wrong. This would just execute an ordinary function. | ||
− | - CUDA.run(NoBlocks, NoThreads, MyKernel()) | + | - CUDA.run(NoBlocks, NoThreads, MyKernel()); |
|| Wrong. There is no CUDA.run() | || Wrong. There is no CUDA.run() | ||
− | + <<<NoBlocks, NoThreads>>>MyKernel() | + | + <<<NoBlocks, NoThreads>>>MyKernel(); |
|| Correct | || Correct | ||
− | - __global(NoBlocks, NoThreads)__ MyKernel() | + | - __global(NoBlocks, NoThreads)__ MyKernel(); |
|| Wrong. __global__ and other modifiers cant have arguments and are part of a function definition, not launch. | || Wrong. __global__ and other modifiers cant have arguments and are part of a function definition, not launch. | ||
</quiz> | </quiz> | ||
Line 89: | Line 89: | ||
+ Each thread has has an index attached to it, which is addressed via threadIdx.x | + Each thread has has an index attached to it, which is addressed via threadIdx.x | ||
|| Correct | || Correct | ||
− | - If you use array-element-wise operations | + | - If you use array-element-wise operations, e.g.: y.=a.*x.+b . this is managed by the NVIDIA preprocessor. |
|| Wrong. There are no element-wise operators in C/C++ | || Wrong. There are no element-wise operators in C/C++ | ||
- You flag a line to be parallelized via keywords, e.g.: __device__ y=a*x+b | - You flag a line to be parallelized via keywords, e.g.: __device__ y=a*x+b |
Revision as of 12:44, 11 November 2021
Tutorial | |
---|---|
Title: | Introduction to GPU Computing |
Provider: | HPC.NRW
|
Contact: | tutorials@hpc.nrw |
Type: | Multi-part video |
Topic Area: | GPU computing |
License: | CC-BY-SA |
Syllabus
| |
1. Introduction | |
2. Several Ways to SAXPY: CUDA C/C++ | |
3. Several Ways to SAXPY: OpenMP | |
4. Several Ways to SAXPY: Julia | |
5. Several Ways to SAXPY: NUMBA |
This video discusses the SAXPY via NVIDIA CUDA C/C++.
Video
Quiz
1. Which features does CUDA add to C/C++?
2. What is a kernel?
3. How do you flag a function to be a kernel?
4. Let's say you coded your kernel function called "MyKernel". How do you run it?
5. Inside your kernel function, how do you distribute your data over the GPU threads?
Introduction Quiz
1. For which kind of program can we expect improvements with GPUs?
2. What does GPU stands for?
3. Why do we expect an overhead in the GPU timings?