-
Notifications
You must be signed in to change notification settings - Fork 109
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
Open
rchen20
wants to merge
5
commits into
develop
Choose a base branch
from
task/chen59/omptargetelcap
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cd946d8
OpenMP Target build scripts for El Cap.
rchen20 9940386
Temporary setting of gcc-toolchain.
rchen20 dac8a89
Merge branch 'develop' into task/chen59/omptargetelcap
rhornung67 cc9fae8
Temporarily re-implement memcpy.
rchen20 1988b43
Merge branch 'task/chen59/omptargetelcap' of github.com:LLNL/RAJA int…
rchen20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
||
|
|
||
| /*! | ||
| * 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; | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 "***********************************************************************" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 \ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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