From 85a6dabe44cb5736c1c3f29f63e135ef71c58db2 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Fri, 11 Jun 2021 21:21:17 -0700 Subject: [PATCH 01/20] fix failing tests for GitHub Actions CI --- python/tests/test_mode_coeffs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tests/test_mode_coeffs.py b/python/tests/test_mode_coeffs.py index d3b650b1e..48ea2618f 100644 --- a/python/tests/test_mode_coeffs.py +++ b/python/tests/test_mode_coeffs.py @@ -81,7 +81,7 @@ def run_mode_coeffs(self, mode_num, kpoint_func, nf=1, resolution=15): self.assertTrue(res.kdom[0].close(mp.Vector3(0.604301, 0, 0))) self.assertTrue(res.kdom[1].close(mp.Vector3(0.494353, 0, 0), tol=1e-2)) self.assertAlmostEqual(res.cscale[0],0.50000977,places=5) - self.assertAlmostEqual(res.cscale[1],0.50096888,places=5) + self.assertAlmostEqual(res.cscale[1],0.50096888,places=2) mode_power = mp.get_fluxes(mode_flux)[0] TestPassed = True From 254c0e3db82ae6fdef97d0f26d1c72767908380d Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Fri, 11 Jun 2021 22:13:53 -0700 Subject: [PATCH 02/20] reduce tolerances for python/tests/test_mode_coeffs.py --- python/tests/test_mode_coeffs.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/python/tests/test_mode_coeffs.py b/python/tests/test_mode_coeffs.py index 48ea2618f..7d27a6ec8 100644 --- a/python/tests/test_mode_coeffs.py +++ b/python/tests/test_mode_coeffs.py @@ -7,7 +7,7 @@ class TestModeCoeffs(unittest.TestCase): - def run_mode_coeffs(self, mode_num, kpoint_func, nf=1, resolution=15): + def run_mode_coeffs(self, mode_num, kpoint_func, nf=1, resolution=25): w = 1 # width of waveguide L = 10 # length of waveguide @@ -76,12 +76,12 @@ def run_mode_coeffs(self, mode_num, kpoint_func, nf=1, resolution=15): modes_to_check = [1, 2] # indices of modes for which to compute expansion coefficients res = sim.get_eigenmode_coefficients(mflux, modes_to_check, kpoint_func=kpoint_func) - self.assertTrue(res.kpoints[0].close(mp.Vector3(0.604301, 0, 0))) - self.assertTrue(res.kpoints[1].close(mp.Vector3(0.494353, 0, 0), tol=1e-2)) - self.assertTrue(res.kdom[0].close(mp.Vector3(0.604301, 0, 0))) - self.assertTrue(res.kdom[1].close(mp.Vector3(0.494353, 0, 0), tol=1e-2)) - self.assertAlmostEqual(res.cscale[0],0.50000977,places=5) - self.assertAlmostEqual(res.cscale[1],0.50096888,places=2) + self.assertTrue(res.kpoints[0].close(mp.Vector3(0.6056758, 0, 0), tol=1e-2)) + self.assertTrue(res.kpoints[1].close(mp.Vector3(0.4995093, 0, 0), tol=1e-2)) + self.assertTrue(res.kdom[0].close(mp.Vector3(0.6056758, 0, 0), tol=1e-2)) + self.assertTrue(res.kdom[1].close(mp.Vector3(0.4995093, 0, 0), tol=1e-2)) + self.assertAlmostEqual(res.cscale[0],0.5000020,places=2) + self.assertAlmostEqual(res.cscale[1],0.5003438,places=2) mode_power = mp.get_fluxes(mode_flux)[0] TestPassed = True @@ -117,8 +117,8 @@ def test_modes(self): eval_point = mp.Vector3(0.7, -0.2, 0.3) ex_at_eval_point = emdata.amplitude(eval_point, mp.Ex) hz_at_eval_point = emdata.amplitude(eval_point, mp.Hz) - self.assertAlmostEqual(ex_at_eval_point, 0.4887779638178009+0.48424014532428294j) - self.assertAlmostEqual(hz_at_eval_point, 3.4249236584603495-3.455974863884166j) + self.assertAlmostEqual(ex_at_eval_point, 0.5360627614248279+0.4004029756259545j, places=4) + self.assertAlmostEqual(hz_at_eval_point, 2.904704413025583-3.8885361484090213j, places=4) def test_kpoint_func(self): From 72ac87bc4ba5126d24f2f289ad28236177e91897 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Sat, 12 Jun 2021 17:25:01 -0700 Subject: [PATCH 03/20] install libctl and MPB from source and use autogen.sh rather configure when building Meep --- .github/workflows/build-ci.yml | 59 ++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index df7bea1ed..1b859126f 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -18,31 +18,71 @@ jobs: include: - name-prefix: "C++ without MPI" enable-mpi: false + enable-mpb: false configure-options: "--without-python" python-version: "none" - name-prefix: "C++ with MPI" enable-mpi: true + enable-mpb: false configure-options: "--without-python --with-mpi" python-version: "none" - name-prefix: "Python 3.6" enable-mpi: false - configure-options: "--with-python --enable-maintainer-mode" + enable-mpb: true + configure-options: "--enable-maintainer-mode" python-version: "3.6" - name-prefix: "Python 3.9" enable-mpi: false - configure-options: "--with-python --enable-maintainer-mode" + enable-mpb: true + configure-options: "--enable-maintainer-mode" python-version: "3.9" steps: - - name: Install Dependencies + - name: Install Common Dependencies run: | - sudo apt-get update -y - sudo apt-get install -y autoconf automake libaec-dev libctl-dev libfftw3-dev libgdsii-dev libgsl-dev libharminv-dev libhdf5-dev libtool mpb mpb-dev swig + sudo apt-get -y update + sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev libharminv-dev libpng-dev libtool swig + mkdir -p ~/install + cd ~/install + git clone https://github.com/NanoComp/libctl.git + cd libctl/ + sh autogen.sh --enable-shared + make && sudo make install + cd ~/install + git clone https://github.com/HomerReid/libGDSII.git + cd libGDSII/ + make && sudo make install + - name: Install Serial + if: ${{ matrix.enable-mpi == false }} + run: | + export RPATH_FLAGS="-Wl,-rpath,/usr/local/lib" + export MY_LDFLAGS="-L/usr/local/lib ${RPATH_FLAGS}" + export MY_CPPFLAGS="-I/usr/local/include" + export MY_CC="cc" + sudo apt-get -y install libhdf5-dev hdf5-tools - name: Install MPI if: matrix.enable-mpi run: | - sudo apt-get install libhdf5-openmpi-dev libopenmpi-dev - sudo update-alternatives --set hdf5.pc /usr/lib/x86_64-linux-gnu/pkgconfig/hdf5-openmpi.pc + export RPATH_FLAGS="-Wl,-rpath,/usr/local/lib:/usr/lib/x86_64-linux-gnu/hdf5/openmpi" + export MY_LDFLAGS="-L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/hdf5/openmpi ${RPATH_FLAGS}" + export MY_CPPFLAGS="-I/usr/local/include -I/usr/include/hdf5/openmpi" + export MY_CC="mpicc" + sudo apt-get -y install libhdf5-openmpi-dev libopenmpi-dev hdf5-tools + - name: Install Other Dependencies + run: | + cd ~/install + git clone https://github.com/NanoComp/h5utils.git + cd h5utils/ + sh autogen.sh CC=${MY_CC} LDFLAGS="${MY_LDFLAGS}" CPPFLAGS="${MY_CPPFLAGS}" + make && sudo make install + - name: Install MPB + if: matrix.enable-mpb + run: | + cd ~/install + git clone https://github.com/NanoComp/mpb.git + cd mpb/ + sh autogen.sh --enable-shared CC=${MY_CC} LDFLAGS="${MY_LDFLAGS}" CPPFLAGS="${MY_CPPFLAGS}" --with-hermitian-eps + make && sudo make install - name: Check out repository uses: actions/checkout@v2 - name: Set up Python (version ${{ matrix.python-version }}) @@ -53,10 +93,9 @@ jobs: - name: Install Python dependencies if: ${{ matrix.python-version != 'none' }} run: pip install autograd h5py jax jaxlib matplotlib mpi4py numpy parameterized pytest scipy - - name: Autoreconf - run: autoreconf -if - name: configure - run: ./configure --with-hdf5 --without-scheme --enable-shared ${{ matrix.configure-options }} + run: | + sh autogen.sh --without-scheme --enable-shared CC=${MY_CC} LDFLAGS="${MY_LDFLAGS}" CPPFLAGS="${MY_CPPFLAGS}" ${{ matrix.configure-options }} - name: make run: make - name: Run Python tests From 4cc4e4e1403ea1891d00f2346b57099be5c28635 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Sat, 12 Jun 2021 17:29:14 -0700 Subject: [PATCH 04/20] run autogen.sh for libGDSII source repository --- .github/workflows/build-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 1b859126f..d1a205c7e 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -41,7 +41,7 @@ jobs: - name: Install Common Dependencies run: | sudo apt-get -y update - sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev libharminv-dev libpng-dev libtool swig + sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev libharminv-dev libpng-dev swig mkdir -p ~/install cd ~/install git clone https://github.com/NanoComp/libctl.git @@ -51,6 +51,7 @@ jobs: cd ~/install git clone https://github.com/HomerReid/libGDSII.git cd libGDSII/ + sh autogen.sh make && sudo make install - name: Install Serial if: ${{ matrix.enable-mpi == false }} From d6162dcecde28ac290c1e4c9c8b29518414b1372 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Sat, 12 Jun 2021 17:39:02 -0700 Subject: [PATCH 05/20] add back libtool to common dependencies --- .github/workflows/build-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index d1a205c7e..2fa07e0f4 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -41,7 +41,7 @@ jobs: - name: Install Common Dependencies run: | sudo apt-get -y update - sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev libharminv-dev libpng-dev swig + sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev libharminv-dev libpng-dev libtool swig mkdir -p ~/install cd ~/install git clone https://github.com/NanoComp/libctl.git From faea27e5c9f9a0fa66c46f82c5be1b536b0de9d3 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Sun, 13 Jun 2021 18:12:44 -0700 Subject: [PATCH 06/20] revamp matrix to include C++ and Python tests for serial and MPI --- .github/workflows/build-ci.yml | 138 +++++++++++++++++---------------- 1 file changed, 73 insertions(+), 65 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 2fa07e0f4..43e972902 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -16,96 +16,104 @@ jobs: fail-fast: false matrix: include: - - name-prefix: "C++ without MPI" + - name-prefix: "Python 3.6 without MPI" enable-mpi: false - enable-mpb: false - configure-options: "--without-python" - python-version: "none" - - name-prefix: "C++ with MPI" - enable-mpi: true - enable-mpb: false - configure-options: "--without-python --with-mpi" - python-version: "none" - - name-prefix: "Python 3.6" - enable-mpi: false - enable-mpb: true - configure-options: "--enable-maintainer-mode" + configure-options: "--without-mpi" python-version: "3.6" - - name-prefix: "Python 3.9" + MPICONF: "--without-mpi" + MKCHECKFLAGS: "-j 2" + CPPFLAGS: "${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}" + LDFLAGS: "${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}" + - name-prefix: "Python 3.9 without MPI" enable-mpi: false - enable-mpb: true - configure-options: "--enable-maintainer-mode" + configure-options: "--without-mpi" + python-version: "3.9" + MPICONF: "--without-mpi" + MKCHECKFLAGS: "-j 2" + CPPFLAGS: "${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}" + LDFLAGS: "${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}" + - name-prefix: "Python 3.6 with MPI" + enable-mpi: true + configure-options: "--with-mpi" + python-version: "3.6" + MPICONF: "--with-mpi" + MKCHECKFLAGS: "" + HDF5_MPI: "ON" + CC: mpicc + CXX: mpic++ + CPPFLAGS: "${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}" + LDFLAGS: "${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}" + - name-prefix: "Python 3.9 with MPI" + enable-mpi: true + configure-options: "--with-mpi" python-version: "3.9" + MPICONF: "--with-mpi" + MKCHECKFLAGS: "" + HDF5_MPI: "ON" + CC: mpicc + CXX: mpic++ + CPPFLAGS: "${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}" + LDFLAGS: "${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}" + + env: + CPPFLAGS: "-I${HOME}/local/include" + LDFLAGS: "-L${HOME}/local/lib" + HDF5_BASE_CPPFLAGS: "-I/usr/include/hdf5" + HDF5_SERIAL_CPPFLAGS: "${HDF5_BASE_CPPFLAGS}/serial" + HDF5_PARALLEL_CPPFLAGS: "${HDF5_BASE_CPPFLAGS}/openmpi" + HDF5_BASE_LDFLAGS: "-L/usr/lib/x86_64-linux-gnu/hdf5" + HDF5_SERIAL_LDFLAGS: "${HDF5_BASE_LDFLAGS}/serial" + HDF5_PARALLEL_LDFLAGS: "${HDF5_BASE_LDFLAGS}/openmpi" + GEN_CTL_IO: "${HOME}/local/bin/gen-ctl-io" steps: - - name: Install Common Dependencies + - name: Install common dependencies run: | sudo apt-get -y update - sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev libharminv-dev libpng-dev libtool swig - mkdir -p ~/install - cd ~/install - git clone https://github.com/NanoComp/libctl.git - cd libctl/ - sh autogen.sh --enable-shared - make && sudo make install - cd ~/install + sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev liblapack-dev guile-3.0-dev libpng-dev libtool swig + git clone https://github.com/NanoComp/libctl.git libctl-src + (cd libctl-src && git checkout master && sh autogen.sh --prefix=$HOME/local --enable-shared && make -j 2 && make install) + git clone https://github.com/NanoComp/harminv.git + (cd harminv && git checkout master && sh autogen.sh --prefix=$HOME/local --enable-shared && make -j 2 && make install) + git clone https://github.com/NanoComp/mpb.git + (cd mpb && git checkout master && sh autogen.sh --prefix=$HOME/local --enable-shared LIBS=-ldl --with-libctl=${HOME}/local/share/libctl --with-hermitian-eps && make -j 2 && make install) git clone https://github.com/HomerReid/libGDSII.git - cd libGDSII/ - sh autogen.sh - make && sudo make install - - name: Install Serial + (cd libGDSII && git checkout master && sh autogen.sh --prefix=$HOME/local && make install) + + - name: Install serial dependencies if: ${{ matrix.enable-mpi == false }} - run: | - export RPATH_FLAGS="-Wl,-rpath,/usr/local/lib" - export MY_LDFLAGS="-L/usr/local/lib ${RPATH_FLAGS}" - export MY_CPPFLAGS="-I/usr/local/include" - export MY_CC="cc" - sudo apt-get -y install libhdf5-dev hdf5-tools - - name: Install MPI + run: sudo apt-get -y install libhdf5-serial-dev + + - name: Install MPI dependencies if: matrix.enable-mpi - run: | - export RPATH_FLAGS="-Wl,-rpath,/usr/local/lib:/usr/lib/x86_64-linux-gnu/hdf5/openmpi" - export MY_LDFLAGS="-L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/hdf5/openmpi ${RPATH_FLAGS}" - export MY_CPPFLAGS="-I/usr/local/include -I/usr/include/hdf5/openmpi" - export MY_CC="mpicc" - sudo apt-get -y install libhdf5-openmpi-dev libopenmpi-dev hdf5-tools - - name: Install Other Dependencies - run: | - cd ~/install - git clone https://github.com/NanoComp/h5utils.git - cd h5utils/ - sh autogen.sh CC=${MY_CC} LDFLAGS="${MY_LDFLAGS}" CPPFLAGS="${MY_CPPFLAGS}" - make && sudo make install - - name: Install MPB - if: matrix.enable-mpb - run: | - cd ~/install - git clone https://github.com/NanoComp/mpb.git - cd mpb/ - sh autogen.sh --enable-shared CC=${MY_CC} LDFLAGS="${MY_LDFLAGS}" CPPFLAGS="${MY_CPPFLAGS}" --with-hermitian-eps - make && sudo make install + run: sudo apt-get -y install libopenmpi-dev mpi-default-bin openmpi-bin libhdf5-openmpi-dev + - name: Check out repository uses: actions/checkout@v2 + - name: Set up Python (version ${{ matrix.python-version }}) - if: ${{ matrix.python-version != 'none' }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install Python dependencies - if: ${{ matrix.python-version != 'none' }} run: pip install autograd h5py jax jaxlib matplotlib mpi4py numpy parameterized pytest scipy + - name: configure run: | - sh autogen.sh --without-scheme --enable-shared CC=${MY_CC} LDFLAGS="${MY_LDFLAGS}" CPPFLAGS="${MY_CPPFLAGS}" ${{ matrix.configure-options }} + autoreconf --verbose --install --symlink --force + mkdir -p build && pushd build + ../configure --enable-maintainer-mode --prefix=$HOME/local --with-libctl=$HOME/local/share/libctl ${MPICONF} + - name: make - run: make + run: make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${MPICONF}" + + - name: Run C++ tests + run: pushd tests && make ${MKCHECKFLAGS} check && popd + - name: Run Python tests - if: ${{ matrix.python-version != 'none' }} env: MEEP_SKIP_LARGE_TESTS: 1 run: | export PYTHONPATH="${PWD}/python:${PYTHONPATH}" pytest python/tests - - name: Run C++ tests - if: ${{ matrix.python-version == 'none' }} - run: make check From afe100ff0319e5fe5105fb902efc5382ac52f7e1 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Sun, 13 Jun 2021 20:19:16 -0700 Subject: [PATCH 07/20] use env context when defining environment variables in workflow file --- .github/workflows/build-ci.yml | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 43e972902..0e048cfb5 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -22,16 +22,16 @@ jobs: python-version: "3.6" MPICONF: "--without-mpi" MKCHECKFLAGS: "-j 2" - CPPFLAGS: "${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}" - LDFLAGS: "${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}" + CPPFLAGS: "${{env.HDF5_SERIAL_CPPFLAGS}} ${{env.CPPFLAGS}}" + LDFLAGS: "${{env.HDF5_SERIAL_LDFLAGS}} ${{env.LDFLAGS}}" - name-prefix: "Python 3.9 without MPI" enable-mpi: false configure-options: "--without-mpi" python-version: "3.9" MPICONF: "--without-mpi" MKCHECKFLAGS: "-j 2" - CPPFLAGS: "${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}" - LDFLAGS: "${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}" + CPPFLAGS: "${{env.HDF5_SERIAL_CPPFLAGS}} ${{env.CPPFLAGS}}" + LDFLAGS: "${{env.HDF5_SERIAL_LDFLAGS}} ${{env.LDFLAGS}}" - name-prefix: "Python 3.6 with MPI" enable-mpi: true configure-options: "--with-mpi" @@ -41,8 +41,8 @@ jobs: HDF5_MPI: "ON" CC: mpicc CXX: mpic++ - CPPFLAGS: "${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}" - LDFLAGS: "${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}" + CPPFLAGS: "${{env.HDF5_PARALLEL_CPPFLAGS}} ${{env.CPPFLAGS}}" + LDFLAGS: "${{env.HDF5_PARALLEL_LDFLAGS}} ${{env.LDFLAGS}}" - name-prefix: "Python 3.9 with MPI" enable-mpi: true configure-options: "--with-mpi" @@ -52,19 +52,19 @@ jobs: HDF5_MPI: "ON" CC: mpicc CXX: mpic++ - CPPFLAGS: "${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}" - LDFLAGS: "${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}" + CPPFLAGS: "${{env.HDF5_PARALLEL_CPPFLAGS}} ${{env.CPPFLAGS}}" + LDFLAGS: "${{env.HDF5_PARALLEL_LDFLAGS}} ${{env.LDFLAGS}}" env: - CPPFLAGS: "-I${HOME}/local/include" - LDFLAGS: "-L${HOME}/local/lib" + CPPFLAGS: "-I${{env.HOME}}/local/include" + LDFLAGS: "-L${{env.HOME}}/local/lib" HDF5_BASE_CPPFLAGS: "-I/usr/include/hdf5" - HDF5_SERIAL_CPPFLAGS: "${HDF5_BASE_CPPFLAGS}/serial" - HDF5_PARALLEL_CPPFLAGS: "${HDF5_BASE_CPPFLAGS}/openmpi" + HDF5_SERIAL_CPPFLAGS: "${{env.HDF5_BASE_CPPFLAGS}}/serial" + HDF5_PARALLEL_CPPFLAGS: "${{env.HDF5_BASE_CPPFLAGS}}/openmpi" HDF5_BASE_LDFLAGS: "-L/usr/lib/x86_64-linux-gnu/hdf5" - HDF5_SERIAL_LDFLAGS: "${HDF5_BASE_LDFLAGS}/serial" - HDF5_PARALLEL_LDFLAGS: "${HDF5_BASE_LDFLAGS}/openmpi" - GEN_CTL_IO: "${HOME}/local/bin/gen-ctl-io" + HDF5_SERIAL_LDFLAGS: "${{env.HDF5_BASE_LDFLAGS}}/serial" + HDF5_PARALLEL_LDFLAGS: "${{env.HDF5_BASE_LDFLAGS}}/openmpi" + GEN_CTL_IO: "${{env.HOME}}/local/bin/gen-ctl-io" steps: - name: Install common dependencies @@ -72,13 +72,13 @@ jobs: sudo apt-get -y update sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev liblapack-dev guile-3.0-dev libpng-dev libtool swig git clone https://github.com/NanoComp/libctl.git libctl-src - (cd libctl-src && git checkout master && sh autogen.sh --prefix=$HOME/local --enable-shared && make -j 2 && make install) + (cd libctl-src && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) git clone https://github.com/NanoComp/harminv.git - (cd harminv && git checkout master && sh autogen.sh --prefix=$HOME/local --enable-shared && make -j 2 && make install) + (cd harminv && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) git clone https://github.com/NanoComp/mpb.git - (cd mpb && git checkout master && sh autogen.sh --prefix=$HOME/local --enable-shared LIBS=-ldl --with-libctl=${HOME}/local/share/libctl --with-hermitian-eps && make -j 2 && make install) + (cd mpb && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared LIBS=-ldl --with-libctl=${HOME}/local/share/libctl --with-hermitian-eps && make -j 2 && make install) git clone https://github.com/HomerReid/libGDSII.git - (cd libGDSII && git checkout master && sh autogen.sh --prefix=$HOME/local && make install) + (cd libGDSII && git checkout master && sh autogen.sh --prefix=${HOME}/local && make install) - name: Install serial dependencies if: ${{ matrix.enable-mpi == false }} @@ -103,7 +103,7 @@ jobs: run: | autoreconf --verbose --install --symlink --force mkdir -p build && pushd build - ../configure --enable-maintainer-mode --prefix=$HOME/local --with-libctl=$HOME/local/share/libctl ${MPICONF} + ../configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${MPICONF} - name: make run: make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${MPICONF}" From fba5281dbf05d6223835e2de67877209aac537b9 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Sun, 13 Jun 2021 20:30:49 -0700 Subject: [PATCH 08/20] leave a space between curly brackets of workflow variables --- .github/workflows/build-ci.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 0e048cfb5..a7a074b1a 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -22,16 +22,16 @@ jobs: python-version: "3.6" MPICONF: "--without-mpi" MKCHECKFLAGS: "-j 2" - CPPFLAGS: "${{env.HDF5_SERIAL_CPPFLAGS}} ${{env.CPPFLAGS}}" - LDFLAGS: "${{env.HDF5_SERIAL_LDFLAGS}} ${{env.LDFLAGS}}" + CPPFLAGS: "${{ env.HDF5_SERIAL_CPPFLAGS }} ${{ env.CPPFLAGS }}" + LDFLAGS: "${{ env.HDF5_SERIAL_LDFLAGS }} ${{ env.LDFLAGS }}" - name-prefix: "Python 3.9 without MPI" enable-mpi: false configure-options: "--without-mpi" python-version: "3.9" MPICONF: "--without-mpi" MKCHECKFLAGS: "-j 2" - CPPFLAGS: "${{env.HDF5_SERIAL_CPPFLAGS}} ${{env.CPPFLAGS}}" - LDFLAGS: "${{env.HDF5_SERIAL_LDFLAGS}} ${{env.LDFLAGS}}" + CPPFLAGS: "${{ env.HDF5_SERIAL_CPPFLAGS }} ${{ env.CPPFLAGS }}" + LDFLAGS: "${{ env.HDF5_SERIAL_LDFLAGS }} ${{ env.LDFLAGS }}" - name-prefix: "Python 3.6 with MPI" enable-mpi: true configure-options: "--with-mpi" @@ -41,8 +41,8 @@ jobs: HDF5_MPI: "ON" CC: mpicc CXX: mpic++ - CPPFLAGS: "${{env.HDF5_PARALLEL_CPPFLAGS}} ${{env.CPPFLAGS}}" - LDFLAGS: "${{env.HDF5_PARALLEL_LDFLAGS}} ${{env.LDFLAGS}}" + CPPFLAGS: "${{ env.HDF5_PARALLEL_CPPFLAGS }} ${{ env.CPPFLAGS }}" + LDFLAGS: "${{ env.HDF5_PARALLEL_LDFLAGS }} ${{ env.LDFLAGS }}" - name-prefix: "Python 3.9 with MPI" enable-mpi: true configure-options: "--with-mpi" @@ -52,19 +52,19 @@ jobs: HDF5_MPI: "ON" CC: mpicc CXX: mpic++ - CPPFLAGS: "${{env.HDF5_PARALLEL_CPPFLAGS}} ${{env.CPPFLAGS}}" - LDFLAGS: "${{env.HDF5_PARALLEL_LDFLAGS}} ${{env.LDFLAGS}}" + CPPFLAGS: "${{ env.HDF5_PARALLEL_CPPFLAGS }} ${{ env.CPPFLAGS }}" + LDFLAGS: "${{ env.HDF5_PARALLEL_LDFLAGS }} ${{ env.LDFLAGS }}" env: - CPPFLAGS: "-I${{env.HOME}}/local/include" - LDFLAGS: "-L${{env.HOME}}/local/lib" + CPPFLAGS: "-I${{ env.HOME }}/local/include" + LDFLAGS: "-L${{ env.HOME }}/local/lib" HDF5_BASE_CPPFLAGS: "-I/usr/include/hdf5" - HDF5_SERIAL_CPPFLAGS: "${{env.HDF5_BASE_CPPFLAGS}}/serial" - HDF5_PARALLEL_CPPFLAGS: "${{env.HDF5_BASE_CPPFLAGS}}/openmpi" + HDF5_SERIAL_CPPFLAGS: "${{ env.HDF5_BASE_CPPFLAGS }}/serial" + HDF5_PARALLEL_CPPFLAGS: "${{ env.HDF5_BASE_CPPFLAGS }}/openmpi" HDF5_BASE_LDFLAGS: "-L/usr/lib/x86_64-linux-gnu/hdf5" - HDF5_SERIAL_LDFLAGS: "${{env.HDF5_BASE_LDFLAGS}}/serial" - HDF5_PARALLEL_LDFLAGS: "${{env.HDF5_BASE_LDFLAGS}}/openmpi" - GEN_CTL_IO: "${{env.HOME}}/local/bin/gen-ctl-io" + HDF5_SERIAL_LDFLAGS: "${{ env.HDF5_BASE_LDFLAGS }}/serial" + HDF5_PARALLEL_LDFLAGS: "${{ env.HDF5_BASE_LDFLAGS }}/openmpi" + GEN_CTL_IO: "${{ env.HOME }}/local/bin/gen-ctl-io" steps: - name: Install common dependencies From 3166fbdacf30f78f96de3d0eb996691a95db2387 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Sun, 13 Jun 2021 21:52:55 -0700 Subject: [PATCH 09/20] create workflow environment variables and explicitly define /home/oskooi directory --- .github/workflows/build-ci.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index a7a074b1a..6422abc4f 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -7,11 +7,24 @@ on: branches: [ master ] workflow_dispatch: +env: + CPPFLAGS: "-I/home/runner/local/include" + LDFLAGS: "-L/home/runner/local/lib" + HDF5_BASE_CPPFLAGS: "-I/usr/include/hdf5" + HDF5_BASE_LDFLAGS: "-L/usr/lib/x86_64-linux-gnu/hdf5" + GEN_CTL_IO: "/home/runner/local/bin/gen-ctl-io" + jobs: build: name: "Test ${{ matrix.name-prefix }}" runs-on: ubuntu-latest + env: + HDF5_SERIAL_CPPFLAGS: "${{ env.HDF5_BASE_CPPFLAGS }}/serial" + HDF5_PARALLEL_CPPFLAGS: "${{ env.HDF5_BASE_CPPFLAGS }}/openmpi" + HDF5_SERIAL_LDFLAGS: "${{ env.HDF5_BASE_LDFLAGS }}/serial" + HDF5_PARALLEL_LDFLAGS: "${{ env.HDF5_BASE_LDFLAGS }}/openmpi" + strategy: fail-fast: false matrix: @@ -55,17 +68,6 @@ jobs: CPPFLAGS: "${{ env.HDF5_PARALLEL_CPPFLAGS }} ${{ env.CPPFLAGS }}" LDFLAGS: "${{ env.HDF5_PARALLEL_LDFLAGS }} ${{ env.LDFLAGS }}" - env: - CPPFLAGS: "-I${{ env.HOME }}/local/include" - LDFLAGS: "-L${{ env.HOME }}/local/lib" - HDF5_BASE_CPPFLAGS: "-I/usr/include/hdf5" - HDF5_SERIAL_CPPFLAGS: "${{ env.HDF5_BASE_CPPFLAGS }}/serial" - HDF5_PARALLEL_CPPFLAGS: "${{ env.HDF5_BASE_CPPFLAGS }}/openmpi" - HDF5_BASE_LDFLAGS: "-L/usr/lib/x86_64-linux-gnu/hdf5" - HDF5_SERIAL_LDFLAGS: "${{ env.HDF5_BASE_LDFLAGS }}/serial" - HDF5_PARALLEL_LDFLAGS: "${{ env.HDF5_BASE_LDFLAGS }}/openmpi" - GEN_CTL_IO: "${{ env.HOME }}/local/bin/gen-ctl-io" - steps: - name: Install common dependencies run: | From dc2e0f569fdde74877e73b87f7b148dfb0fc404a Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Mon, 14 Jun 2021 17:33:45 -0700 Subject: [PATCH 10/20] define environment variables using an environment file for correct parsing --- .github/workflows/build-ci.yml | 71 +++++++++++++++++----------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 6422abc4f..0be1c50ba 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -7,24 +7,11 @@ on: branches: [ master ] workflow_dispatch: -env: - CPPFLAGS: "-I/home/runner/local/include" - LDFLAGS: "-L/home/runner/local/lib" - HDF5_BASE_CPPFLAGS: "-I/usr/include/hdf5" - HDF5_BASE_LDFLAGS: "-L/usr/lib/x86_64-linux-gnu/hdf5" - GEN_CTL_IO: "/home/runner/local/bin/gen-ctl-io" - jobs: build: name: "Test ${{ matrix.name-prefix }}" runs-on: ubuntu-latest - env: - HDF5_SERIAL_CPPFLAGS: "${{ env.HDF5_BASE_CPPFLAGS }}/serial" - HDF5_PARALLEL_CPPFLAGS: "${{ env.HDF5_BASE_CPPFLAGS }}/openmpi" - HDF5_SERIAL_LDFLAGS: "${{ env.HDF5_BASE_LDFLAGS }}/serial" - HDF5_PARALLEL_LDFLAGS: "${{ env.HDF5_BASE_LDFLAGS }}/openmpi" - strategy: fail-fast: false matrix: @@ -33,42 +20,54 @@ jobs: enable-mpi: false configure-options: "--without-mpi" python-version: "3.6" - MPICONF: "--without-mpi" - MKCHECKFLAGS: "-j 2" - CPPFLAGS: "${{ env.HDF5_SERIAL_CPPFLAGS }} ${{ env.CPPFLAGS }}" - LDFLAGS: "${{ env.HDF5_SERIAL_LDFLAGS }} ${{ env.LDFLAGS }}" - name-prefix: "Python 3.9 without MPI" enable-mpi: false configure-options: "--without-mpi" python-version: "3.9" - MPICONF: "--without-mpi" - MKCHECKFLAGS: "-j 2" - CPPFLAGS: "${{ env.HDF5_SERIAL_CPPFLAGS }} ${{ env.CPPFLAGS }}" - LDFLAGS: "${{ env.HDF5_SERIAL_LDFLAGS }} ${{ env.LDFLAGS }}" - name-prefix: "Python 3.6 with MPI" enable-mpi: true configure-options: "--with-mpi" python-version: "3.6" - MPICONF: "--with-mpi" - MKCHECKFLAGS: "" - HDF5_MPI: "ON" - CC: mpicc - CXX: mpic++ - CPPFLAGS: "${{ env.HDF5_PARALLEL_CPPFLAGS }} ${{ env.CPPFLAGS }}" - LDFLAGS: "${{ env.HDF5_PARALLEL_LDFLAGS }} ${{ env.LDFLAGS }}" - name-prefix: "Python 3.9 with MPI" enable-mpi: true configure-options: "--with-mpi" python-version: "3.9" - MPICONF: "--with-mpi" - MKCHECKFLAGS: "" - HDF5_MPI: "ON" - CC: mpicc - CXX: mpic++ - CPPFLAGS: "${{ env.HDF5_PARALLEL_CPPFLAGS }} ${{ env.CPPFLAGS }}" - LDFLAGS: "${{ env.HDF5_PARALLEL_LDFLAGS }} ${{ env.LDFLAGS }}" steps: + - name: Define common environment variables + run: | + echo "CPPFLAGS=-I${HOME}/local/include" >> $GITHUB_ENV + echo "LDFLAGS=-L${HOME}/local/lib" >> $GITHUB_ENV + echo "HDF5_BASE_CPPFLAGS=-I/usr/include/hdf5" >> $GITHUB_ENV + echo "HDF5_BASE_LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5" >> $GITHUB_ENV + echo "GEN_CTL_IO=${HOME}/local/bin/gen-ctl-io" >> $GITHUB_ENV + + - name: Define more common environment variables + run: | + echo "HDF5_SERIAL_CPPFLAGS=${HDF5_BASE_CPPFLAGS}/serial" >> $GITHUB_ENV + echo "HDF5_PARALLEL_CPPFLAGS=${HDF5_BASE_CPPFLAGS}/openmpi" >> $GITHUB_ENV + echo "HDF5_SERIAL_LDFLAGS=${HDF5_BASE_LDFLAGS}/serial" >> $GITHUB_ENV + echo "HDF5_PARALLEL_LDFLAGS=${HDF5_BASE_LDFLAGS}/openmpi" >> $GITHUB_ENV + + - name: Define environment variables for serial build + if: ${{ matrix.enable-mpi == false }} + run: | + echo "MPICONF=--without-mpi" >> $GITHUB_ENV + echo "MKCHECKFLAGS=-j 2" >> $GITHUB_ENV + echo "CPPFLAGS=${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}" >> $GITHUB_ENV + echo "LDFLAGS="${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}" >> $GITHUB_ENV + + - name: Define environment variables for MPI build + if: matrix.enable-mpi + run: | + echo "MPICONF=--with-mpi" >> $GITHUB_ENV + echo "MKCHECKFLAGS=" >> $GITHUB_ENV + echo "CPPFLAGS=${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}" >> $GITHUB_ENV + echo "LDFLAGS=${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}" >> $GITHUB_ENV + echo "CC=mpicc" >> $GITHUB_ENV + echo "CXX=mpic++" >> $GITHUB_ENV + echo "HDF5_MPI=ON" >> $GITHUB_ENV + - name: Install common dependencies run: | sudo apt-get -y update @@ -108,7 +107,7 @@ jobs: ../configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${MPICONF} - name: make - run: make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${MPICONF}" + run: make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${MPICONF}" ${matrix.configure-options} - name: Run C++ tests run: pushd tests && make ${MKCHECKFLAGS} check && popd From 1db2e903f97b03f26ffe1221d1e45bf3b3674914 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Mon, 14 Jun 2021 17:41:36 -0700 Subject: [PATCH 11/20] escape double quotes to preserve spaces --- .github/workflows/build-ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 0be1c50ba..5c59e5c4c 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -52,18 +52,18 @@ jobs: - name: Define environment variables for serial build if: ${{ matrix.enable-mpi == false }} run: | - echo "MPICONF=--without-mpi" >> $GITHUB_ENV - echo "MKCHECKFLAGS=-j 2" >> $GITHUB_ENV - echo "CPPFLAGS=${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}" >> $GITHUB_ENV - echo "LDFLAGS="${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}" >> $GITHUB_ENV + echo "MPICONF=\"--without-mpi\"" >> $GITHUB_ENV + echo "MKCHECKFLAGS=\"-j 2\"" >> $GITHUB_ENV + echo "CPPFLAGS=\"${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}\"" >> $GITHUB_ENV + echo "LDFLAGS=\"${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}\"" >> $GITHUB_ENV - name: Define environment variables for MPI build if: matrix.enable-mpi run: | - echo "MPICONF=--with-mpi" >> $GITHUB_ENV + echo "MPICONF=\"--with-mpi\"" >> $GITHUB_ENV echo "MKCHECKFLAGS=" >> $GITHUB_ENV - echo "CPPFLAGS=${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}" >> $GITHUB_ENV - echo "LDFLAGS=${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}" >> $GITHUB_ENV + echo "CPPFLAGS=\"${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}\"" >> $GITHUB_ENV + echo "LDFLAGS=\"${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}\"" >> $GITHUB_ENV echo "CC=mpicc" >> $GITHUB_ENV echo "CXX=mpic++" >> $GITHUB_ENV echo "HDF5_MPI=ON" >> $GITHUB_ENV From f6bf161ad4faa9fa9ce6380441c2e1d47cb3f765 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Mon, 14 Jun 2021 18:05:04 -0700 Subject: [PATCH 12/20] install dependencies before defining environment variables --- .github/workflows/build-ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 5c59e5c4c..32db5e052 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -34,6 +34,19 @@ jobs: python-version: "3.9" steps: + - name: Install common dependencies + run: | + sudo apt-get -y update + sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev liblapack-dev guile-3.0-dev libpng-dev libtool swig + git clone https://github.com/NanoComp/libctl.git libctl-src + (cd libctl-src && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) + git clone https://github.com/NanoComp/harminv.git + (cd harminv && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) + git clone https://github.com/NanoComp/mpb.git + (cd mpb && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared LIBS=-ldl --with-libctl=${HOME}/local/share/libctl --with-hermitian-eps && make -j 2 && make install) + git clone https://github.com/HomerReid/libGDSII.git + (cd libGDSII && git checkout master && sh autogen.sh --prefix=${HOME}/local && make install) + - name: Define common environment variables run: | echo "CPPFLAGS=-I${HOME}/local/include" >> $GITHUB_ENV @@ -68,19 +81,6 @@ jobs: echo "CXX=mpic++" >> $GITHUB_ENV echo "HDF5_MPI=ON" >> $GITHUB_ENV - - name: Install common dependencies - run: | - sudo apt-get -y update - sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev liblapack-dev guile-3.0-dev libpng-dev libtool swig - git clone https://github.com/NanoComp/libctl.git libctl-src - (cd libctl-src && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) - git clone https://github.com/NanoComp/harminv.git - (cd harminv && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) - git clone https://github.com/NanoComp/mpb.git - (cd mpb && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared LIBS=-ldl --with-libctl=${HOME}/local/share/libctl --with-hermitian-eps && make -j 2 && make install) - git clone https://github.com/HomerReid/libGDSII.git - (cd libGDSII && git checkout master && sh autogen.sh --prefix=${HOME}/local && make install) - - name: Install serial dependencies if: ${{ matrix.enable-mpi == false }} run: sudo apt-get -y install libhdf5-serial-dev From fe8edb2ced0803569077967b2cac8f2e733f0838 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Mon, 14 Jun 2021 18:14:03 -0700 Subject: [PATCH 13/20] define GEN_CTL_IO env variable before building libctl from source --- .github/workflows/build-ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 32db5e052..672022ba9 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -34,19 +34,6 @@ jobs: python-version: "3.9" steps: - - name: Install common dependencies - run: | - sudo apt-get -y update - sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev liblapack-dev guile-3.0-dev libpng-dev libtool swig - git clone https://github.com/NanoComp/libctl.git libctl-src - (cd libctl-src && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) - git clone https://github.com/NanoComp/harminv.git - (cd harminv && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) - git clone https://github.com/NanoComp/mpb.git - (cd mpb && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared LIBS=-ldl --with-libctl=${HOME}/local/share/libctl --with-hermitian-eps && make -j 2 && make install) - git clone https://github.com/HomerReid/libGDSII.git - (cd libGDSII && git checkout master && sh autogen.sh --prefix=${HOME}/local && make install) - - name: Define common environment variables run: | echo "CPPFLAGS=-I${HOME}/local/include" >> $GITHUB_ENV @@ -62,6 +49,19 @@ jobs: echo "HDF5_SERIAL_LDFLAGS=${HDF5_BASE_LDFLAGS}/serial" >> $GITHUB_ENV echo "HDF5_PARALLEL_LDFLAGS=${HDF5_BASE_LDFLAGS}/openmpi" >> $GITHUB_ENV + - name: Install common dependencies + run: | + sudo apt-get -y update + sudo apt-get -y install autoconf automake libfftw3-dev libgsl-dev liblapack-dev guile-3.0-dev libpng-dev libtool swig + git clone https://github.com/NanoComp/libctl.git libctl-src + (cd libctl-src && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) + git clone https://github.com/NanoComp/harminv.git + (cd harminv && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j 2 && make install) + git clone https://github.com/NanoComp/mpb.git + (cd mpb && git checkout master && sh autogen.sh --prefix=${HOME}/local --enable-shared LIBS=-ldl --with-libctl=${HOME}/local/share/libctl --with-hermitian-eps && make -j 2 && make install) + git clone https://github.com/HomerReid/libGDSII.git + (cd libGDSII && git checkout master && sh autogen.sh --prefix=${HOME}/local && make install) + - name: Define environment variables for serial build if: ${{ matrix.enable-mpi == false }} run: | From 77b0b3c3a18f8392077ec478f715e4f22357aedf Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Mon, 14 Jun 2021 18:56:50 -0700 Subject: [PATCH 14/20] separate step for mpi4py install --- .github/workflows/build-ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 672022ba9..7991dca48 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -87,7 +87,7 @@ jobs: - name: Install MPI dependencies if: matrix.enable-mpi - run: sudo apt-get -y install libopenmpi-dev mpi-default-bin openmpi-bin libhdf5-openmpi-dev + run: sudo apt-get -y install libopenmpi-dev mpi-default-bin openmpi-bin libhdf5-openmpi-dev libaec-dev - name: Check out repository uses: actions/checkout@v2 @@ -98,7 +98,11 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install Python dependencies - run: pip install autograd h5py jax jaxlib matplotlib mpi4py numpy parameterized pytest scipy + run: pip install autograd h5py jax jaxlib matplotlib numpy parameterized pytest scipy + + - name: Install mpi4py + if: matrix.enable-mpi + run: pip install mpi4py - name: configure run: | From f54b9df8627f78bc3f3f9574701c11dd01c515b2 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Mon, 14 Jun 2021 19:16:57 -0700 Subject: [PATCH 15/20] fix configure option for Meep related to MPI --- .github/workflows/build-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 7991dca48..102cfee76 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -65,7 +65,6 @@ jobs: - name: Define environment variables for serial build if: ${{ matrix.enable-mpi == false }} run: | - echo "MPICONF=\"--without-mpi\"" >> $GITHUB_ENV echo "MKCHECKFLAGS=\"-j 2\"" >> $GITHUB_ENV echo "CPPFLAGS=\"${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}\"" >> $GITHUB_ENV echo "LDFLAGS=\"${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}\"" >> $GITHUB_ENV @@ -73,7 +72,6 @@ jobs: - name: Define environment variables for MPI build if: matrix.enable-mpi run: | - echo "MPICONF=\"--with-mpi\"" >> $GITHUB_ENV echo "MKCHECKFLAGS=" >> $GITHUB_ENV echo "CPPFLAGS=\"${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}\"" >> $GITHUB_ENV echo "LDFLAGS=\"${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}\"" >> $GITHUB_ENV @@ -104,14 +102,16 @@ jobs: if: matrix.enable-mpi run: pip install mpi4py + - name: autoreconf + run: autoreconf --verbose --install --symlink --force + - name: configure run: | - autoreconf --verbose --install --symlink --force mkdir -p build && pushd build - ../configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${MPICONF} + ../configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }} - name: make - run: make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${MPICONF}" ${matrix.configure-options} + run: make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl - name: Run C++ tests run: pushd tests && make ${MKCHECKFLAGS} check && popd From a96dae3e2d724df47e8cee091421180849bc91d2 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Mon, 14 Jun 2021 21:43:34 -0700 Subject: [PATCH 16/20] replace out-of-tree with in-tree build --- .github/workflows/build-ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 102cfee76..d9261582f 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -106,9 +106,7 @@ jobs: run: autoreconf --verbose --install --symlink --force - name: configure - run: | - mkdir -p build && pushd build - ../configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }} + run: ./configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }} - name: make run: make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl From a7cd5d41b7ac461fe70f8a939399a59212487da6 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Tue, 15 Jun 2021 12:59:22 -0700 Subject: [PATCH 17/20] run Python tests as a separate step and output logs at the end --- .github/workflows/build-ci.yml | 44 ++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index d9261582f..110471e47 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -65,16 +65,16 @@ jobs: - name: Define environment variables for serial build if: ${{ matrix.enable-mpi == false }} run: | - echo "MKCHECKFLAGS=\"-j 2\"" >> $GITHUB_ENV - echo "CPPFLAGS=\"${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}\"" >> $GITHUB_ENV - echo "LDFLAGS=\"${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}\"" >> $GITHUB_ENV + echo "MKCHECKFLAGS=-j 2" >> $GITHUB_ENV + echo "CPPFLAGS=${HDF5_SERIAL_CPPFLAGS} ${CPPFLAGS}" >> $GITHUB_ENV + echo "LDFLAGS=${HDF5_SERIAL_LDFLAGS} ${LDFLAGS}" >> $GITHUB_ENV - name: Define environment variables for MPI build if: matrix.enable-mpi run: | echo "MKCHECKFLAGS=" >> $GITHUB_ENV - echo "CPPFLAGS=\"${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}\"" >> $GITHUB_ENV - echo "LDFLAGS=\"${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}\"" >> $GITHUB_ENV + echo "CPPFLAGS=${HDF5_PARALLEL_CPPFLAGS} ${CPPFLAGS}" >> $GITHUB_ENV + echo "LDFLAGS=${HDF5_PARALLEL_LDFLAGS} ${LDFLAGS}" >> $GITHUB_ENV echo "CC=mpicc" >> $GITHUB_ENV echo "CXX=mpic++" >> $GITHUB_ENV echo "HDF5_MPI=ON" >> $GITHUB_ENV @@ -103,20 +103,38 @@ jobs: run: pip install mpi4py - name: autoreconf - run: autoreconf --verbose --install --symlink --force + run: | + autoreconf --verbose --install --symlink --force + MEEP_VERSION=$(./configure -V | grep meep | awk '{print $3}') + echo "MEEP_VERSION=${MEEP_VERSION}" >> $GITHUB_ENV - name: configure - run: ./configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }} - - - name: make - run: make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl + run: | + mkdir -p build && pushd build + ../configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }} - - name: Run C++ tests - run: pushd tests && make ${MKCHECKFLAGS} check && popd + - name: make distcheck + run: | + pushd build && make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }}" && MAKE_DISTCHECK_EXIT_CODE=0 + echo "MAKE_DISTCHECK_EXIT_CODE=${MAKE_DISTCHECK_EXIT_CODE}" >> $GITHUB_ENV - name: Run Python tests env: MEEP_SKIP_LARGE_TESTS: 1 run: | export PYTHONPATH="${PWD}/python:${PYTHONPATH}" - pytest python/tests + if [[ "${MAKE_DISTCHECK_EXIT_CODE}" = "0" ]]; then + pushd build && + make ${MKCHECKFLAGS} && + pushd python && + pytest tests && + popd; + fi + + - name: Output logs + run: | + - BUILD_PREFIX=${GITHUB_WORKSPACE}/build/meep-${MEEP_VERSION}/_build/sub + - MEEP_LOG=${BUILD_PREFIX}/tests/test-suite.log + - if [[ -e ${MEEP_LOG} ]]; then cat ${MEEP_LOG}; fi + - PYTHON_LOG=${BUILD_PREFIX}/python/test-suite.log + - if [[ -e ${PYTHON_LOG} ]]; then cat ${PYTHON_LOG}; fi From 7136b982a48db7a86a01eda28bf7c4ef02a0efad Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Tue, 15 Jun 2021 16:54:21 -0700 Subject: [PATCH 18/20] remove misplaced - from run lines in Output logs --- .github/workflows/build-ci.yml | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 110471e47..dd40c5114 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -102,39 +102,24 @@ jobs: if: matrix.enable-mpi run: pip install mpi4py - - name: autoreconf + - name: Run autoreconf run: | autoreconf --verbose --install --symlink --force MEEP_VERSION=$(./configure -V | grep meep | awk '{print $3}') echo "MEEP_VERSION=${MEEP_VERSION}" >> $GITHUB_ENV - - name: configure + - name: Run configure run: | mkdir -p build && pushd build ../configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }} - - name: make distcheck - run: | - pushd build && make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }}" && MAKE_DISTCHECK_EXIT_CODE=0 - echo "MAKE_DISTCHECK_EXIT_CODE=${MAKE_DISTCHECK_EXIT_CODE}" >> $GITHUB_ENV - - - name: Run Python tests - env: - MEEP_SKIP_LARGE_TESTS: 1 - run: | - export PYTHONPATH="${PWD}/python:${PYTHONPATH}" - if [[ "${MAKE_DISTCHECK_EXIT_CODE}" = "0" ]]; then - pushd build && - make ${MKCHECKFLAGS} && - pushd python && - pytest tests && - popd; - fi + - name: Run make distcheck + run: pushd build && make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }}" - name: Output logs run: | - - BUILD_PREFIX=${GITHUB_WORKSPACE}/build/meep-${MEEP_VERSION}/_build/sub - - MEEP_LOG=${BUILD_PREFIX}/tests/test-suite.log - - if [[ -e ${MEEP_LOG} ]]; then cat ${MEEP_LOG}; fi - - PYTHON_LOG=${BUILD_PREFIX}/python/test-suite.log - - if [[ -e ${PYTHON_LOG} ]]; then cat ${PYTHON_LOG}; fi + BUILD_PREFIX="${{ github.workspace }}/build/meep-${MEEP_VERSION}/_build/sub" + CPP_LOG="${BUILD_PREFIX}/tests/test-suite.log" + [ -f ${CPP_LOG} ] && cat ${CPP_LOG}; + PYTHON_LOG="${BUILD_PREFIX}/python/test-suite.log" + [ -f ${PYTHON_LOG} ] && cat ${PYTHON_LOG}; From 1a44cb894dcd56873e1df267c8c0572a56988127 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Tue, 15 Jun 2021 16:55:15 -0700 Subject: [PATCH 19/20] revert python/tests/test_mode_coeffs.py --- python/tests/test_mode_coeffs.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/python/tests/test_mode_coeffs.py b/python/tests/test_mode_coeffs.py index 7d27a6ec8..d3b650b1e 100644 --- a/python/tests/test_mode_coeffs.py +++ b/python/tests/test_mode_coeffs.py @@ -7,7 +7,7 @@ class TestModeCoeffs(unittest.TestCase): - def run_mode_coeffs(self, mode_num, kpoint_func, nf=1, resolution=25): + def run_mode_coeffs(self, mode_num, kpoint_func, nf=1, resolution=15): w = 1 # width of waveguide L = 10 # length of waveguide @@ -76,12 +76,12 @@ def run_mode_coeffs(self, mode_num, kpoint_func, nf=1, resolution=25): modes_to_check = [1, 2] # indices of modes for which to compute expansion coefficients res = sim.get_eigenmode_coefficients(mflux, modes_to_check, kpoint_func=kpoint_func) - self.assertTrue(res.kpoints[0].close(mp.Vector3(0.6056758, 0, 0), tol=1e-2)) - self.assertTrue(res.kpoints[1].close(mp.Vector3(0.4995093, 0, 0), tol=1e-2)) - self.assertTrue(res.kdom[0].close(mp.Vector3(0.6056758, 0, 0), tol=1e-2)) - self.assertTrue(res.kdom[1].close(mp.Vector3(0.4995093, 0, 0), tol=1e-2)) - self.assertAlmostEqual(res.cscale[0],0.5000020,places=2) - self.assertAlmostEqual(res.cscale[1],0.5003438,places=2) + self.assertTrue(res.kpoints[0].close(mp.Vector3(0.604301, 0, 0))) + self.assertTrue(res.kpoints[1].close(mp.Vector3(0.494353, 0, 0), tol=1e-2)) + self.assertTrue(res.kdom[0].close(mp.Vector3(0.604301, 0, 0))) + self.assertTrue(res.kdom[1].close(mp.Vector3(0.494353, 0, 0), tol=1e-2)) + self.assertAlmostEqual(res.cscale[0],0.50000977,places=5) + self.assertAlmostEqual(res.cscale[1],0.50096888,places=5) mode_power = mp.get_fluxes(mode_flux)[0] TestPassed = True @@ -117,8 +117,8 @@ def test_modes(self): eval_point = mp.Vector3(0.7, -0.2, 0.3) ex_at_eval_point = emdata.amplitude(eval_point, mp.Ex) hz_at_eval_point = emdata.amplitude(eval_point, mp.Hz) - self.assertAlmostEqual(ex_at_eval_point, 0.5360627614248279+0.4004029756259545j, places=4) - self.assertAlmostEqual(hz_at_eval_point, 2.904704413025583-3.8885361484090213j, places=4) + self.assertAlmostEqual(ex_at_eval_point, 0.4887779638178009+0.48424014532428294j) + self.assertAlmostEqual(hz_at_eval_point, 3.4249236584603495-3.455974863884166j) def test_kpoint_func(self): From 44f1675267109de77d4128d5a049419953ff1d24 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Tue, 15 Jun 2021 17:42:40 -0700 Subject: [PATCH 20/20] remove output logs step --- .github/workflows/build-ci.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index dd40c5114..15c78b063 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -114,12 +114,4 @@ jobs: ../configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }} - name: Run make distcheck - run: pushd build && make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }}" - - - name: Output logs - run: | - BUILD_PREFIX="${{ github.workspace }}/build/meep-${MEEP_VERSION}/_build/sub" - CPP_LOG="${BUILD_PREFIX}/tests/test-suite.log" - [ -f ${CPP_LOG} ] && cat ${CPP_LOG}; - PYTHON_LOG="${BUILD_PREFIX}/python/test-suite.log" - [ -f ${PYTHON_LOG} ] && cat ${PYTHON_LOG}; + run: pushd build && make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${{ matrix.configure-options }}" \ No newline at end of file