Skip to content

Commit

Permalink
Attempts at fixing CI (#144)
Browse files Browse the repository at this point in the history
* Try to fix CI on Linux

* Don't install POCL on Mac

* Don't install khronos-opencl-icd-loader

* Update OpenMM version

* Updated tested versions

* Fixed version number

* Install correct packages for CUDA 12

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Try different method of installing CUDA

* Try not installing CUDA packages from conda

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Don't build OpenCL on Mac

* Don't try to run tests that can't run correctly

* Update C++ version and minimum macOS version

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Fixed working directory for tests

* Fixes to testing

* Try using PyTorch 2.3

* Try using PyTorch 2.2

* Switch back to PyTorch 2.1
  • Loading branch information
peastman authored May 27, 2024
1 parent e17b5d0 commit d447643
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 27 deletions.
43 changes: 28 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,13 @@ jobs:
fail-fast: false
matrix:
include:
# Oldest supported versions
# NOTE: renable CUDA 10.2 when it supported by NNPOps (https://github.com/conda-forge/nnpops-feedstock/pull/8)
- name: Linux (CUDA 11.0, Python 3.7, PyTorch 1.11)
os: ubuntu-22.04
cuda-version: "11.0.3"
gcc-version: "8.5.*"
nvcc-version: "11.0"
python-version: "3.7"
pytorch-version: "1.11.*"

# Latest supported versions
- name: Linux (CUDA 11.8, Python 3.10, PyTorch 2.0)
- name: Linux (CUDA 11.8, Python 3.10, PyTorch 2.1)
os: ubuntu-22.04
cuda-version: "11.8.0"
gcc-version: "10.3.*"
nvcc-version: "11.8"
python-version: "3.10"
pytorch-version: "2.0.*"
pytorch-version: "2.1.*"

- name: MacOS (Python 3.9, PyTorch 1.9)
os: macos-11
Expand All @@ -55,12 +44,36 @@ jobs:
uses: actions/checkout@v2

- name: "Install CUDA Toolkit on Linux (if needed)"
uses: Jimver/[email protected].10
uses: Jimver/[email protected].15
with:
cuda: ${{ matrix.cuda-version }}
linux-local-args: '["--toolkit", "--override"]'
if: startsWith(matrix.os, 'ubuntu')

- name: Manage disk space
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo mkdir -p /opt/empty_dir || true
for d in \
/opt/ghc \
/opt/hostedtoolcache \
/usr/lib/jvm \
/usr/local/.ghcup \
/usr/local/lib/android \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift \
; do
sudo rsync --stats -a --delete /opt/empty_dir/ $d || true
done
sudo apt-get purge -y -f firefox \
google-chrome-stable \
microsoft-edge-stable
sudo apt-get autoremove -y >& /dev/null
sudo apt-get autoclean -y >& /dev/null
sudo docker image prune --all --force
df -h
- name: "Install SDK on MacOS (if needed)"
run: source devtools/scripts/install_macos_sdk.sh
if: startsWith(matrix.os, 'macos')
Expand Down Expand Up @@ -130,7 +143,7 @@ jobs:
run: |
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch/lib:${LD_LIBRARY_PATH}"
cd build
ctest --output-on-failure --exclude-regex TestCuda
ctest --output-on-failure --exclude-regex "TestCuda|TestOpenCL"
- name: "Run Python test"
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SET(CMAKE_PREFIX_PATH "${PYTORCH_DIR}")
FIND_PACKAGE(Torch REQUIRED)

# Specify the C++ version we are building for.
SET (CMAKE_CXX_STANDARD 14)
SET (CMAKE_CXX_STANDARD 17)

# Set flags for linking on mac
IF(APPLE)
Expand Down
4 changes: 1 addition & 3 deletions devtools/conda-envs/build-macos-11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ channels:
dependencies:
- cmake
- compilers
- khronos-opencl-icd-loader
- make
- openmm >=7.7
- openmm >=8.1
- pip
- pocl
- pytest
- python
- pytorch-cpu @PYTORCH_VERSION@
Expand Down
3 changes: 2 additions & 1 deletion devtools/conda-envs/build-ubuntu-22.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- nnpops
- nvcc_linux-64 @NVCC_VERSION@
- ocl-icd
- openmm >=7.7
- openmm >=8.1
- pip
- pocl
- pytest
Expand All @@ -18,3 +18,4 @@ dependencies:
- swig
- sysroot_linux-64 2.17
- torchani
- libxcrypt
6 changes: 3 additions & 3 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
torch_dir, _ = os.path.split('@TORCH_LIBRARY@')

# setup extra compile and link arguments on Mac
extra_compile_args = ['-std=c++14']
extra_compile_args = ['-std=c++17']
extra_link_args = []

if platform.system() == 'Darwin':
extra_compile_args += ['-stdlib=libc++', '-mmacosx-version-min=10.7']
extra_link_args += ['-stdlib=libc++', '-mmacosx-version-min=10.7', '-Wl', '-rpath', openmm_dir+'/lib', '-rpath', torch_dir]
extra_compile_args += ['-stdlib=libc++', '-mmacosx-version-min=10.13']
extra_link_args += ['-stdlib=libc++', '-mmacosx-version-min=10.13', '-Wl', '-rpath', openmm_dir+'/lib', '-rpath', torch_dir]

extension = Extension(name='_openmmtorch',
sources=['TorchPluginWrapper.cpp'],
Expand Down
8 changes: 5 additions & 3 deletions python/tests/TestTorchForce.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def testConstructors(model_file):
('../../tests/forces.pt', True, False),
('../../tests/forces.pt', True, True)])
@pytest.mark.parametrize('use_cv_force', [True, False])
@pytest.mark.parametrize('platform', ['Reference', 'CPU', 'CUDA', 'OpenCL'])
@pytest.mark.parametrize('platform', [mm.Platform.getPlatform(i).getName() for i in range(mm.Platform.getNumPlatforms())])
def testForce(model_file, output_forces, use_module_constructor, use_cv_force, platform):

if pt.cuda.device_count() < 1 and platform == 'CUDA':
Expand Down Expand Up @@ -54,8 +54,10 @@ def testForce(model_file, output_forces, use_module_constructor, use_cv_force, p

# Compute the forces and energy.
integ = mm.VerletIntegrator(1.0)
platform = mm.Platform.getPlatformByName(platform)
context = mm.Context(system, integ, platform)
try:
context = mm.Context(system, integ, mm.Platform.getPlatformByName(platform))
except:
pytest.skip(f'Unable to create Context with {platform}')
context.setPositions(positions)
state = context.getState(getEnergy=True, getForces=True)

Expand Down
2 changes: 1 addition & 1 deletion serialization/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ FOREACH(TEST_PROG ${TEST_PROGS})
ADD_EXECUTABLE(${TEST_ROOT} ${TEST_PROG})
TARGET_LINK_LIBRARIES(${TEST_ROOT} ${SHARED_NN_TARGET})
SET_TARGET_PROPERTIES(${TEST_ROOT} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS}")
ADD_TEST(${TEST_ROOT} ${EXECUTABLE_OUTPUT_PATH}/${TEST_ROOT})
ADD_TEST(NAME "${TEST_ROOT}" COMMAND "${EXECUTABLE_OUTPUT_PATH}/${TEST_ROOT}" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")

ENDFOREACH(TEST_PROG ${TEST_PROGS})

0 comments on commit d447643

Please sign in to comment.