-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into retry_retry
- Loading branch information
Showing
342 changed files
with
20,280 additions
and
38,827 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,39 @@ | ||
Checks: > | ||
-*, | ||
bugprone-*, | ||
-bugprone-easily-swappable-parameters, | ||
clang-analyzer-*, | ||
clang-diagnostic-*, | ||
cppcoreguidelines-*, | ||
-cppcoreguidelines-avoid-c-arrays, | ||
-cppcoreguidelines-avoid-goto, | ||
-cppcoreguidelines-avoid-magic-numbers, | ||
-cppcoreguidelines-avoid-non-const-global-variables, | ||
-cppcoreguidelines-init-variables, | ||
-cppcoreguidelines-interfaces-global-init, | ||
-cppcoreguidelines-macro-usage, | ||
-cppcoreguidelines-no-malloc, | ||
-cppcoreguidelines-non-private-member-variables-in-classes, | ||
-cppcoreguidelines-owning-memory, | ||
-cppcoreguidelines-pro-*, | ||
modernize-*, | ||
-modernize-avoid-c-arrays, | ||
-modernize-use-trailing-return-type, | ||
-modernize-use-using, | ||
performance-*, | ||
readability-*, | ||
-readability-avoid-const-params-in-decls, | ||
-readability-braces-around-statements, | ||
-readability-else-after-return, | ||
-readability-function-cognitive-complexity, | ||
-readability-function-size, | ||
-readability-identifier-length, | ||
-readability-implicit-bool-conversion, | ||
-readability-isolate-declaration, | ||
-readability-magic-numbers, | ||
-readability-named-parameter, | ||
-readability-simplify-boolean-expr, | ||
mpi-*, | ||
openmp-* | ||
HeaderFilterRegex: '(/conductivity/|/constants/|/EOS/|/integration/|/interfaces/|/networks/|/neutrinos/|/nse_solver/|/opacity/|/rates/|/screening/|/util/|^\./|^./tmp_build_dir/microphysics_sources/*/).*\.H$' |
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,15 @@ | ||
blocs | ||
bloc | ||
inout | ||
pres | ||
bion | ||
tye | ||
delt | ||
thi | ||
daa | ||
numer | ||
clen | ||
coul | ||
dum | ||
crate | ||
vie |
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,5 @@ | ||
[codespell] | ||
skip = .git,*.ipynb,*.bib,*.ps,*~ | ||
ignore-words = .codespell-ignore-words | ||
|
||
|
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,63 @@ | ||
name: burn_cell_primordial_chem | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
burn_cell_primordial_chem: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get AMReX | ||
run: | | ||
mkdir external | ||
cd external | ||
git clone https://github.com/AMReX-Codes/amrex.git | ||
cd amrex | ||
git checkout development | ||
echo 'AMREX_HOME=$(GITHUB_WORKSPACE)/external/amrex' >> $GITHUB_ENV | ||
echo $AMREX_HOME | ||
if [[ -n "${AMREX_HOME}" ]]; then exit 1; fi | ||
cd ../.. | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -y -qq | ||
sudo apt-get -qq -y install curl cmake jq clang g++>=9.3.0 | ||
- name: Compile and run | ||
run: | | ||
cd unit_test/burn_cell_primordial_chem | ||
make -j 2 | ||
./main1d.gnu.DEBUG.ex inputs_primordial_chem > test.out | ||
- name: Compare to stored output | ||
run: | | ||
set -e | ||
cd unit_test/burn_cell_primordial_chem | ||
line_numbers=(456 458 460 463 465 471 476) | ||
threshold=0.01 | ||
error_found=false | ||
for line_number in "${line_numbers[@]}"; do | ||
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out) | ||
value2=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution.out) | ||
difference=$(awk -v val1="$value1" -v val2="$value2" 'BEGIN { printf "%.2f", (val1 - val2) / val2 }') | ||
if (( $(echo "$difference > $threshold" | bc -l) )); then | ||
echo "Line number: $line_number" | ||
echo "Value in test.out: $value1" | ||
echo "Value in reference_solution.out: $value2" | ||
echo "Difference between test and reference value is more than allowed threshold of $threshold" | ||
echo | ||
error_found=true | ||
fi | ||
done | ||
if [[ $error_found == true ]]; then | ||
exit 1 | ||
fi | ||
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,49 @@ | ||
name: cpp-linter | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
cpp-linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get AMReX | ||
run: | | ||
mkdir external | ||
cd external | ||
git clone https://github.com/AMReX-Codes/amrex.git | ||
cd amrex | ||
git checkout development | ||
echo 'AMREX_HOME=$(GITHUB_WORKSPACE)/external/amrex' >> $GITHUB_ENV | ||
echo $AMREX_HOME | ||
if [[ -n "${AMREX_HOME}" ]]; then exit 1; fi | ||
cd ../.. | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -y -qq | ||
sudo apt-get -qq -y install curl clang-tidy cmake jq clang cppcheck clang-format bear g++>=9.3.0 | ||
- name: Run cpp linter | ||
uses: AMReX-Astro/cpp-linter-action@main | ||
with: | ||
build_path: 'unit_test/test_react' | ||
make_options: '-j 2 USE_OMP=FALSE USE_MPI=FALSE USE_CUDA=FALSE DEBUG=TRUE' | ||
ignore_files: 'amrex' | ||
header_filter: '(/conductivity/|/constants/|/EOS/|/integration/|/interfaces/|/networks/|/neutrinos/|/nse_solver/|/opacity/|/rates/|/screening/|/util/|^\./).*\.H$' | ||
config_file: ${GITHUB_WORKSPACE}/.clang-tidy | ||
|
||
- name: Archive clang tidy report | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: clang-tidy-report | ||
path: clang-tidy-report.txt | ||
|
||
- name: Archive cppcheck report | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: cppcheck-report | ||
path: cppcheck-report.txt |
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 @@ | ||
name: check ifdefs | ||
|
||
on: | ||
push: | ||
branches: | ||
- development | ||
- main | ||
pull_request: | ||
branches: | ||
- development | ||
|
||
jobs: | ||
check-ifdefs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
# this path is specific to Ubuntu | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Run check-ifdefs | ||
run: | | ||
python .github/workflows/check_ifdefs.py .github/workflows/good_defines.txt |
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,113 @@ | ||
#!/bin/env python | ||
|
||
import re | ||
import sys | ||
|
||
from pathlib import Path | ||
|
||
|
||
def find_source_files(): | ||
p = Path("./") | ||
files = list(p.glob(r"**/*.cpp")) | ||
files += list(p.glob(r"**/*.H")) | ||
return files | ||
|
||
def check_file(filename): | ||
|
||
# this is a general check to see if we should further examine a line | ||
if_general_re = re.compile(r"^(?:#if|#elif)", re.IGNORECASE|re.DOTALL) | ||
|
||
# this checks something of the form "#ifdef NAME" | ||
ifdef_re = re.compile(r"^#if[n]*def\s+([a-z_0-9]+)", re.IGNORECASE|re.DOTALL) | ||
|
||
# this checks something of the form | ||
# #if (NAME == X) | ||
if_re = re.compile(r"^(?:#if|#elif)\s+[\(]?([a-z_0-9]+)", re.IGNORECASE|re.DOTALL) | ||
|
||
# together these check something of the form | ||
# #if defined(NAME1) || !defined(NAME2) | ||
if_defined_re1 = re.compile(r"^(?:#if|#elif)\s+[!]?(?:defined)", re.IGNORECASE|re.DOTALL) | ||
if_defined_re2 = re.compile(r"[!]?(?:defined)\s*[\(]?([a-z_0-9]+)[\)]?", re.IGNORECASE|re.DOTALL) | ||
|
||
ierr = 0 | ||
defines = [] | ||
|
||
with open(filename) as cf: | ||
for line in cf: | ||
if if_general_re.search(line): | ||
|
||
# check each of the patterns | ||
if if_defined_re1.search(line): | ||
g = if_defined_re2.findall(line) | ||
defines += g | ||
continue | ||
|
||
if g := ifdef_re.search(line): | ||
defines.append(g.group(1)) | ||
continue | ||
|
||
if g := if_re.search(line): | ||
defines.append(g.group(1)) | ||
continue | ||
|
||
|
||
# if we made it here, then we didn't handle things | ||
ierr = 1 | ||
print(f"unhandled, file: {filename} | {line}") | ||
|
||
return ierr, set(defines) | ||
|
||
if __name__ == "__main__": | ||
|
||
try: | ||
good_defines_file = sys.argv[1] | ||
except IndexError: | ||
good_defines_file = None | ||
|
||
# read in the list of good defines | ||
|
||
good_defines = [] | ||
if good_defines_file: | ||
with open(good_defines_file) as gd: | ||
for line in gd: | ||
good_defines.append(line.strip()) | ||
|
||
all_defines = [] | ||
total_errors = 0 | ||
for f in find_source_files(): | ||
if "tmp_build_dir" in f.parts: | ||
# skip generated files | ||
continue | ||
ierr, defines = check_file(f) | ||
all_defines += defines | ||
total_errors += ierr | ||
|
||
# remove any header guards | ||
|
||
defines = [] | ||
for d in all_defines: | ||
if d.endswith("_H") or d.endswith("_H_"): | ||
continue | ||
if len(d) == 1 and d.isdigit(): | ||
continue | ||
defines.append(d) | ||
|
||
defines = sorted(set(defines)) | ||
|
||
print("found defines:") | ||
for d in defines: | ||
print(d) | ||
|
||
# now check to make sure that all the defines we found are okay | ||
|
||
invalid = [] | ||
for d in defines: | ||
if d not in good_defines: | ||
invalid.append(d) | ||
|
||
if invalid or total_errors > 0: | ||
if invalid: | ||
print("\ninvalid defines:") | ||
for bad in invalid: | ||
print(bad) | ||
sys.exit(1) |
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,22 @@ | ||
name: cmake_burn_cell_primordial_chem | ||
|
||
on: [pull_request] | ||
jobs: | ||
burn_cell: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -y -qq | ||
sudo apt-get -qq -y install curl cmake jq clang g++>=9.3.0 libopenmpi-dev | ||
- name: Compile and run | ||
run: | | ||
mkdir build && cd build | ||
cmake .. -DBUILD_UNIT_TEST=true -DBUILD_AMREX=true | ||
make -j2 | ||
ctest --output-on-failure |
Oops, something went wrong.