Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a simple GPU example used in a training slide #26513

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/gpu/native/examples/amd-training/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory contains a test that I've sent to be used in some AMD trainings.
Even though it is doing pretty fundamental stuff, It'd be good to get it tested
nightly.
10 changes: 10 additions & 0 deletions test/gpu/native/examples/amd-training/basic.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var CpuArr: [1..1_000_000] int; // allocate an array on the host memory
on here.gpus[0] { // move the execution to the GPU
var GpuArr = CpuArr; // copy the host array onto device memory
forall elem in GpuArr do elem += 1; // increment elements by 1
CpuArr = GpuArr; // copy the array back to the host
}

// This was not part of the slide and only there for correctness
assert((+ reduce CpuArr) == 1_000_000);

Empty file.
Loading