GPU Computing (Julia)

From HPC Wiki
GPU Tutorial/Julia
Jump to navigation Jump to search

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 Julia and CUDA.jl. The CUDA.jl package is the main programming interface for working with NVIDIA CUDA GPUs using Julia. It features a user-friendly array abstraction, a compiler for writing CUDA kernels in Julia, and wrappers for various CUDA libraries.

Video

(Slides as pdf)

Quiz

1. How do you transfer an array called x_cpu to the GPU memory?

x_gpu = CudaMalloc(x_cpu)
x_gpu = CuArray(x_cpu)
Julia just does that for you.

2. How do you call a kernel function called gpu_kernel?

gpu_kernel()
CUDA.launch(gpu_kernel())
CUDA.@sync @cuda(threads=nthreads, blocks=nblocks, gpu_kernel())
CUDA.parallelize(@auto) @cuda<<<nthreads, nblocks>>>gpu_kernel()