-
Notifications
You must be signed in to change notification settings - Fork 9
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
Run singularity-eos through clang address sanitizer... and fix the HIP segfault! #437
Changes from all commits
b8d4385
49bb334
27b3a8a
ec77b9d
520f1dc
5d053c7
ac4cf33
75519fa
07684af
20e9661
5b90563
1d938cf
596b086
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Sanitizer | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
sanitizer: | ||
name: Run clang sanitizer on minimal code subset | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Set system to non-interactive mode | ||
run: export DEBIAN_FRONTEND=noninteractive | ||
- name: install dependencies | ||
run: | | ||
sudo apt-get update -y -qq | ||
sudo apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -qq build-essential clang llvm | ||
- name: build and run tests | ||
run: | | ||
mkdir -p bin | ||
cd bin | ||
cmake -DCMAKE_CXX_COMPILER=clang++ \ | ||
-DCMAKE_CXX_FLAGS="-fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DSINGULARITY_STRICT_WARNINGS=ON \ | ||
-DSINGULARITY_USE_FORTRAN=OFF \ | ||
-DSINGULARITY_BUILD_FORTRAN_BACKEND=ON \ | ||
-DSINGULARITY_BUILD_TESTS=ON \ | ||
-DSINGULARITY_FORCE_SUBMODULE_MODE=ON \ | ||
-DSINGULARITY_USE_KOKKOS=ON \ | ||
.. | ||
make -j4 | ||
ctest --output-on-failure |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Warnings | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
warnings-gcc: | ||
name: Ensure no warnings from gcc | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Set system to non-interactive mode | ||
run: export DEBIAN_FRONTEND=noninteractive | ||
- name: install dependencies | ||
run: | | ||
sudo apt-get update -y -qq | ||
sudo apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -qq build-essential | ||
- name: build and run tests | ||
run: | | ||
mkdir -p bin | ||
cd bin | ||
cmake -DCMAKE_BUILD_TYPE=Debug \ | ||
-DSINGULARITY_STRICT_WARNINGS=ON \ | ||
-DSINGULARITY_USE_FORTRAN=OFF \ | ||
-DSINGULARITY_BUILD_FORTRAN_BACKEND=ON \ | ||
-DSINGULARITY_BUILD_TESTS=ON \ | ||
-DSINGULARITY_FORCE_SUBMODULE_MODE=ON \ | ||
-DSINGULARITY_USE_KOKKOS=ON \ | ||
.. | ||
make -j4 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,14 @@ cmake_dependent_option( | |
"SINGULARITY_USE_SPINER" OFF) | ||
|
||
option(SINGULARITY_USE_FORTRAN "Enable fortran bindings" ON) | ||
# Optionally build these if you want to build/test the fortran | ||
# infrastructure without invoking a fortran compiler If fortran is | ||
# off, you can set this. If fortran is on, it's forced to ON and is | ||
# not set-able. | ||
cmake_dependent_option(SINGULARITY_BUILD_FORTRAN_BACKEND | ||
"Build the C++ code to which the fortran bindings bind" | ||
OFF "NOT SINGULARITY_USE_FORTRAN" ON) | ||
Comment on lines
+49
to
+55
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. I added this mainly to support building with clang, because flang is still not super well supported, and I wanted to be able to run the C++ code through clang sanitizer. 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. I think this is a great idea! Thanks for adding it |
||
|
||
option(SINGULARITY_USE_KOKKOS "Use Kokkos for portability" OFF) | ||
option(SINGULARITY_USE_EOSPAC "Enable eospac backend" OFF) | ||
option(SINGULARITY_EOSPAC_ENABLE_SHMEM | ||
|
@@ -95,6 +103,7 @@ cmake_dependent_option( | |
# modify flags options | ||
option(SINGULARITY_BETTER_DEBUG_FLAGS "Better debug flags for singularity" ON) | ||
option(SINGULARITY_HIDE_MORE_WARNINGS "hide more warnings" OFF) | ||
option(SINGULARITY_STRICT_WARNINGS "Make warnings strict" OFF) | ||
|
||
# toggle code options | ||
option(SINGULARITY_USE_TRUE_LOG_GRIDDING | ||
|
@@ -552,6 +561,10 @@ target_compile_options( | |
> # release | ||
> # cuda | ||
) | ||
if (SINGULARITY_STRICT_WARNINGS) | ||
target_compile_options(singularity-eos_Interface INTERFACE | ||
-Wall -Werror -Wno-unknown-pragmas) | ||
endif() | ||
|
||
if(TARGET singularity-eos_Library) | ||
target_compile_options(singularity-eos_Library PRIVATE ${xlfix}) | ||
|
@@ -590,6 +603,7 @@ endif() | |
|
||
if(SINGULARITY_BUILD_TESTS) | ||
include(CTest) | ||
enable_testing() | ||
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. I don't know how tests ever ran without this. Did cmake get stricter at some point? |
||
add_subdirectory(test) | ||
endif() | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -359,14 +359,14 @@ PORTABLE_INLINE_FUNCTION Real Gruneisen::PressureFromDensityInternalEnergy( | |
template <typename Indexer_t> | ||
PORTABLE_INLINE_FUNCTION Real | ||
Gruneisen::MinInternalEnergyFromDensity(const Real rho_in, Indexer_t &&lambda) const { | ||
const Real rho = std::min(rho_in, _rho_max); | ||
// const Real rho = std::min(rho_in, _rho_max); | ||
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. These are unused var warnings but I want to keep the vars here as a comment, for if/when we fill this in 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. Good call! |
||
MinInternalEnergyIsNotEnabled("Gruneisen"); | ||
return 0.0; | ||
} | ||
template <typename Indexer_t> | ||
PORTABLE_INLINE_FUNCTION Real Gruneisen::EntropyFromDensityInternalEnergy( | ||
const Real rho_in, const Real sie, Indexer_t &&lambda) const { | ||
const Real rho = std::min(rho_in, _rho_max); | ||
// const Real rho = std::min(rho_in, _rho_max); | ||
EntropyIsNotEnabled("Gruneisen"); | ||
return 1.0; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -370,7 +370,7 @@ MGUsup::FillEos(Real &rho, Real &temp, Real &sie, Real &press, Real &cv, Real &b | |
} | ||
if (output & thermalqs::temperature) | ||
temp = TemperatureFromDensityInternalEnergy(rho, sie); | ||
if (output & thermalqs::specific_internal_energy) sie = sie; | ||
// if (output & thermalqs::specific_internal_energy) sie = sie; | ||
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. Silences warning from self-assignment. But I want to leave it in as a comment. |
||
if (output & thermalqs::pressure) press = PressureFromDensityInternalEnergy(rho, sie); | ||
if (output & thermalqs::specific_heat) | ||
cv = SpecificHeatFromDensityInternalEnergy(rho, sie); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,8 @@ class SAP_Polynomial : public EosBase<SAP_Polynomial> { | |
SAP_Polynomial(const Real rho0, const Real a0, const Real a1, const Real a2c, | ||
const Real a2e, const Real a3, const Real b0, const Real b1, | ||
const Real b2c, const Real b2e, const Real b3) | ||
: _rho0(rho0), _a0(a0), _a1(a1), _a2c(a2c), _a2e(a2e), _a3(a3), _b0(b0), _b1(b1), | ||
_b2c(b2c), _b2e(b2e), _b3(b3) { | ||
: _a0(a0), _a1(a1), _a2c(a2c), _a2e(a2e), _a3(a3), _b0(b0), _b1(b1), _b2c(b2c), | ||
_b2e(b2e), _b3(b3), _rho0(rho0) { | ||
Comment on lines
+43
to
+44
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. Silences warning about initializer list ordering. |
||
CheckParams(); | ||
} | ||
|
||
|
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.
No need to run the code, this is just to check for warnings.