From c78e9608515921f7f92ddd0b4d9db474c1be0e25 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Sat, 26 Sep 2020 17:24:29 -0600 Subject: [PATCH 1/3] TST, CI: add ARM64 Graviton 2 to CI * start testing MDAnalysis on ARM64 using new AWS Graviton 2 architecture available in Travis CI * testing on my fork shows only two failures in the MDAnalysis test suite using a fairly minimal set of dependencies; we can probably either fix those or skip them and open an issue * the test failures are: `test_written_remarks_property` `TestEncoreClustering.test_clustering_three_ensembles_two_identical` * run time for this CI entry is about 23 minutes, which is solid for ARM; we save a lot of time using experimental upstream wheels in some cases and excluding (source builds of) dependencies where possible until the ARM64 binary wheel ecosystem matures a bit more --- .travis.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.travis.yml b/.travis.yml index bf09b8efadd..4929705f162 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,6 +96,31 @@ matrix: INSTALL_HOLE="false" CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + - os: linux + language: python + arch: arm64-graviton2 + python: + - "3.7" + dist: focal + virt: vm + group: edge + before_install: + - python -m pip install cython numpy + # special test SciPy wheel for ARM64: + - python -m pip install https://anaconda.org/multibuild-wheels-staging/scipy/1.6.0.dev0+a240c17/download/scipy-1.6.0.dev0+a240c17-cp37-cp37m-manylinux2014_aarch64.whl + - python -m pip install --no-build-isolation hypothesis matplotlib pytest pytest-cov pytest-xdist tqdm + install: + - cd package + - python setup.py install + - cd ../testsuite + - python setup.py install + - cd .. + script: + - cd testsuite + - python -m pytest ./MDAnalysisTests --disable-pytest-warnings -n 8 -rsx --cov=MDAnalysis + after_success: + - echo "Override this stage for ARM64" + allow_failures: - env: NUMPY_VERSION=dev EVENT_TYPE="cron" From 2b9bd0efbce75eebec74b6e3d83a65ff9f581c17 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Tue, 13 Oct 2020 19:45:35 -0700 Subject: [PATCH 2/3] MAINT: ARM64 shims * adjust `CAffinityPropagation()` C-level function to use `double` instead of `float` in some strategic locations that allow the `test_clustering_three_ensembles_two_identical()` test to pass on gcc115 ARM64 machine * mark `test_written_remarks_property()` as a known failure on ARM64; it fails in Travis CI on that platform, but not on gcc115 ARM64 machine; that said, this test is already known to be flaky on Windows 32-bit (may depend on character settings on machine?) --- package/MDAnalysis/analysis/encore/clustering/src/ap.c | 8 ++++---- testsuite/MDAnalysisTests/formats/test_libdcd.py | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package/MDAnalysis/analysis/encore/clustering/src/ap.c b/package/MDAnalysis/analysis/encore/clustering/src/ap.c index 6f42037dce7..dcb857c7192 100644 --- a/package/MDAnalysis/analysis/encore/clustering/src/ap.c +++ b/package/MDAnalysis/analysis/encore/clustering/src/ap.c @@ -104,19 +104,19 @@ int CAffinityPropagation(float *s, int n, float lambda, int max_iterations, int int sqm_idx = 0; // index for square matrix int currit = 0; // current iteration number int conv_count = 0; // number of iterations with constant centroids so far - float tmpsum = 0.0, maxsim = 0.0, this_tmpsum = 0.0; // accumulators - float tmp = 0.0; // temporary value + double tmpsum = 0.0, maxsim = 0.0, this_tmpsum = 0.0; // accumulators + double tmp = 0.0; // temporary value float max1 = 0; float max2 = 0; int conv_reached = 0; // convergence flag int has_cluster = 0; // found clusters flag - float lamprev = 1.0 - lambda; // 1-lambda + double lamprev = 1.0 - lambda; // 1-lambda int n_clusters = 0; // number of clusters if (noise != 0) { // Add noise to data for (int i=0;i Date: Sun, 18 Oct 2020 16:46:38 -0700 Subject: [PATCH 3/3] MAINT: MR 2956 revisions * reduce optimization level of MDAnalysis builds on ARM64 to avoid problems with `ap.c` causing test failures on that architecture * revert any source changes to `ap.c` --- .../MDAnalysis/analysis/encore/clustering/src/ap.c | 8 ++++---- package/setup.py | 11 +++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/package/MDAnalysis/analysis/encore/clustering/src/ap.c b/package/MDAnalysis/analysis/encore/clustering/src/ap.c index dcb857c7192..6f42037dce7 100644 --- a/package/MDAnalysis/analysis/encore/clustering/src/ap.c +++ b/package/MDAnalysis/analysis/encore/clustering/src/ap.c @@ -104,19 +104,19 @@ int CAffinityPropagation(float *s, int n, float lambda, int max_iterations, int int sqm_idx = 0; // index for square matrix int currit = 0; // current iteration number int conv_count = 0; // number of iterations with constant centroids so far - double tmpsum = 0.0, maxsim = 0.0, this_tmpsum = 0.0; // accumulators - double tmp = 0.0; // temporary value + float tmpsum = 0.0, maxsim = 0.0, this_tmpsum = 0.0; // accumulators + float tmp = 0.0; // temporary value float max1 = 0; float max2 = 0; int conv_reached = 0; // convergence flag int has_cluster = 0; // found clusters flag - double lamprev = 1.0 - lambda; // 1-lambda + float lamprev = 1.0 - lambda; // 1-lambda int n_clusters = 0; // number of clusters if (noise != 0) { // Add noise to data for (int i=0;i