Difference between revisions of "GPU Tutorial/Julia"

From HPC Wiki
GPU Tutorial/Julia
Jump to navigation Jump to search
(Created page with "GPU Computing (Julia)<nowiki /> {{DISPLAYTITLE:GPU Computing (Julia)}}<nowiki /> {{Syllabus Introduction to GPU Computing}}<nowiki /> __TOC__ This vide...")
 
m
 
(5 intermediate revisions by the same user not shown)
Line 5: Line 5:
  
 
This video discusses the SAXPY via Julia and CUDA.jl.
 
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 === <!--T:5-->
  
 +
<youtube width="600" height="340" right>6pYUhi5zhPE</youtube>
 +
 +
([[Media:GPU_tutorial_saxpy_julia.pdf |Slides as pdf]])
  
 
=== Quiz === <!--T:5-->
 
=== Quiz === <!--T:5-->
 +
{{hidden begin
 +
|title = 1. How do you transfer an array called x_cpu to the GPU memory?}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
- x_gpu = CudaMalloc(x_cpu)
 +
|| That's CUDA C!
 +
+ x_gpu = CuArray(x_cpu)
 +
|| Correct
 +
- Julia just does that for you.
 +
|| Sadly, no.
 +
</quiz>
 +
{{hidden end}}
 +
 +
{{hidden begin
 +
|title = 2. How do you call a kernel function called gpu_kernel?}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
- gpu_kernel()
 +
|| No
 +
- CUDA.launch(gpu_kernel())
 +
|| No
 +
+ CUDA.@sync @cuda(threads=nthreads, blocks=nblocks, gpu_kernel())
 +
|| Correct
 +
- CUDA.parallelize(@auto) @cuda<<<nthreads, nblocks>>>gpu_kernel()
 +
|| Correct
 +
</quiz>
 +
{{hidden end}}

Latest revision as of 17:22, 21 January 2022

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()