-
Notifications
You must be signed in to change notification settings - Fork 14
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
Trees issues fixes #15
Closed
Closed
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
0ee81fe
Remove unused variables in gas_cooling
rtobar 72eb976
Receive exceptions by reference, not by value
rtobar d429e1e
Add documentation for black_hole_histories.hdf5 outputs
rtobar 8c773fa
Prefer histogram's "density" argument over "normed"
rtobar 4199fb3
Deal with OpenMP_CXX_FLAGS correctly
rtobar 4bf3cd5
Improve OpenMP checks
rtobar ab93cda
Finish porting all tests to GitHub Actions
rtobar c887fff
Run build/tests on PRs too
rtobar 4732bd6
Add black hole histories output documentation to TOC
rtobar e1d904a
Specify build.os to keep RTD happy
rtobar 6176d6f
Add GitHub action to ensure docs are correctly built
rtobar fbe4fa7
Add build.tools section, needed by RTD
rtobar efa8b0a
Bump dependency on Boost to >= 1.68
rtobar e75f8ff
Fix documentation building in GHA
rtobar 0f5a785
Include cstdint to ensure std::int64_t is visibile
rtobar 0cf9462
Add spin_mass_dependence option to dark_matter_halo group
rtobar 602e808
Actually read new dark_matter_halo.spin_mass_dependence
rtobar c0a4f42
Tidal stripping: lost mass considered and galaxy stellar mass at infa…
angel-chandro 7ea18ad
Tidal stripping: lost mass considered and galaxy stellar mass at infa…
angel-chandro 896dc0f
Fix mass swapping: use host halo properties for central subhalos and …
angel-chandro 6282ba2
Mass swapping: use host halo properties for central subhalos and curr…
angel-chandro 34507a6
Mass swapping: fix bugs in implementation
angel-chandro 2cdcedb
Mass swapping: fix bugs in implementation (part 2)
angel-chandro bb2b39e
Made transients_prefix optional for easier use
rtobar 22d1216
Modifications to mass swapping cases
cdplagos c666ece
Implementing the mass swap fix as an option
cdplagos 3011fba
Fixed several small bugs
cdplagos 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 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,18 @@ | ||
# Generate the HDF5 output documentation and check it's up to date | ||
# otherwise tell the user how to update it | ||
hdf5_file="$1" | ||
rst_file="$2" | ||
hdf5_file_basename=`basename "${hdf5_file}"` | ||
full_rst_file="doc/hdf5_properties/${rst_file}" | ||
|
||
scripts/properties_as_list.sh "${TEST_OUTPUTS_DIR}/${TEST_SIM_NAME}/${hdf5_file}" > props.rst | ||
_diff="`diff -Naur "${full_rst_file}" props.rst`" | ||
if [ -n "${_diff}" ]; then | ||
echo "\nThe file ${full_rst_file} is out of date. This probably means that you added a new\n" \ | ||
"dataset to shark's output, but forgot to update the corresponding documentation.\n" \ | ||
"The full difference follows:\n\n${_diff}\n\n" \ | ||
"Please run the script/properties_as_lish.sh script against a ${hdf5_file_basename} file\n" \ | ||
"to re-generate its documentation, then commit your changes. For example:\n\n" \ | ||
"scripts/properties_as_list.sh my-output/model/199/0/${hdf5_file_basename} > ${full_rst_file}" >&2 | ||
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,9 @@ | ||
reference_model_name=$1 | ||
shift | ||
this_model_name=$1 | ||
shift | ||
|
||
python scripts/compare_galaxies.py -m \ | ||
"${TEST_OUTPUTS_DIR}/${TEST_SIM_NAME}/${reference_model_name}/199/0/galaxies.hdf5" \ | ||
"${TEST_OUTPUTS_DIR}/${TEST_SIM_NAME}/${this_model_name}/199/0/galaxies.hdf5" \ | ||
$@ |
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,10 @@ | ||
model_name=$1 | ||
shift | ||
|
||
${CI_BUILD_DIR}/shark ${TEST_CONFIG_FILE} \ | ||
-o execution.output_bh_histories=true -o execution.snapshots_bh_histories=199 \ | ||
-o simulation.redshift_file=${TEST_INPUTS_DIR}/redshifts.txt \ | ||
-o simulation.tree_files_prefix=${TEST_INPUTS_DIR}/tree_199 \ | ||
-o simulation.sim_name=${TEST_SIM_NAME} \ | ||
-o execution.name_model=$model_name \ | ||
$@ |
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 @@ | ||
name: Get shark up and running from previous build | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Download shark build tarball | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: shark-build | ||
|
||
- name: Untar shark build after download | ||
run: tar xf shark-build.tar.gz | ||
shell: bash | ||
|
||
- name: Install system runtime dependencies | ||
run: sudo apt install libhdf5-103 libboost-filesystem1.74.0 libboost-program-options1.74.0 libboost-log1.74.0 libgsl27 | ||
shell: bash | ||
|
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,12 @@ | ||
name: Setup the shark configuration file used for tests | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: | | ||
sed " | ||
s|output_directory.*|output_directory = ${TEST_OUTPUTS_DIR}| | ||
s|redshift_file.*|redshift_file = ${TEST_INPUTS_DIR}/redshifts.txt| | ||
s|tree_files_prefix.*|tree_files_prefix = ${TEST_INPUTS_DIR}/tree_199| | ||
s|sim_name.*|sim_name = ${TEST_SIM_NAME}| | ||
" sample.cfg > ${{ env.TEST_CONFIG_FILE }} | ||
shell: bash |
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 |
---|---|---|
@@ -1,40 +1,196 @@ | ||
name: Build and test | ||
on: [push, pull_request] | ||
|
||
# Build on every branch push, tag push, and pull request change: | ||
on: [push] | ||
env: | ||
CI_BUILD_DIR: build | ||
TEST_INPUTS_DIR: inputs | ||
TEST_OUTPUTS_DIR: outputs | ||
TEST_CONFIG_FILE: ci-tests.cfg | ||
TEST_SIM_NAME: mini-SURFS | ||
TEST_FIXED_SEED: 123456 | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build and test shark on ${{ matrix.os }} | ||
build_and_test: | ||
name: Build and test shark. OS=${{ matrix.os }}, omp=${{ matrix.omp }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
#os: [ubuntu-latest, macos-latest] | ||
os: [ubuntu-latest] | ||
omp: [true, false] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Install dependencies | ||
- name: Install system dependencies (Linux) | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: | | ||
sudo apt install libhdf5-dev hdf5-tools libboost-filesystem-dev libboost-program-options-dev libboost-log-dev cxxtest libgsl-dev | ||
sudo apt install ninja-build libhdf5-dev hdf5-tools libboost-filesystem-dev libboost-program-options-dev libboost-log-dev cxxtest libgsl-dev | ||
|
||
- name: Install dependencies | ||
- name: Install system dependencies (MacOS) | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
run: | | ||
brew install hdf5 boost cxxtest gsl | ||
brew install ninja hdf5 boost cxxtest gsl ${{ matrix.omp && 'libomp' || '' }} | ||
|
||
- name: Point CMake to libomp (MacOS) | ||
if: ${{ matrix.os == 'macos-latest' && matrix.omp }} | ||
run: | | ||
# libomp is installed as keg-only, so we need to manually point to it | ||
HOMEBREW_LIBOMP_PREFIX=`brew --prefix libomp` | ||
OMP_FLAGS="-Xpreprocessor -fopenmp -I${HOMEBREW_LIBOMP_PREFIX}/include" | ||
echo "EXTRA_CMAKE_ARGS=-DOpenMP_C_FLAGS=\"$OMP_FLAGS\" -DOpenMP_C_LIB_NAMES=omp -DOpenMP_CXX_FLAGS=\"$OMP_FLAGS\" -DOpenMP_CXX_LIB_NAMES=omp -DOpenMP_omp_LIBRARY=$HOMEBREW_LIBOMP_PREFIX/lib/libomp.dylib" >> "$GITHUB_ENV" | ||
|
||
- name: Configure | ||
# Leaving Werror out for now because there *are* errors | ||
# and I don't know what the proper fix is. | ||
run: cmake -B build/ -DSHARK_TEST=ON -DCMAKE_CXX_FLAGS="-Wall" #-Werror | ||
run: | | ||
eval cmake -B ${CI_BUILD_DIR} -G Ninja \ | ||
-DSHARK_TEST=ON -DSHARK_NO_OPENMP=${{ matrix.omp && 'OFF' || 'ON' }} -DCMAKE_CXX_FLAGS="-Wall -Werror" \ | ||
$EXTRA_CMAKE_ARGS | ||
|
||
- name: Build | ||
run: cmake --build build/ | ||
run: cmake --build ${CI_BUILD_DIR} | ||
|
||
- name: Run unit tests | ||
run: | | ||
cd build | ||
cd ${CI_BUILD_DIR} | ||
ctest --output-on-failure | ||
|
||
- name: Tar shark build before upload | ||
run: tar cf shark-build.tar.gz ${{ env.CI_BUILD_DIR }} | ||
|
||
- name: Upload shark build for next jobs (Linux) | ||
if: ${{ matrix.os == 'ubuntu-latest' && matrix.omp }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: shark-build | ||
path: shark-build.tar.gz | ||
|
||
initial_shark_run: | ||
name: Initial shark run (with fixed seed) | ||
needs: build_and_test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: ./.github/actions/download-shark-build | ||
|
||
- name: Download test datasets | ||
run: | | ||
mkdir -p ${TEST_INPUTS_DIR} | ||
curl -L -o ${TEST_INPUTS_DIR}/redshifts.txt 'https://docs.google.com/uc?export=download&id=1xvNmJB_KmoBHuQz-QzdPnY0HFs7smkUB' | ||
curl -L -o ${TEST_INPUTS_DIR}/tree_199.0.hdf5 'https://docs.google.com/uc?export=download&id=1JDK8ak13bEhzg9H9xt0uE8Fh_2LD3KpZ' | ||
|
||
- uses: ./.github/actions/setup-config-file | ||
|
||
- name: Run shark with fixed seed | ||
run: .ci/run_shark.sh my_model -o execution.seed=${TEST_FIXED_SEED} | ||
|
||
- name: Upload shark output for next jobs | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: shark-output | ||
path: ${{ env.TEST_OUTPUTS_DIR }} | ||
|
||
- name: Upload shark inputs for next jobs | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: shark-input | ||
path: ${{ env.TEST_INPUTS_DIR }} | ||
|
||
check_hdf5_docs: | ||
name: Check HDF5 properties documentation is up to date | ||
needs: initial_shark_run | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install HDF5 tools | ||
run: sudo apt install hdf5-tools | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: shark-output | ||
path: ${{ env.TEST_OUTPUTS_DIR }} | ||
|
||
- name: Check output properties' documentation | ||
run: | | ||
.ci/check_hdf5_docs.sh my_model/199/0/galaxies.hdf5 galaxies.rst | ||
.ci/check_hdf5_docs.sh my_model/156/0/star_formation_histories.hdf5 star_formation_histories.rst | ||
.ci/check_hdf5_docs.sh my_model/199/0/black_hole_histories.hdf5 black_hole_histories.rst | ||
|
||
generate_plots: | ||
name: Generate all standard plots | ||
needs: initial_shark_run | ||
runs-on: ubuntu-latest | ||
# Currently skipped because there are a few minor problems | ||
# with some plots | ||
if: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: shark-output | ||
path: ${{ env.TEST_OUTPUTS_DIR }} | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install Python dependencies | ||
run: pip install matplotlib h5py scipy | ||
|
||
- uses: ./.github/actions/setup-config-file | ||
|
||
- name: Generate all plots | ||
run: | | ||
echo "backend: Agg" >> matplotlibrc | ||
python standard_plots/all.py -c ${{ env.TEST_CONFIG_FILE }} | ||
|
||
check_reproducibility: | ||
name: Check shark runs are reproducible | ||
needs: initial_shark_run | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: ./.github/actions/download-shark-build | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: shark-output | ||
path: ${{ env.TEST_OUTPUTS_DIR }} | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: shark-input | ||
path: ${{ env.TEST_INPUTS_DIR }} | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install Python dependencies | ||
run: pip install h5py | ||
|
||
- uses: ./.github/actions/setup-config-file | ||
|
||
- name: Check fixed seed is reproducible | ||
run: | | ||
.ci/run_shark.sh my_model_same_seed -o execution.seed=${TEST_FIXED_SEED} | ||
.ci/compare_galaxies.sh my_model my_model_same_seed | ||
|
||
- name: Check fixed seed is reproducible when multithreaded | ||
run: | | ||
# "-t 0" lets shark use the maximum number of OpenMP threads, | ||
# which OpenMP implementations usually constrain to the available hardware | ||
.ci/run_shark.sh my_model_same_seed_parallel -o execution.seed=123456 -t 0 | ||
.ci/compare_galaxies.sh my_model my_model_same_seed_parallel | ||
|
||
- name: Check random seed gives different results | ||
run: | | ||
.ci/run_shark.sh my_model_random_seed -t 0 | ||
.ci/compare_galaxies.sh my_model my_model_random_seed --expect-unequal |
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 @@ | ||
name: Build documentation | ||
on: [push, pull_request] | ||
env: | ||
SPHINXOPTS: -W --keep going | ||
|
||
jobs: | ||
build-docs: | ||
name: Build documentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ammaraskar/sphinx-action@master | ||
with: | ||
docs-folder: "doc" | ||
pre-build-command: 'pip install -U sphinx_rtd_theme docutils' |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
version: 2 | ||
build: | ||
os: "ubuntu-22.04" | ||
tools: | ||
python: "3.10" | ||
|
||
submodules: | ||
include: all | ||
|
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
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
Oops, something went wrong.
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.
suggestion: Consider adding
-y
flag toapt install
Adding the
-y
flag toapt install
can help automate the installation process by automatically agreeing to the installation of packages.