-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add config file and example for thread sanitizer support (#261)
* Add tsan config * Add example for tsan to catch * Add intel host config
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,19 @@ | ||
############################################################################## | ||
# Copyright (c) 2024, Lawrence Livermore National Security, LLC and CARE | ||
# project contributors. See the CARE LICENSE file for details. | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
############################################################################## | ||
|
||
set(COMPILER_BASE "/usr/tce/packages/clang/clang-14.0.6-magic" CACHE PATH "") | ||
set(CMAKE_C_COMPILER "${COMPILER_BASE}/bin/clang" CACHE PATH "") | ||
set(CMAKE_CXX_COMPILER "${COMPILER_BASE}/bin/clang++" CACHE PATH "") | ||
|
||
set(GCC_HOME "/usr/tce/packages/gcc/gcc-10.3.1-magic" CACHE PATH "") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --gcc-toolchain=${GCC_HOME} -fsanitize=thread -g" CACHE STRING "") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${GCC_HOME} -fsanitize=thread -g" CACHE STRING "") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread" CACHE STRING "") | ||
|
||
set(ENABLE_OPENMP ON CACHE BOOL "") | ||
set(BLT_EXPORT_THIRDPARTY OFF CACHE BOOL "") | ||
|
This file contains 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,17 @@ | ||
############################################################################## | ||
# Copyright (c) 2020-24, Lawrence Livermore National Security, LLC and CARE | ||
# project contributors. See the CARE LICENSE file for details. | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
############################################################################## | ||
|
||
set(COMPILER_BASE "/usr/tce/packages/intel/intel-2022.1.0-magic" CACHE PATH "") | ||
set(CMAKE_C_COMPILER "${COMPILER_BASE}/bin/icx" CACHE PATH "") | ||
set(CMAKE_CXX_COMPILER "${COMPILER_BASE}/bin/icpx" CACHE PATH "") | ||
|
||
set(GCC_HOME "/usr/tce/packages/gcc/gcc-10.3.1-magic" CACHE PATH "") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --gcc-toolchain=${GCC_HOME}" CACHE STRING "") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${GCC_HOME}" CACHE STRING "") | ||
|
||
set(BLT_EXPORT_THIRDPARTY OFF CACHE BOOL "") | ||
|
This file contains 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 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,37 @@ | ||
////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (c) 2024, Lawrence Livermore National Security, LLC and CARE | ||
// project contributors. See the CARE LICENSE file for details. | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
////////////////////////////////////////////////////////////////////////////// | ||
|
||
// CARE library header | ||
#include "care/care.h" | ||
#include "care/algorithm.h" | ||
|
||
// Std library headers | ||
#include <algorithm> | ||
#include <iostream> | ||
#include <limits> | ||
#include <vector> | ||
|
||
int main(int, char**) { | ||
const int size = 10; | ||
care::host_device_ptr<int> data(size); | ||
|
||
CARE_OPENMP_LOOP(i, 0, size) { | ||
data[0] += i; // clang tsan catches this | ||
} CARE_OPENMP_LOOP_END | ||
|
||
CARE_OPENMP_LOOP(i, 0, size - 1) { | ||
data[i] = data[i + 1]; // clang tsan catches this | ||
} CARE_OPENMP_LOOP_END | ||
|
||
CARE_OPENMP_LOOP(i, 0, size) { | ||
data[0] = 1; // clang tsan does not report | ||
} CARE_OPENMP_LOOP_END | ||
|
||
data.free(); | ||
return 0; | ||
} | ||
|