From 0030b3864eb77a90a9442904e7d64d1619c6add5 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Mon, 19 Oct 2020 08:57:47 -0600 Subject: [PATCH] TST, CI: add ARM64 Graviton 2 to CI (#2956) * 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 * 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?) * 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` --- .disabled-travis.yml | 25 +++++++++++++++++++ package/setup.py | 11 ++++++-- .../MDAnalysisTests/formats/test_libdcd.py | 7 ++++-- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.disabled-travis.yml b/.disabled-travis.yml index 8638059e0ab..1569758168d 100644 --- a/.disabled-travis.yml +++ b/.disabled-travis.yml @@ -111,6 +111,31 @@ jobs: 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" diff --git a/package/setup.py b/package/setup.py index e48e12c52e2..c5fc43675d9 100755 --- a/package/setup.py +++ b/package/setup.py @@ -268,8 +268,15 @@ def extensions(config): use_cython = config.get('use_cython', default=not is_release) use_openmp = config.get('use_openmp', default=True) - extra_compile_args = ['-std=c99', '-ffast-math', '-O3', '-funroll-loops', - '-fsigned-zeros'] # see #2722 + if platform.machine() == 'aarch64': + # reduce optimization level for ARM64 machines + # because of issues with test failures sourcing to: + # MDAnalysis/analysis/encore/clustering/src/ap.c + extra_compile_args = ['-std=c99', '-ffast-math', '-O1', '-funroll-loops', + '-fsigned-zeros'] + else: + extra_compile_args = ['-std=c99', '-ffast-math', '-O3', '-funroll-loops', + '-fsigned-zeros'] # see #2722 define_macros = [] if config.get('debug_cflags', default=False): extra_compile_args.extend(['-Wall', '-pedantic']) diff --git a/testsuite/MDAnalysisTests/formats/test_libdcd.py b/testsuite/MDAnalysisTests/formats/test_libdcd.py index 0028a80bd3b..240aee1a74e 100644 --- a/testsuite/MDAnalysisTests/formats/test_libdcd.py +++ b/testsuite/MDAnalysisTests/formats/test_libdcd.py @@ -22,6 +22,7 @@ import sys import string import struct +import platform import hypothesis.strategies as strategies from hypothesis import example, given @@ -317,8 +318,10 @@ def write_dcd(in_name, out_name, remarks='testing', header=None): f_out.write(xyz=frame.xyz, box=frame.unitcell) -@pytest.mark.xfail(os.name == 'nt' and sys.maxsize <= 2**32, - reason="occasional fail on 32-bit windows") +@pytest.mark.xfail((os.name == 'nt' + and sys.maxsize <= 2**32) or + platform.machine() == 'aarch64', + reason="occasional fail on 32-bit windows and ARM") @given(remarks=strategies.text( alphabet=string.printable, min_size=0, max_size=239)) # handle the printable ASCII strings