Skip to content
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

fix failing tests for GitHub Actions CI #1608

Merged
merged 20 commits into from
Jun 16, 2021

Conversation

oskooi
Copy link
Collaborator

@oskooi oskooi commented Jun 12, 2021

Initial attempt to eventually get all unit tests of the make check suite to pass on GitHub Actions CI (which was recently set up in #1596).

@oskooi
Copy link
Collaborator Author

oskooi commented Jun 12, 2021

According to the CI logs, there is a segmentation fault occurring for python/tests/test_mode_coeffs.py. I suspect this is probably related to the MPB library (v1.9 from June 2019) which is installed using the precompiled Ubuntu 20.04 package:

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

The fix likely involves installing MPB from source following a similar procedure to the one outlined in the user manual for Ubuntu 18.04.

@ahoenselaar
Copy link
Contributor

To keep the worfklow readable, we could set up a separate build process for MPB.
Ideally, it would build a package, e.g. in DEB format, that we can install during the setup for Meep's CI worklow.
https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows

@oskooi oskooi force-pushed the ci_fix_failing_tests branch from 7552b5e to a96dae3 Compare June 15, 2021 05:18
@oskooi
Copy link
Collaborator Author

oskooi commented Jun 16, 2021

Seems to be finally working. All unit tests for C++ and Python (3.6 and 3.9) for serial and MPI builds are passing. The unit tests are all executed as part of make distcheck which in turn calls make check from the root directory. We will probably want to modify this such that the Python unit tests are executed separately using pytest similar to what was originally set up in #1596. For now, this PR provides the minimum functionality necessary for CI.

@oskooi oskooi requested a review from ahoenselaar June 16, 2021 00:51
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can update-alternatives in conjunction with pkg-config not be used here?

(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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider the checkout action instead of cloning the full repo:
https://github.com/actions/checkout

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also just do a git clone --depth 1 (shallow clone).

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-j$(nproc) seems better than hardcoding

python-version: "3.6"
- name-prefix: "Python 3.9 with MPI"
enable-mpi: true
configure-options: "--with-mpi"
python-version: "3.9"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a true Cartesian product of MPI x Python version, you don't have to rely on include to build the four cases manually: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix

@stevengj
Copy link
Collaborator

Merging now since it is urgent to get CI working on other PRs, and this is in working state. Please open a separate PR with additional cleanups.

@stevengj stevengj merged commit 5230f19 into NanoComp:master Jun 16, 2021
@oskooi oskooi deleted the ci_fix_failing_tests branch June 16, 2021 02:22
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
* fix failing tests for GitHub Actions CI

* reduce tolerances for python/tests/test_mode_coeffs.py

* install libctl and MPB from source and use autogen.sh rather configure when building Meep

* run autogen.sh for libGDSII source repository

* add back libtool to common dependencies

* revamp matrix to include C++ and Python tests for serial and MPI

* use env context when defining environment variables in workflow file

* leave a space between curly brackets of workflow variables

* create workflow environment variables and explicitly define /home/oskooi directory

* define environment variables using an environment file for correct parsing

* escape double quotes to preserve spaces

* install dependencies before defining environment variables

* define GEN_CTL_IO env variable before building libctl from source

* separate step for mpi4py install

* fix configure option for Meep related to MPI

* replace out-of-tree with in-tree build

* run Python tests as a separate step and output logs at the end

* remove misplaced - from run lines in Output logs

* revert python/tests/test_mode_coeffs.py

* remove output logs step
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants