This lesson is being piloted (Beta version)

Machine Learning on GPU

This tutorial explores Machine Learning using GPU-enabled PyTorch for applications in high energy physics.

It follows directly from the Introduction to Machine Learning lesson written by Meirin Evans.



For physicists working on analysis in data-intensive fields such as particle physics, it’s quite common these days to start developing new machine learning applications. But many machine learning applications run more efficiently on GPU.

The aim of this lesson is to:

The skills we’ll focus on:

  1. Understanding a bit about GPUs
  2. Using Python & PyTorch to discover what kind of GPU is available to you
  3. Moving a machine learning model onto the GPU
  4. Comparing the performance of the machine learning model between the CPU and the GPU

HSF Software Training

HSF Logo
This training module is part of the HSF Software Training Center, a series of training modules that serves HEP newcomers the software skills needed as they enter the field, and in parallel, instill best practices for writing software.

Videos are provided at the top of each page to help guide you. For the Introduction section, which has no coding, the video simply takes you through the text, so choose whichever way you learn best: video or reading. For the remaining sections, the videos take you through the coding live.


Setup Download files required for the lesson
00:00 1. Introduction What is a GPU?
What role do GPUs play in machine learning?
Which machine learning libraries support GPUs?
Why should I use a GPU for my ML code?
00:15 2. Is a GPU available? How do I find out if a GPU is available?
How can I determine the specifications of the GPU?
How do I select to use the GPU?
00:35 3. Using the GPU How do I send my data to the GPU?
How do I train my model on the GPU?
00:55 4. Comfort break! Get up, stretch out, take a short break.
01:10 5. Run time comparisons Will the ML performance of my model improve when I use the GPU?
Will the computational performance of my model improve when I use the GPU?
01:30 6. Memory considerations Why do I need to send my data to the GPU in batches?
How can I monitor the GPU memory usage?
01:50 7. Comfort break! Get up, stretch out, take a short break.
02:05 8. OPTIONAL: Going Parallel How can I use multiple GPUs at once?
What are the limitations of multi-GPU machine learning?
02:35 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.