-
Notifications
You must be signed in to change notification settings - Fork 110
DRAFT: OpenMP Target Build Scripts for El Cap #1937
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
base: develop
Are you sure you want to change the base?
Changes from all commits
cd946d8
9940386
dac8a89
cc9fae8
1988b43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,18 @@ namespace RAJA | |
| namespace util | ||
| { | ||
|
|
||
| void * custom_memcpy( void * dest, const void * src, size_t len ) | ||
| { | ||
| char * customdest = (char *) dest; | ||
| const char * customsrc = (const char *) src; | ||
|
|
||
| for ( size_t ii = 0; ii < len; ++ii ) | ||
| { | ||
| customdest[ii] = customsrc[ii]; | ||
| } | ||
|
|
||
| return dest; | ||
| } | ||
|
Comment on lines
+36
to
+47
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldn't need to do this. Asking AMD about this.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you hear anything back? It shouldn't be required, makes me wonder if there's a header or builtin missing that's causing problems.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They reproduced it a couple weeks ago and are looking in to solving it. The Cray compiler has these symbols in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @rchen20. If you don't get satisfaction on this, let me know. I'm going to try and mention it on our checkin with AMD engineering this afternoon to keep it on their radar. |
||
|
|
||
| /*! | ||
| * Reinterpret any datatype as another datatype of the same size | ||
|
|
@@ -43,7 +55,8 @@ RAJA_INLINE RAJA_HOST_DEVICE constexpr B reinterp_A_as_B(A const& a) | |
| static_assert(sizeof(A) == sizeof(B), "A and B must be the same size"); | ||
|
|
||
| B b; | ||
| memcpy(&b, &a, sizeof(A)); | ||
| //memcpy(&b, &a, sizeof(A)); | ||
| custom_memcpy(&b, &a, sizeof(A)); | ||
| return b; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| ############################################################################### | ||
| # Copyright (c) 2016-25, Lawrence Livermore National Security, LLC | ||
| # and RAJA project contributors. See the RAJA/LICENSE file for details. | ||
| # | ||
| # SPDX-License-Identifier: (BSD-3-Clause) | ||
| ############################################################################### | ||
|
|
||
| if [[ $# -lt 2 ]]; then | ||
| echo | ||
| echo "You must pass 2 or more arguments to the script (in the following order): " | ||
| echo " 1) compiler version number" | ||
| echo " 2) HIP compute architecture" | ||
| echo " 3...) optional arguments to cmake" | ||
| echo | ||
| echo "For example: " | ||
| echo " toss4_amdclang.sh 4.1.0 gfx906" | ||
| exit | ||
| fi | ||
|
|
||
| COMP_VER=$1 | ||
| COMP_ARCH=$2 | ||
| shift 2 | ||
|
|
||
| HOSTCONFIG="hip_3_X" | ||
|
|
||
| if [[ ${COMP_VER} == 4.* ]] | ||
| then | ||
| ##HIP_CLANG_FLAGS="-mllvm -amdgpu-fixed-function-abi=1" | ||
| HOSTCONFIG="hip_4_link_X" | ||
| elif [[ ${COMP_VER} == 3.* ]] | ||
| then | ||
| HOSTCONFIG="hip_3_X" | ||
| else | ||
| echo "Unknown hip version, using ${HOSTCONFIG} host-config" | ||
| fi | ||
|
|
||
| BUILD_SUFFIX=lc_toss4-amdclang-omptarget-${COMP_VER}-${COMP_ARCH} | ||
|
|
||
| echo | ||
| echo "Creating build directory build_${BUILD_SUFFIX} and generating configuration in it" | ||
| echo "Configuration extra arguments:" | ||
| echo " $@" | ||
| echo | ||
| echo "To use fp64 HW atomics you must configure with these options when using gfx90a and hip >= 5.2" | ||
| echo " -DCMAKE_CXX_FLAGS=\"-munsafe-fp-atomics\"" | ||
| echo | ||
|
|
||
| rm -rf build_${BUILD_SUFFIX} >/dev/null | ||
| mkdir build_${BUILD_SUFFIX} && cd build_${BUILD_SUFFIX} | ||
|
|
||
|
|
||
| module load cmake/3.24.2 | ||
|
|
||
| # unload rocm to avoid configuration problems where the loaded rocm and COMP_VER | ||
| # are inconsistent causing the rocprim from the module to be used unexpectedly | ||
| module unload rocm | ||
|
|
||
|
|
||
| cmake \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DROCM_ROOT_DIR="/opt/rocm-${COMP_VER}" \ | ||
| -DHIP_ROOT_DIR="/opt/rocm-${COMP_VER}/hip" \ | ||
| -DHIP_PATH=/opt/rocm-${COMP_VER}/llvm/bin \ | ||
| -DENABLE_CLANGFORMAT=On \ | ||
| -DCLANGFORMAT_EXECUTABLE=/opt/rocm-5.2.3/llvm/bin/clang-format \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should point at regular clang for clang-format |
||
| -DCMAKE_C_COMPILER=/opt/rocm-${COMP_VER}/llvm/bin/amdclang \ | ||
| -DCMAKE_CXX_COMPILER=/opt/rocm-${COMP_VER}/llvm/bin/amdclang++ \ | ||
| -DCMAKE_HIP_ARCHITECTURES="${COMP_ARCH}" \ | ||
| -DGPU_TARGETS="${COMP_ARCH}" \ | ||
| -DAMDGPU_TARGETS="${COMP_ARCH}" \ | ||
| -DBLT_CXX_STD=c++17 \ | ||
| -C "../host-configs/lc-builds/toss4/${HOSTCONFIG}.cmake" \ | ||
| -DENABLE_HIP=OFF \ | ||
| -DENABLE_OPENMP=ON \ | ||
| -DENABLE_CUDA=OFF \ | ||
| -DRAJA_ENABLE_TARGET_OPENMP=ON \ | ||
| -DBLT_OPENMP_COMPILE_FLAGS="-fopenmp;-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa;-march=gfx942" \ | ||
| -DBLT_OPENMP_LINK_FLAGS="-fopenmp;-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa;-march=gfx942" \ | ||
| -DENABLE_BENCHMARKS=On \ | ||
| -DCMAKE_INSTALL_PREFIX=../install_${BUILD_SUFFIX} \ | ||
| "$@" \ | ||
| .. | ||
|
|
||
| echo | ||
| echo "***********************************************************************" | ||
| echo | ||
| echo "cd into directory build_${BUILD_SUFFIX} and run make to build RAJA" | ||
| echo | ||
| echo " Please note that you have to have a consistent build environment" | ||
| echo " when you make RAJA as cmake may reconfigure; unload the rocm module" | ||
| echo " or load the appropriate rocm module (${COMP_VER}) when building." | ||
| echo | ||
| echo " module unload rocm" | ||
| echo " srun -n1 make" | ||
| echo | ||
| echo "***********************************************************************" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| ############################################################################### | ||
| # Copyright (c) 2016-25, Lawrence Livermore National Security, LLC | ||
| # and RAJA project contributors. See the RAJA/LICENSE file for details. | ||
| # | ||
| # SPDX-License-Identifier: (BSD-3-Clause) | ||
| ############################################################################### | ||
|
|
||
| if [ "$1" == "" ]; then | ||
| echo | ||
| echo "You must pass a compiler version number to script. For example," | ||
| echo " toss4_clang.sh 10.3.1" | ||
| exit | ||
| fi | ||
|
|
||
| COMP_VER=$1 | ||
| shift 1 | ||
|
|
||
| BUILD_SUFFIX=lc_toss4-clang-${COMP_VER} | ||
|
|
||
| echo | ||
| echo "Creating build directory build_${BUILD_SUFFIX} and generating configuration in it" | ||
| echo "Configuration extra arguments:" | ||
| echo " $@" | ||
| echo | ||
|
|
||
| rm -rf build_${BUILD_SUFFIX} 2>/dev/null | ||
| mkdir build_${BUILD_SUFFIX} && cd build_${BUILD_SUFFIX} | ||
|
|
||
| module load cmake/3.24.2 | ||
|
|
||
| cmake \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_CXX_COMPILER=clang++ \ | ||
| -DBLT_CXX_STD=c++17 \ | ||
| -DENABLE_CLANGFORMAT=On \ | ||
| -C ../host-configs/lc-builds/toss4/clang_X.cmake \ | ||
| -DENABLE_OPENMP=On \ | ||
| -DRAJA_ENABLE_TARGET_OPENMP=ON \ | ||
| -DBLT_OPENMP_COMPILE_FLAGS="-fopenmp;-fopenmp-targets=amdgcn-amd-amdhsa" \ | ||
| -DBLT_OPENMP_LINK_FLAGS="-fopenmp;-fopenmp-targets=amdgcn-amd-amdhsa" \ | ||
| -DENABLE_BENCHMARKS=On \ | ||
| -DCMAKE_INSTALL_PREFIX=../install_${BUILD_SUFFIX} \ | ||
| "$@" \ | ||
| .. | ||
| # -DCLANGFORMAT_EXECUTABLE=/usr/tce/packages/clang/clang-14.0.6/bin/clang-format \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be using the hip_4 host-config file