From c13615b05c0a01ef7d3f633c4f67f4093c2c9dfe Mon Sep 17 00:00:00 2001 From: Cristian-Vasile Achim <66278390+csccva@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:26:17 +0300 Subject: [PATCH] Update exercise-instructions.md --- exercise-instructions.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/exercise-instructions.md b/exercise-instructions.md index 61fae960..b51ec79f 100644 --- a/exercise-instructions.md +++ b/exercise-instructions.md @@ -184,10 +184,18 @@ CC -xhip ``` HIP codes can be compiled as well using the `hipcc` AMD compiler: ``` -hipcc --offload-arch=gfx90a streams.cpp +hipcc --offload-arch=gfx90a `CC --cray-print-opts=cflags` .cpp `CC --cray-print-opts=libs` ``` -The flag `--offload-arch=gfx90a` indicates that we are targeting MI200 GPUs. +The flag `--offload-arch=gfx90a` indicates that we are targeting MI200 GPUs. If the code uses some libraries we need extract from the `CC` wrapers. This is doen via the flags `CC --cray-print-opts=cflags` and `CC --cray-print-opts=libs`. +A more elegant solution would be to use: +``` +export HIPCC_COMPILE_FLAGS_APPEND="--offload-arch=gfx90a $(CC --cray-print-opts=cflags)" +export HIPCC_LINK_FLAGS_APPEND=$(CC --cray-print-opts=libs) + +hipcc +``` +This is helpful when using make. #### HIPFORT The following modules are required: ```bash