diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..42cf53762 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,102 @@ +name: CI + +on: [push] + +env: + MPI_DIR: /usr + DAGMC_ROOT: $HOME/DAGMC + HDF5_ROOT: /usr + OMP_NUM_THREADS: 2 + OPENMC_CROSS_SECTIONS: $HOME/nndc_hdf5/cross_sections.xml + OPENMC_ENDF_DATA: $HOME/endf-b-vii.1 + COVERALLS_PARALLEL: true + NUMPY_EXPERIMENTAL_ARRAY_FUNCTION: 0 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + +jobs: + main: + runs-on: ubuntu-16.04 + strategy: + matrix: + python-version: [3.8] + mpi: [n, y] + omp: [n, y] + dagmc: [n] + event: [n] + vectfit: [n] + + include: + - python-version: 3.6 + omp: n + mpi: n + - python-version: 3.7 + omp: n + mpi: n + - dagmc: y + python-version: 3.8 + mpi: y + omp: y + - event: y + python-version: 3.8 + omp: y + mpi: n + - vectfit: y + python-version: 3.8 + omp: n + mpi: y + + steps: + - + uses: actions/checkout@v2 + + - + name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - + name: Environment Variables + run: | + echo "OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml" >> $GITHUB_ENV + echo "OPENMC_ENDF_DATA=$HOME/endf-b-vii.1" >> $GITHUB_ENV + echo "MPI=${{ matrix.mpi }}" >> $GITHUB_ENV + echo "PHDF5=${{ matrix.mpi }}" >> $GITHUB_ENV + echo "OMP=${{ matrix.omp }}" >> $GITHUB_ENV + echo "DAGMC=${{ matrix.dagmc }}" >> $GITHUB_ENV + echo "EVENT=${{ matrix.event }}" >> $GITHUB_ENV + echo "VECTFIT=${{ matrix.vectfit }}" >> $GITHUB_ENV + + - + name: Apt dependencies + shell: bash + run: | + sudo apt -y update + sudo apt install -y mpich \ + libmpich-dev \ + libhdf5-serial-dev \ + libhdf5-mpich-dev \ + libeigen3-dev + - + name: install + shell: bash + run: | + echo "$HOME/NJOY2016/build" >> $GITHUB_PATH + $GITHUB_WORKSPACE/tools/ci/travis-install.sh + - + name: before + shell: bash + run: $GITHUB_WORKSPACE/tools/ci/travis-before-script.sh + + - + name: test + shell: bash + run: $GITHUB_WORKSPACE/tools/ci/travis-script.sh + + - + name: after_success + shell: bash + run: | + cpp-coveralls -i src -i include --exclude-pattern "/usr/*" --dump cpp_cov.json + coveralls --merge=cpp_cov.json diff --git a/src/summary.cpp b/src/summary.cpp index 1f5f7a097..cb7527208 100644 --- a/src/summary.cpp +++ b/src/summary.cpp @@ -14,6 +14,11 @@ namespace openmc { void write_summary() { + +#ifdef MPI + if (!mpi::master) return; +#endif + // Display output message write_message("Writing summary.h5 file...", 5); diff --git a/tests/regression_tests/cpp_driver/driver.cpp b/tests/regression_tests/cpp_driver/driver.cpp index f6fde30fd..db6137f1d 100644 --- a/tests/regression_tests/cpp_driver/driver.cpp +++ b/tests/regression_tests/cpp_driver/driver.cpp @@ -48,7 +48,11 @@ int main(int argc, char** argv) { // the summary file will be used to check that // temperatures were set correctly so clear // error output can be provided +#ifdef OPENMC_MPI + if (openmc::mpi::master) openmc::write_summary(); +#else openmc::write_summary(); +#endif openmc_run(); openmc_finalize(); diff --git a/tools/ci/travis-install.py b/tools/ci/travis-install.py index a2b1b6175..2f573b1a9 100644 --- a/tools/ci/travis-install.py +++ b/tools/ci/travis-install.py @@ -47,6 +47,7 @@ def install(omp=False, mpi=False, phdf5=False, dagmc=False): if dagmc: cmake_cmd.append('-Ddagmc=ON') + cmake_cmd.append('-DCMAKE_PREFIX_PATH=~/DAGMC') # Build in coverage mode for coverage testing cmake_cmd.append('-Dcoverage=on') diff --git a/tools/ci/travis-install.sh b/tools/ci/travis-install.sh index 7bbe160aa..4e5da241a 100755 --- a/tools/ci/travis-install.sh +++ b/tools/ci/travis-install.sh @@ -1,6 +1,11 @@ #!/bin/bash set -ex +# Upgrade pip, pytest, numpy before doing anything else +pip install --upgrade pip +pip install --upgrade pytest +pip install --upgrade numpy + # Install NJOY 2016 ./tools/ci/travis-install-njoy.sh @@ -14,11 +19,6 @@ if [[ $VECTFIT = 'y' ]]; then ./tools/ci/travis-install-vectfit.sh fi -# Upgrade pip, pytest, numpy before doing anything else -pip install --upgrade pip -pip install --upgrade pytest -pip install --upgrade numpy - # Install mpi4py for MPI configurations if [[ $MPI == 'y' ]]; then pip install --no-binary=mpi4py mpi4py