18/01/2027

MeluXina: GPU Programming in Python with CUDA Kernels and Shared Memory

Register now  →
18 January 2027  ·  13:00–17:00  ·  Online
 
 ⠀

⠀


Introduction
 
Writing GPU programs involves deciding how to divide computations among threads and how those threads access and share data. MeluXina: GPU Programming in Python with CUDA Kernels and Shared Memory builds on the foundations introduced in Introduction to GPU Acceleration with Python, helping participants develop their skills in writing custom CUDA kernels with Numba CUDA.

The course begins with a recap of GPU computing and basic CUDA kernels. Participants then explore how threads, blocks and grids organise computations, practise writing kernels for one-dimensional arrays, and extend these ideas to two-dimensional data such as matrices and images.

The training covers three main areas:

01
Custom CUDA kernels: write and launch GPU functions in Python, manage data transfers, and check results.
 
02
Thread organisation and indexing: assign threads to array elements and handle data boundaries correctly.
 
03
Shared memory: understand how threads within a block can cooperate and reuse data.

A guided example brings these concepts together: each output value is calculated using an array element and its neighbours. Participants first examine a version using global memory, then explore how shared memory allows neighbouring threads to reuse data. They will also learn why shared memory is useful for some computations but does not automatically improve performance.

All practical exercises run on MeluXina, Luxembourg’s national supercomputer, combining step-by-step explanations with hands-on CUDA Python programming.

What will you learn?
 

You will follow the complete workflow: prepare data on the CPU, copy it to the GPU, launch a kernel and retrieve the results. Starting with array addition, you will learn how threads, blocks and grids organise work, extend the same ideas to two-dimensional data, and use shared memory so threads within a block can reuse data.

The final example is a one-dimensional stencil, where each output uses a value and its neighbours. You will examine both global-memory and shared-memory versions, including boundary handling, extra neighbour values called halos, and thread synchronisation. The emphasis is on understanding and correctness.
Learning outcomes
 

By the end of the course, participants will be able to:

  • ▸Explain how a CUDA kernel is executed by threads organised into blocks and grids.
  • ▸Write and launch simple Numba CUDA kernels for one-dimensional array operations.
  • ▸Calculate thread indices and launch dimensions, and apply checks that prevent out-of-bounds access.
  • ▸Move arrays between CPU and GPU memory and retrieve results for checking.
  • ▸Use two-dimensional grids for basic matrix and image-like array operations.
  • ▸Distinguish global memory from block-local shared memory and identify opportunities for data reuse.
  • ▸Use shared memory and block synchronisation in a guided one-dimensional stencil example, including halo values and array boundaries.
  • ▸Run the exercises on MeluXina using GPU resources allocated through Slurm.
Speaker
 
 
 
 
Samir El-Amrany
Post-Doctoral researcher
Department of Computer Science, University of Luxembourg
Mr El-Amrany leads this training session and is your point of contact for any questions about the content.
Agenda
 
13:00 – 13:30Welcome and recap
CPU and GPU roles, host and device, data transfers, and a recap of CuPy operations and custom CUDA kernels. Check the MeluXina GPU environment.
13:30 – 14:05CUDA kernel recap and execution model
Write and launch array addition. Explain threads, blocks, grids, global indices, launch dimensions and boundary checks.
14:05 – 14:15Break
14:15 – 14:45Practice with one-dimensional arrays
Modify kernels for multiplication, scaling or thresholding. Manage device arrays explicitly and check the results.
14:45 – 15:15Two-dimensional grids
Map threads to rows and columns. Configure a 2D launch and apply boundary checks in a matrix operation.
15:15 – 15:30Break
15:30 – 16:00Global and shared memory
Introduce block-local storage, local versus global indices, data reuse and the load–synchronise–compute pattern.
16:00 – 16:45Guided shared-memory stencil
Compute with neighbouring values. Explore the global-memory version, then load shared data and halos, synchronise and handle boundaries. Adapt the calculation to a local average.
16:45 – 17:00Recap and questions
Review common mistakes, when shared memory is useful, and the main concepts from the exercises.
Who should attend?
Researchers, students, engineers and developers who use Python for numerical or scientific computing and want to learn how to accelerate their applications using NVIDIA GPUs.
Prerequisites?
Basic Python and NumPy knowledge.
Participants should have access to the MeluXina training environment to complete the practical exercises.
Basic terminal familiarity is helpful.

18/01/2027