From cba6bfc2968d178ee01d4c0a4f421079b089808b Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Wed, 25 Mar 2026 21:13:58 -0700 Subject: [PATCH 1/4] exclude tests involving adjoint solver from make check --- python/Makefile.am | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/python/Makefile.am b/python/Makefile.am index a4deae14c..333cfc84c 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -30,13 +30,15 @@ else WVG_SRC_TEST = endif -TESTS = \ - $(TEST_DIR)/test_3rd_harm_1d.py \ - $(TEST_DIR)/test_absorber_1d.py \ +ADJOINT_TESTS = \ $(TEST_DIR)/test_adjoint_solver.py \ $(TEST_DIR)/test_adjoint_utils.py \ $(TEST_DIR)/test_adjoint_cyl.py \ $(TEST_DIR)/test_adjoint_jax.py \ + +TESTS = \ + $(TEST_DIR)/test_3rd_harm_1d.py \ + $(TEST_DIR)/test_absorber_1d.py \ $(TEST_DIR)/test_antenna_radiation.py \ $(TEST_DIR)/test_array_metadata.py \ $(TEST_DIR)/test_bend_flux.py \ @@ -256,6 +258,9 @@ endif all-local: meep +check-adjoint: + $(MAKE) check TESTS="$(ADJOINT_TESTS) $(TESTS)" + clean-local: rm -rf meep __init__.py.bak From ab5917015bb471d2a8f89f6ad78b2d971ede4fde Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Wed, 25 Mar 2026 21:28:55 -0700 Subject: [PATCH 2/4] remove incorrect line break --- python/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/Makefile.am b/python/Makefile.am index 333cfc84c..2b78b4a61 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -34,7 +34,7 @@ ADJOINT_TESTS = \ $(TEST_DIR)/test_adjoint_solver.py \ $(TEST_DIR)/test_adjoint_utils.py \ $(TEST_DIR)/test_adjoint_cyl.py \ - $(TEST_DIR)/test_adjoint_jax.py \ + $(TEST_DIR)/test_adjoint_jax.py TESTS = \ $(TEST_DIR)/test_3rd_harm_1d.py \ From fc730ffbd3532cb67bf2007bee10b2607a177b52 Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Wed, 25 Mar 2026 21:36:48 -0700 Subject: [PATCH 3/4] fix indentation --- python/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/Makefile.am b/python/Makefile.am index 2b78b4a61..0a22faf90 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -259,7 +259,7 @@ endif all-local: meep check-adjoint: - $(MAKE) check TESTS="$(ADJOINT_TESTS) $(TESTS)" + $(MAKE) check TESTS="$(ADJOINT_TESTS) $(TESTS)" clean-local: rm -rf meep __init__.py.bak From deb672c0c40e18b3b2855b81a707e568e7df89ea Mon Sep 17 00:00:00 2001 From: Ardavan Oskooi Date: Fri, 1 May 2026 21:23:39 -0700 Subject: [PATCH 4/4] add GitHub CI Actions workflow --- .github/workflows/build-ci-adjoint.yml | 116 +++++++++++++++++++++++++ python/Makefile.am | 2 +- 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-ci-adjoint.yml diff --git a/.github/workflows/build-ci-adjoint.yml b/.github/workflows/build-ci-adjoint.yml new file mode 100644 index 000000000..cbbe5c39f --- /dev/null +++ b/.github/workflows/build-ci-adjoint.yml @@ -0,0 +1,116 @@ +name: run adjoint tests + +on: + pull_request: + push: + schedule: + - cron: 0 22 * * 0 # run at 10 PM UTC every Sunday + workflow_dispatch: + +jobs: + build: + name: "serial double-precision adjoint tests" + runs-on: ubuntu-latest + + 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 + - run: | + echo "CPPFLAGS=${HDF5_BASE_CPPFLAGS}/serial ${CPPFLAGS}" >> $GITHUB_ENV + echo "LDFLAGS=${HDF5_BASE_LDFLAGS}/serial ${LDFLAGS}" >> $GITHUB_ENV + + - name: Install pre-compiled 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 libhdf5-serial-dev + + - name: Checkout libctl repository + uses: actions/checkout@v6 + with: + repository: NanoComp/libctl + path: libctl-src + + - name: Checkout harminv repository + uses: actions/checkout@v6 + with: + repository: NanoComp/harminv + path: harminv-src + + - name: Checkout MPB repository + uses: actions/checkout@v6 + with: + repository: NanoComp/mpb + path: mpb-src + + - name: Cache dependency builds + uses: actions/cache@v5 + id: deps-cache + with: + path: ~/local + key: deps-adjoint-${{ runner.os }}-${{ hashFiles('.github/workflows/build-ci-adjoint.yml') }} + + - name: Build and install libctl + if: steps.deps-cache.outputs.cache-hit != 'true' + run: cd libctl-src && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j $(nproc) && make install + + - name: Build and install harminv + if: steps.deps-cache.outputs.cache-hit != 'true' + run: cd harminv-src && sh autogen.sh --prefix=${HOME}/local --enable-shared && make -j $(nproc) && make install + + - name: Build and install MPB + if: steps.deps-cache.outputs.cache-hit != 'true' + run: cd mpb-src && sh autogen.sh --prefix=${HOME}/local --enable-shared LIBS=-ldl --with-libctl=${HOME}/local/share/libctl --with-hermitian-eps && make -j $(nproc) && make install + + - name: Checkout Meep repository + uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.11' + + - name: Get pip cache dir + id: pip-cache + run: | + python -m pip install --upgrade pip wheel + echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT + + - name: pip cache + uses: actions/cache@v5 + id: cache + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-py3.11-adjoint-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: ${{ runner.os }}-py3.11-adjoint-pip- + + - name: Install Python dependencies + run: pip install -r python/requirements.txt + + - name: Install nlopt + run: pip install nlopt + + - name: Run autoreconf + run: | + autoreconf --verbose --install --symlink --force + + - name: Run configure + run: | + ./configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl --without-mpi + + - name: Build meep + run: make -j $(nprocs) + + - name: Run adjoint tests + run: make -C python check-adjoint + + - name: Archive Python test logs + if: failure() + uses: actions/upload-artifact@v7 + with: + name: python-adjoint-tests-log + path: ${{ github.workspace }}/python/test-suite.log diff --git a/python/Makefile.am b/python/Makefile.am index 0a22faf90..df65a254b 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -259,7 +259,7 @@ endif all-local: meep check-adjoint: - $(MAKE) check TESTS="$(ADJOINT_TESTS) $(TESTS)" + $(MAKE) check TESTS="$(ADJOINT_TESTS)" clean-local: rm -rf meep __init__.py.bak