Skip to content

Update macroatom.cc #7216

Update macroatom.cc

Update macroatom.cc #7216

Workflow file for this run

---
name: CI
on:
push:
branches-ignore:
- classic*
schedule:
- cron: 0 13 * * 1
workflow_dispatch:
# pull_request:
# branches-ignore:
# - classic*
env:
ASAN_OPTIONS: detect_stack_use_after_return=1:detect_leaks=0
jobs:
testmodels:
strategy:
matrix:
os: [ubuntu-24.04]
testmode: [OFF, ON]
testname:
[
classicmode_1d_3dgrid,
classicmode_3d,
kilonova_1d_1dgrid,
kilonova_1d_3dgrid,
kilonova_2d_2dgrid,
kilonova_2d_2dgrid_barnesthermalisation,
kilonova_2d_2dgrid_expansionopac,
kilonova_2d_2dgrid_xcomgammaphotoion,
kilonova_2d_3dgrid,
nebular_1d_3dgrid,
nebular_1d_3dgrid_limitbfest,
]
exclude:
- os: self-hosted
testmode: ON
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 120
name: ${{ matrix.testname }}${{ matrix.testmode == 'ON' && ' testmode ON' || ''}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install gcc-14
if: always()
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: 14
- name: install gsl and openmpi
run: |
sudo apt-get update
sudo apt install -y libgsl-dev
sudo apt install -y openmpi-bin libopenmpi-dev
- name: CPU type and core count
id: cpu-count
run: |
g++ -march=native -Q --help=target | grep -- '-march= ' | cut -f3
#python3 -m pip install psutil
#python3 -c 'import psutil; print(f"CPU count (physical only): {int(psutil.cpu_count(logical=False))}")'
python3 -c 'import multiprocessing; print(f"CPU count: {multiprocessing.cpu_count()}")'
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT
# cache this for classic options because the super low integration tolerance makes generation of the file very slow
- name: Cache ratecoeff.dat
if: ${{ startsWith(matrix.testname, 'classicmode') }}
uses: actions/cache@v4
with:
path: tests/${{ matrix.testname }}_testrun/ratecoeff.dat
key: tests/${{ matrix.testname }}_testrun/ratecoeff.dat-${{ github.run_id }}
restore-keys: |
tests/${{ matrix.testname }}_testrun/ratecoeff.dat-
- name: Cache test atomic data
if: ${{ !startsWith(matrix.testname, 'classicmode') }}
uses: actions/cache@v4
id: cache-testatomicdata
with:
path: tests/atomicdata_feconi.tar.xz
key: tests/atomicdata_feconi.tar.xz
- name: Cache test atomic data classic
if: ${{ startsWith(matrix.testname, 'classicmode') }}
uses: actions/cache@v4
id: cache-testatomicdata-classic
with:
path: tests/atomicdata_classic.tar.xz
key: tests/atomicdata_classic.tar.xz
- name: Download/extract test data
working-directory: tests/
run: |
source ./setup_${{ matrix.testname }}.sh
- name: cat artisoptions.h
run: |
cp tests/${{ matrix.testname }}_testrun/artisoptions.h .
cat artisoptions.h
- name: Compile
run: |
make REPRODUCIBLE=ON TESTMODE=${{ matrix.testmode }} MPI=ON MAX_NODE_SIZE=2 FASTMATH=OFF -j${{ steps.cpu-count.outputs.count }} sn3d exspec
cp sn3d tests/${{ matrix.testname }}_testrun/
cp exspec tests/${{ matrix.testname }}_testrun/
- name: Run test job0 start
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
cp input-newrun.txt input.txt
touch output_0-0.txt
time mpirun -np 4 --oversubscribe --mca mpi_yield_when_idle 1 ./sn3d
- name: Move job0 files
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
mkdir job0
../../scripts/movefiles.sh job0
- name: cat job0 estimators
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: cat job0/estimators*.out
- name: cat job0 output log
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: cat job0/output_0-0.txt
- name: Checksum job0 output files
#if: always()
if: always() && matrix.testmode == 'OFF'
working-directory: tests/${{ matrix.testname }}_testrun
run: |
md5sum *.out job0/*.out | tee ../${{ matrix.testname }}_inputfiles/results_md5_job0.txt
if [ -f results_md5_job0.txt ]; then md5sum -c results_md5_job0.txt; else echo "results_md5_job0.txt not found"; fi
- name: Run test job1 resume
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
cp input-resume.txt input.txt
time mpirun -np 4 --oversubscribe --mca mpi_yield_when_idle 1 ./sn3d
- name: Move job1 files
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
rm *.tmp
mkdir job1
../../scripts/movefiles.sh job1
- name: cat job1 estimators
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: cat job1/estimators*.out
- name: cat job1 output log
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: cat job1/output_0-0.txt
- name: Set up Python
if: always() && matrix.testmode == 'OFF'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install artistools
if: always() && matrix.testmode == 'OFF'
run: |
python3 -m pip install --upgrade pip uv
uv pip install --system -U artistools
- name: show deposition.out
if: always() && matrix.testmode == 'OFF'
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
echo -e "import artistools as at; import polars as pl;\nwith pl.Config(tbl_rows=-1,tbl_cols=-1,tbl_width_chars=300,tbl_formatting='NOTHING'):\n df = at.get_deposition('.')\n print(df.select(['timestep', 'tmid_days'] + [c for c in sorted(df.columns, key=lambda x: x.lower().lstrip('eps_')) if c not in ['timestep', 'tmid_days', 'tmid_s']]))" | python3 -
cat deposition.out
- name: Run exspec
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
time mpirun -np 1 ./exspec
python3 ../../scripts/mergeangleres.py
rm -f light_curve_res_*.out spec_res_*.out specpol_res_*.out
- name: cat exspec log
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
mkdir output
cat exspec.txt
- name: Checksum job1 output files
#if: always()
if: always() && matrix.testmode == 'OFF'
working-directory: tests/${{ matrix.testname }}_testrun
run: |
md5sum *.out job1/*.out | tee ../${{ matrix.testname }}_inputfiles/results_md5_final.txt
if [ -f results_md5_final.txt ]; then md5sum -c results_md5_final.txt; else echo "results_md5_final.txt not found"; fi
- name: Prepare for next steps
if: always()
working-directory: tests/${{ matrix.testname }}_testrun
run: |
touch requirements.txt
find . -name "*_res_*.out" -exec zstd -v -T0 --rm -f {} \;
- name: Upload output files
uses: actions/upload-artifact@v4
if: always() && matrix.testmode == 'OFF'
with:
name: test-${{ matrix.testname }}-output
path: tests/${{ matrix.testname }}_testrun
- name: Upload checksum files
uses: actions/upload-artifact@v4
if: always() && matrix.testmode == 'OFF'
with:
name: ${{ matrix.testname }}_inputfiles
path: tests/${{ matrix.testname }}_inputfiles/results_md5*
- name: Plot light curve
if: always() && matrix.testmode == 'OFF'
working-directory: tests/
run: |
at plotlightcurves ${{ matrix.testname }}_testrun
at plotlightcurves --frompackets ${{ matrix.testname }}_testrun
- name: Plot spectrum nebular
if: always() && matrix.testmode == 'OFF' && startsWith(matrix.testname, 'nebular')
working-directory: tests/
run: |
at plotspectra --frompackets -ts 8 ${{ matrix.testname }}_testrun
- name: Plot spectrum classicmode
if: always() && matrix.testmode == 'OFF' && startsWith(matrix.testname, 'classicmode_')
working-directory: tests/
run: |
at plotspectra --frompackets -t 4-6 ${{ matrix.testname }}_testrun
- name: Plot virtual packet spectrum classicmode_1d
if: always() && matrix.testmode == 'OFF' && startsWith(matrix.testname, 'classicmode_1d')
working-directory: tests/
run: |
at plotspectra -t 4-6 -plotvspecpol 0 1 2 3 12 13 14 --frompackets ${{ matrix.testname }}_testrun
- name: Plot spectrum kilonova
if: always() && matrix.testmode == 'OFF' && startsWith(matrix.testname, 'kilonova')
working-directory: tests/
run: |
at plotspectra --frompackets -t 2 ${{ matrix.testname }}_testrun
- name: Upload plot files
if: always() && matrix.testmode == 'OFF'
uses: actions/upload-artifact@v4
with:
name: test-${{ matrix.testname }}-output-pdf
path: tests/*.pdf
combine_checksums:
needs: testmodels
if: always()
runs-on: ubuntu-24.04
steps:
- name: Download test output
uses: actions/download-artifact@v4
- name: List all files
if: always()
run: find .
- name: Upload bundled checksum files
uses: actions/upload-artifact@v4
with:
name: checksums
path: '*_inputfiles/results_md5*.txt'