diff --git a/host-configs/lc-builds/toss4/clang_X_asan.cmake b/host-configs/lc-builds/toss4/clang_X_asan.cmake new file mode 100644 index 0000000000..fa2daa95b0 --- /dev/null +++ b/host-configs/lc-builds/toss4/clang_X_asan.cmake @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2016-24, Lawrence Livermore National Security, LLC +# and RAJA project contributors. See the RAJA/LICENSE file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +############################################################################### + +set(RAJA_COMPILER "RAJA_COMPILER_CLANG" CACHE STRING "") + +set(CMAKE_CXX_FLAGS_RELEASE "--gcc-toolchain=/usr/tce/packages/gcc/gcc-10.3.1 -O3 -march=native -funroll-loops -finline-functions -fsanitize=address -fno-omit-frame-pointer" CACHE STRING "") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "--gcc-toolchain=/usr/tce/packages/gcc/gcc-10.3.1 -O3 -g -march=native -funroll-loops -finline-functions -fsanitize=address -fno-omit-frame-pointer" CACHE STRING "") +set(CMAKE_CXX_FLAGS_DEBUG "--gcc-toolchain=/usr/tce/packages/gcc/gcc-10.3.1 -O0 -g -fsanitize=address -fno-omit-frame-pointer" CACHE STRING "") + +set(RAJA_HOST_CONFIG_LOADED On CACHE BOOL "") diff --git a/host-configs/lc-builds/toss4/clang_X_ubsan.cmake b/host-configs/lc-builds/toss4/clang_X_ubsan.cmake new file mode 100644 index 0000000000..3cda001f04 --- /dev/null +++ b/host-configs/lc-builds/toss4/clang_X_ubsan.cmake @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2016-24, Lawrence Livermore National Security, LLC +# and RAJA project contributors. See the RAJA/LICENSE file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +############################################################################### + +set(RAJA_COMPILER "RAJA_COMPILER_CLANG" CACHE STRING "") + +set(CMAKE_CXX_FLAGS_RELEASE "--gcc-toolchain=/usr/tce/packages/gcc/gcc-10.3.1 -O3 -march=native -funroll-loops -finline-functions -fsanitize=undefined -fno-omit-frame-pointer -fsanitize=integer" CACHE STRING "") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "--gcc-toolchain=/usr/tce/packages/gcc/gcc-10.3.1 -O3 -g -march=native -funroll-loops -finline-functions -fsanitize=undefined -fno-omit-frame-pointer -fsanitize=integer" CACHE STRING "") +set(CMAKE_CXX_FLAGS_DEBUG "--gcc-toolchain=/usr/tce/packages/gcc/gcc-10.3.1 -O0 -g -fsanitize=undefined -fno-omit-frame-pointer -fsanitize=integer" CACHE STRING "") + +set(RAJA_HOST_CONFIG_LOADED On CACHE BOOL "") diff --git a/include/RAJA/policy/openmp/launch.hpp b/include/RAJA/policy/openmp/launch.hpp index f3aabcf579..7856bd6fda 100644 --- a/include/RAJA/policy/openmp/launch.hpp +++ b/include/RAJA/policy/openmp/launch.hpp @@ -77,6 +77,9 @@ struct LaunchExecute { ctx.shared_mem_ptr = (char*) malloc(launch_params.shared_mem_size); expt::invoke_body(f_params, loop_body.get_priv(), ctx); + + free(ctx.shared_mem_ptr); + ctx.shared_mem_ptr = nullptr; } expt::ParamMultiplexer::resolve(f_params); diff --git a/scripts/lc-builds/toss4_clang_san.sh b/scripts/lc-builds/toss4_clang_san.sh new file mode 100755 index 0000000000..e7501c09cd --- /dev/null +++ b/scripts/lc-builds/toss4_clang_san.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +############################################################################### +# Copyright (c) 2016-24, 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 2 arguments to the script (in this order): " + echo " 1) compiler version number for clang" + echo " 2) sanitizer version (one of 2 options: asan, or ubsan)" + echo + echo "For example: " + echo " toss4_clang.sh 14.0.6-magic asan" + exit +fi + +COMP_VER=$1 +SAN_VER=$2 +shift 2 + +if [[ ( ${SAN_VER} != "asan" ) && ( ${SAN_VER} != "ubsan" ) ]] ; then + echo "Sanitizer version must be \"asan\" or \"ubsan\". Exiting!" ; exit +fi + +BUILD_SUFFIX=lc_toss4-clang-${COMP_VER}-${SAN_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.23.1 + +cmake \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_COMPILER=/usr/tce/packages/clang/clang-${COMP_VER}/bin/clang++ \ + -DBLT_CXX_STD=c++14 \ + -C ../host-configs/lc-builds/toss4/clang_X_${SAN_VER}.cmake \ + -DENABLE_OPENMP=On \ + -DCMAKE_INSTALL_PREFIX=../install_${BUILD_SUFFIX} \ + "$@" \ + .. + +if [[ ( ${SAN_VER} = "ubsan" ) ]] ; then + echo "To view ubsan output, set the following environment variable: " + echo " UBSAN_OPTIONS=log_path=/path/to/ubsan_log_prefix" + echo + echo "Each test will create a ubsan output file with the prefix \"ubsan_log_prefix\"." +fi diff --git a/scripts/lc-builds/toss4_icpc-classic.sh b/scripts/lc-builds/toss4_icpc-classic.sh index 248d8050ef..447cf35ac8 100755 --- a/scripts/lc-builds/toss4_icpc-classic.sh +++ b/scripts/lc-builds/toss4_icpc-classic.sh @@ -55,6 +55,6 @@ echo echo " Please note that you may need to add some intel openmp libraries to your" echo " LD_LIBRARY_PATH to run with openmp." echo -echo " LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/tce/packages/intel/intel-${COMP_VER}/compiler/lib/intel64_lin" +echo " LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/tce/packages/intel-classic/intel-classic-${COMP_VER}/compiler/lib/intel64_lin" echo echo "***********************************************************************" diff --git a/scripts/lc-builds/toss4_icpx.sh b/scripts/lc-builds/toss4_icpx.sh index c97479da9a..d6fe0d867b 100755 --- a/scripts/lc-builds/toss4_icpx.sh +++ b/scripts/lc-builds/toss4_icpx.sh @@ -39,8 +39,8 @@ source /usr/tce/packages/intel/intel-${COMP_VER}/setvars.sh cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_COMPILER=/usr/tce/packages/intel/intel-${COMP_VER}/compiler/${COMP_VER}/linux/bin/icpx \ - -DCMAKE_C_COMPILER=/usr/tce/packages/intel/intel-${COMP_VER}/compiler/${COMP_VER}/linux/bin/icx \ + -DCMAKE_CXX_COMPILER=/usr/tce/packages/intel/intel-${COMP_VER}/bin/icpx \ + -DCMAKE_C_COMPILER=/usr/tce/packages/intel/intel-${COMP_VER}/bin/icx \ -DBLT_CXX_STD=c++14 \ -C ../host-configs/lc-builds/toss4/icpx_X.cmake \ -DRAJA_ENABLE_FORCEINLINE_RECURSIVE=Off \