Section outline

    • About the course

      Patricio Bulić, University of Ljubljana, Faculty of Computer and Information Science


      Content


      At this workshop we will get acquainted with the structure of graphic processing units (GPU) and their programming. Through simple examples, we will learn to write and run programs on the GPU, transfer data between the host and the GPU, and use memory efficiently on the GPU. Finally, we will write a parallel image processing program that will run on the GPU. We will program in the C programming language and use the OpenCL framework, which supports GPUs from various manufacturers (Nvidia, AMD, Intel). The same approaches to using GPU include other frameworks, so with the acquired knowledge you will easily start programming Nvidia graphics cards in the CUDA framework or replace the C programming language with another one.


      The course of events

      Day 1

      Getting to know the hardware structure and operation of the GPU; learning about the connection between the host and the GPU; getting acquainted with the software and memory model of GPU; learning about the OpenCL environment; writing, translating, and running a simple program written in OpenCL on a GPU.

      Day 2

      In a practical example, we will learn step by step about the efficient implementation of computational tasks on the GPU, their efficient parallelization and division of work by process units, and the efficient use of memory on the GPU.

      Day 3

      Processing images on the GPU: we will read the images on the host, transfer them to the GPU, process them there with an interesting filter and transfer the processed images back to the host.

      Prerequisites

      • Knowledge of SSH client and SLURM middleware. See the contents of the workshop Basics of Supercomputing
      • Knowledge of programming, desirable knowledge of programming language C

      Acquired knowledge


      After the workshop you will:
      • understand how a heterogeneous computer system with GPU works,
      • understand how GPU works,
      • know the OpenCL software framework,
      • know how to write, translate and run GPU programs,
      • be able to efficiently divide work by process units and use memory on GPU,
      • be able to make sense of ready-made GPU libraries.

      Instructions for installing Visual Studio Code


      At the workshop, we will program in the Visual Studio Code development environment and run the programs in the NSC cluster. Therefore, in the Visual Studio Code environment, we will use the Remote-SSH extension, which allows us to connect to an NSC cluster via the SSH protocol. With this extension, it is possible to download and edit files directly on the NSC cluster, run commands, and even debug programs running on it. Instructions for installing Visual Studio Code, Remote-SSH extensions, and connecting to an NSC cluster can be found here.

      Program code



      The program code of the problems that will be discussed at the workshop can be found at https://repo.sling.si/patriciob/opencl-delavnica. You can download it to your computer with the command:

      $ git clone https://repo.sling.si/patriciob/opencl-delavnica.git

      The material is published under the Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License. ↩

      The workshop is prepared under the auspices of the European project EuroCC, which aims to establish national centers of competence for supercomputing. More about the EuroCC project can be found on the SLING website.