diff --git a/test/gpu/native/examples/amd-training/README.md b/test/gpu/native/examples/amd-training/README.md new file mode 100644 index 000000000000..66e933fbfcc2 --- /dev/null +++ b/test/gpu/native/examples/amd-training/README.md @@ -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. diff --git a/test/gpu/native/examples/amd-training/basic.chpl b/test/gpu/native/examples/amd-training/basic.chpl new file mode 100644 index 000000000000..d407c573ae72 --- /dev/null +++ b/test/gpu/native/examples/amd-training/basic.chpl @@ -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); + diff --git a/test/gpu/native/examples/amd-training/basic.good b/test/gpu/native/examples/amd-training/basic.good new file mode 100644 index 000000000000..e69de29bb2d1