Skip to content

Commit

Permalink
8: Fix OpenCL instructions and code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
al42and committed Nov 12, 2024
1 parent 9e85eb7 commit 49e33d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions content/8-portable-kernel-models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ To compile a program, you can use the AMD compilers on a GPU partition:

.. code-block:: console
$ module load LUMI/23.03 partition/G
$ module load rocm/5.2.3
$ module load LUMI/24.03 partition/G
$ module load rocm/6.0.3
$ module load PrgEnv-cray-amd
$ CC program.cpp -lOpenCL -o program # C++ program
$ cc program.c -lOpenCL -o program # C program
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static const std::string kernel_source = R"(
// Perform reduction across the local work group
for (int s = 1; s < lsize; s *= 2) { // loop over local memory with stride doubling each iteration
if (lid % (2 * s) == 0) {
if (lid % (2 * s) == 0 && (lid + s) < lsize) {
local_mem[lid] += local_mem[lid + s];
}
barrier(CLK_LOCAL_MEM_FENCE); // synchronize local memory
Expand Down

0 comments on commit 49e33d1

Please sign in to comment.