Introduction to CUDA¶
CUDA, as native programming model of Nividia GPUs, allows very fine-grained control over parallel execution compared to higher level programming models such as OpenMP offloading, which helps to optimize performance.
The module provides an introduction to the programming language CUDA which is used to write fast numeric algorithms for NVIDIA GPUs. Focus is on the basic usage of the language, error handling and understanding kernel functions.
Prerequisites
Programming experience in any of C, C++, or Fortran
Basic experience in working with a Linux shell (e.g. see here)
Any knowledge about parallel programming is benefitial but not mandatory
Software setup
Reference
Learning outcomes¶
This material is for researchers, engineers, and students who want to learn how to program NVIDIA GPUs using CUDA for high-performance computing workloads.
After completing this module, learners will be able to:
Explain the host / device programming model and identify which parts of a program run on the CPU vs the GPU
Write a CUDA kernel using the
__global__qualifier and launch it from host code using the triple-chevron syntax in C/C++ and the equivalent syntax in CUDA Fortran (<<<...>>>)Map thread and block indices to data elements using the built-in
threadIdx/blockIdx/blockDim/gridDimvariables, and apply the grid-stride loop pattern to handle arbitrary data sizesApply the function execution-space qualifiers (
__global__,__device__,__host__ __device__) correctly and respect the restrictions that apply to device codeDetect and handle CUDA errors using error-checking macros, and understand the asynchronous nature of kernel-launch error reporting
See also¶
Credit
FIXME
Don’t forget to check out additional course materials from …
License
CC BY-SA for media and pedagogical material
Copyright © 2026 EVITA. This material is released by EVITA under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0).
Canonical URL: https://creativecommons.org/licenses/by-sa/4.0/
You are free to
Share — copy and redistribute the material in any medium or format for any purpose, even commercially.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms
Attribution — You must give appropriate credit , provide a link to the license, and indicate if changes were made . You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
Notices
You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation .
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.
MIT for source code and code snippets
MIT License
Copyright (c) 2026, EVITA project, Tobias Haas, Jasper Seehofer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Note
To module authors: For code you may use any OSI-approved license as mentioned in https://spdx.org/licenses/, such as Apache License 2.0, GNU GPLv3, MIT. Please make sure to update the deed above and
LICENSE.code file accordingly.