From 3f589e375434fd6a9b16c7da2cb1342cc3088b0e Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Sat, 13 Mar 2021 19:46:16 +0000 Subject: [PATCH] [MAINT] (re)-enabling CI for non-x86 archs and ppc64le support (#3149) Partially fixes #1389 and #3127 # Work done in this PR - Adds basic support for ppc64le - Adds encore specific C compiler args to reduce optimisations in non-x86 systems - Enables travis cron CI for aarch64 and ppc64le --- .travis.yml | 60 +++++++++++++++++++++++++++++++++++++++++++++++ package/CHANGELOG | 4 ++++ package/setup.py | 26 ++++++++++---------- 3 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..3be2f063d1b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,60 @@ +version: ~> 1.0 +language: generic +group: travis_latest + +# Only build for develop +branches: + only: + - develop + +matrix: + fast_finish: true + include: + - python: 3.8 + name: "Power PC" + os: linux + arch: ppc64le + if: type = cron + before_install: + - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-ppc64le.sh -O miniconda.sh + - mkdir $HOME/.conda + - bash miniconda.sh -b -p $HOME/miniconda + - $HOME/miniconda/bin/conda init bash + # for some reason the image does not like sourcing .bashrc + - . "/home/travis/miniconda/etc/profile.d/conda.sh" + - conda activate base + - conda update --yes conda + - conda install --yes pip pytest==6.1.2 mmtf-python biopython networkx cython matplotlib-base "scipy>=1.6" griddataformats hypothesis gsd codecov -c conda-forge -c biobuilds + - pip install pytest-xdist + - conda info + install: + - (cd package/ && python setup.py develop) && (cd testsuite/ && python setup.py install) + script: + - pytest testsuite/MDAnalysisTests --disable-pytest-warnings -n 2 + after_sucess: + - echo "Override this stage for now" + + - os: linux + language: python + arch: arm64-graviton2 + python: 3.8 + name: "ARM64" + dist: focal + virt: vm + group: edge + if: type = cron + before_install: + - python -m pip install cython numpy scipy + - 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" + diff --git a/package/CHANGELOG b/package/CHANGELOG index 2a652304a99..7fa27bb5178 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -84,6 +84,8 @@ Fixes * Fix syntax warning over comparison of literals using is (Issue #3066) Enhancements + * Adds preliminary support for the ppc64le platform with minimal + dependencies (Issue #3127, PR #3149) * Caches can now undergo central validation at the Universe level, opening the door to more useful caching. Already applied to fragment caching (Issue #2376, PR #3135) @@ -131,6 +133,8 @@ Enhancements explicit in the topology (Issue #2468, PR #2775) Changes + * Introduces encore specific C compiler arguments to allow for lowering of + optimisations on non-x86 platforms (Issue #1389, PR #3149) * Continuous integration uses mamba rather than conda to install the dependencies (PR #2983) * removes deprecated `as_Universe` function from MDAnalysis.core.universe, diff --git a/package/setup.py b/package/setup.py index 3b4cf2f8674..474b6ff2eda 100755 --- a/package/setup.py +++ b/package/setup.py @@ -261,15 +261,8 @@ def extensions(config): use_cython = config.get('use_cython', default=not is_release) use_openmp = config.get('use_openmp', default=True) - 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 + 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']) @@ -281,6 +274,15 @@ def extensions(config): if arch: extra_compile_args.append('-march={}'.format(arch)) + # encore is sensitive to floating point accuracy, especially on non-x86 + # to avoid reducing optimisations on everything, we make a set of compile + # args specific to encore see #2997 for an example of this. + encore_compile_args = [a for a in extra_compile_args if 'O3' not in a] + if platform.machine() == 'aarch64' or platform.machine() == 'ppc64le': + encore_compile_args.append('-O1') + else: + encore_compile_args.append('-O3') + cpp_extra_compile_args = [a for a in extra_compile_args if 'std' not in a] cpp_extra_compile_args.append('-std=c++11') cpp_extra_link_args=[] @@ -401,21 +403,21 @@ def extensions(config): sources=['MDAnalysis/analysis/encore/cutils' + source_suffix], include_dirs=include_dirs, define_macros=define_macros, - extra_compile_args=extra_compile_args) + extra_compile_args=encore_compile_args) ap_clustering = MDAExtension('MDAnalysis.analysis.encore.clustering.affinityprop', sources=['MDAnalysis/analysis/encore/clustering/affinityprop' + source_suffix, 'MDAnalysis/analysis/encore/clustering/src/ap.c'], include_dirs=include_dirs+['MDAnalysis/analysis/encore/clustering/include'], libraries=mathlib, define_macros=define_macros, - extra_compile_args=extra_compile_args) + extra_compile_args=encore_compile_args) spe_dimred = MDAExtension('MDAnalysis.analysis.encore.dimensionality_reduction.stochasticproxembed', sources=['MDAnalysis/analysis/encore/dimensionality_reduction/stochasticproxembed' + source_suffix, 'MDAnalysis/analysis/encore/dimensionality_reduction/src/spe.c'], include_dirs=include_dirs+['MDAnalysis/analysis/encore/dimensionality_reduction/include'], libraries=mathlib, define_macros=define_macros, - extra_compile_args=extra_compile_args) + extra_compile_args=encore_compile_args) nsgrid = MDAExtension('MDAnalysis.lib.nsgrid', ['MDAnalysis/lib/nsgrid' + cpp_source_suffix], include_dirs=include_dirs,