|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - "master" |
| 10 | + schedule: |
| 11 | + # Nightly tests run on master by default: |
| 12 | + # Scheduled workflows run on the latest commit on the default or base branch. |
| 13 | + # (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) |
| 14 | + - cron: "0 0 * * *" |
| 15 | + |
| 16 | + |
| 17 | +jobs: |
| 18 | + unix: |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + name: ${{ matrix.name }} |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + include: |
| 25 | + - name: Linux CPU CUDA 10.0 Python 3.6 |
| 26 | + python-version: "3.6" |
| 27 | + os: ubuntu-latest |
| 28 | + gcc-version: "9" |
| 29 | + cuda-version: "10.0" |
| 30 | + cdt-name: cos6 # cuda 11+ requires cos7 |
| 31 | + CMAKE_FLAGS: | |
| 32 | + -DNN_BUILD_CUDA_LIB=ON \ |
| 33 | + -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \ |
| 34 | + -DEXTRA_COMPILE_FLAGS="-L/usr/local/cuda/lib64/stubs -Wl,-rpath,/usr/local/cuda/lib64/stubs -Wl,-rpath-link,/usr/local/cuda/lib64/stubs" |
| 35 | +
|
| 36 | + - name: MacOS Intel CPU Python 3.9 |
| 37 | + python-version: "3.9" |
| 38 | + os: macos-latest |
| 39 | + cuda-version: "" |
| 40 | + CMAKE_FLAGS: "" |
| 41 | + |
| 42 | + |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v2 |
| 45 | + |
| 46 | + - name: "Patch conda env (if needed)" |
| 47 | + if: startsWith(matrix.os, 'ubuntu') |
| 48 | + run: | |
| 49 | + sed -i -e "s/@CDT_NAME@/${{ matrix.cdt-name }}/g" \ |
| 50 | + -e "s/@GCC_VERSION@/${{ matrix.gcc-version }}.*/g" \ |
| 51 | + -e "s/@CUDATOOLKIT_VERSION@/${{ matrix.cuda-version }}.*/g" \ |
| 52 | + devtools/conda-envs/build-${{ matrix.os }}.yml |
| 53 | +
|
| 54 | + - uses: conda-incubator/setup-miniconda@v2 |
| 55 | + name: "Prepare base dependencies" |
| 56 | + with: |
| 57 | + python-version: ${{ matrix.python-version }} |
| 58 | + activate-environment: build |
| 59 | + environment-file: devtools/conda-envs/build-${{ matrix.os }}.yml |
| 60 | + auto-activate-base: false |
| 61 | + channels: conda-forge |
| 62 | + |
| 63 | + - name: "Install CUDA on Ubuntu (if needed)" |
| 64 | + if: matrix.cuda-version != '' |
| 65 | + env: |
| 66 | + CUDA_VERSION: ${{ matrix.cuda-version }} |
| 67 | + run: source devtools/scripts/install_cuda.sh |
| 68 | + |
| 69 | + - name: "Set SDK on MacOS (if needed)" |
| 70 | + if: startsWith(matrix.os, 'macos') |
| 71 | + run: source devtools/scripts/install_macos_sdk.sh |
| 72 | + |
| 73 | + - name: "Conda info" |
| 74 | + shell: bash -l {0} |
| 75 | + run: | |
| 76 | + conda info -a |
| 77 | + conda list |
| 78 | +
|
| 79 | + - name: "Configure build with CMake" |
| 80 | + shell: bash -l {0} |
| 81 | + run: | |
| 82 | + mkdir build |
| 83 | + cd build |
| 84 | +
|
| 85 | + SHLIB_EXT=".so" |
| 86 | + if [[ ${{ matrix.os }} == macos-* ]]; then |
| 87 | + SHLIB_EXT=".dylib" |
| 88 | + fi |
| 89 | +
|
| 90 | + cmake .. \ |
| 91 | + -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \ |
| 92 | + -DCMAKE_PREFIX_PATH=${CONDA_PREFIX} \ |
| 93 | + -DCMAKE_BUILD_TYPE=Release \ |
| 94 | + -DOPENMM_DIR=${CONDA_PREFIX} \ |
| 95 | + -DPYTORCH_DIR=${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch \ |
| 96 | + -DTorch_DIR=${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch/share/cmake/Torch \ |
| 97 | + -DNN_BUILD_OPENCL_LIB=ON \ |
| 98 | + -DOPENCL_INCLUDE_DIR=${CONDA_PREFIX}/include \ |
| 99 | + -DOPENCL_LIBRARY=${CONDA_PREFIX}/lib/libOpenCL${SHLIB_EXT} \ |
| 100 | + ${{ matrix.CMAKE_FLAGS }} |
| 101 | +
|
| 102 | + - name: "Build" |
| 103 | + shell: bash -l {0} |
| 104 | + run: | |
| 105 | + cd build |
| 106 | + make -j2 install |
| 107 | + make -j2 PythonInstall |
| 108 | +
|
| 109 | + - name: "Plugin information" |
| 110 | + shell: bash -l {0} |
| 111 | + run: | |
| 112 | + export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch/lib:${LD_LIBRARY_PATH}" |
| 113 | + python -c "import simtk.openmm as mm; print('---Loaded---', *mm.pluginLoadedLibNames, '---Failed---', *mm.Platform.getPluginLoadFailures(), sep='\n')" |
| 114 | +
|
| 115 | + - name: "Test C++" |
| 116 | + shell: bash -l {0} |
| 117 | + run: | |
| 118 | + export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch/lib:${LD_LIBRARY_PATH}" |
| 119 | + cd build |
| 120 | + set +e |
| 121 | + summary="" |
| 122 | + exitcode=0 |
| 123 | + for f in Test*; do |
| 124 | + echo "::group::$f" |
| 125 | + summary+="\n${f}: " |
| 126 | + if [[ $f == *Cuda* ]]; then |
| 127 | + echo "Skipping $f..." |
| 128 | + summary+="Skipped" |
| 129 | + echo "::endgroup::" |
| 130 | + continue |
| 131 | + fi |
| 132 | + echo "Running $f..." |
| 133 | + ./${f} |
| 134 | + thisexitcode=$? |
| 135 | + if [[ $thisexitcode == 0 ]]; then summary+="OK"; else summary+="FAILED"; fi |
| 136 | + ((exitcode+=$thisexitcode)) |
| 137 | + echo "::endgroup::" |
| 138 | + done |
| 139 | + echo "-------" |
| 140 | + echo "Summary" |
| 141 | + echo "-------" |
| 142 | + echo -e "${summary}" |
| 143 | + exit $exitcode |
| 144 | +
|
| 145 | + - name: "Test Python" |
| 146 | + shell: bash -l {0} |
| 147 | + run: | |
| 148 | + export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch/lib:${LD_LIBRARY_PATH}" |
| 149 | + cd python/tests |
| 150 | + python -m pytest -v Test* |
0 commit comments