Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 41 additions & 22 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,35 @@ jobs:
matrix:
include:
- name: Linux (CUDA 13.0, Python 3.14, PyTorch 2.12)
os: ubuntu-22.04
os: ubuntu-24.04
env: ubuntu-24.04
cuda-version: "13.0"
gcc-version: "10.3.*"
nvcc-version: "13.0"
python-version: "3.14"
pytorch-version: "2.12.*"
opencl: true

- name: MacOS ARM (Python 3.11, PyTorch 2.4)
os: macos-latest
- name: Linux (HIP, Python 3.14, PyTorch 2.12)
os: ubuntu-24.04
env: ubuntu-24.04-hip
cuda-version: ""
gcc-version: ""
hip-version: "7"
gcc-version: "10.3.*"
nvcc-version: ""
python-version: "3.11"
pytorch-version: "2.4.*"
python-version: "3.14"
pytorch-version: "2.12.*"
opencl: false

- name: MacOS Intel (Python 3.13, PyTorch 2.5)
os: macos-15-intel
- name: MacOS ARM (Python 3.11, PyTorch 2.4)
os: macos-latest
env: macos-latest
cuda-version: ""
hip-version: ""
gcc-version: ""
nvcc-version: ""
python-version: "3.13"
pytorch-version: "2.5.*"
python-version: "3.11"
pytorch-version: "2.4.*"
opencl: false


Expand All @@ -60,7 +65,7 @@ jobs:
with:
cuda: ${{ matrix.cuda-version }}.0
linux-local-args: '["--toolkit", "--override"]'
if: startsWith(matrix.os, 'ubuntu')
if: matrix.cuda-version != ''

- name: "Install OpenCL on Ubuntu (if needed)"
if: matrix.opencl == true
Expand All @@ -70,6 +75,14 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
uses: jlumbroso/free-disk-space@main

- name: "Install HIP 7 on Linux (if needed)"
if: matrix.hip-version == '7'
run: |
wget https://repo.radeon.com/amdgpu-install/7.2.4/ubuntu/noble/amdgpu-install_7.2.4.70204-1_all.deb
sudo apt install ./amdgpu-install_7.2.4.70204-1_all.deb
sudo apt update

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an additional line is needed here to install ROCm. The amdgpu-install_7.2.4.70204-1_all.deb package they provide just adds some repositories to APT but doesn't install the libraries themselves: https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/quick-start.html#install-rocm

Suggested change
sudo apt update
sudo apt update
sudo apt install rocm

sudo apt install rocm

- name: "Install SDK on MacOS (if needed)"
run: source devtools/scripts/install_macos_sdk.sh
if: startsWith(matrix.os, 'macos')
Expand All @@ -79,7 +92,7 @@ jobs:
with:
tokenPrefix: '@'
tokenSuffix: '@'
files: devtools/conda-envs/build-${{ matrix.os }}.yml
files: devtools/conda-envs/build-${{ matrix.env }}.yml
env:
CUDATOOLKIT_VERSION: ${{ matrix.cuda-version }}
GCC_VERSION: ${{ matrix.gcc-version }}
Expand All @@ -90,7 +103,7 @@ jobs:
name: "Install dependencies with Mamba"
with:
activate-environment: build
environment-file: devtools/conda-envs/build-${{ matrix.os }}.yml
environment-file: devtools/conda-envs/build-${{ matrix.env }}.yml
miniforge-variant: Miniforge3
use-mamba: true
python-version: ${{ matrix.python-version }}
Expand All @@ -107,17 +120,20 @@ jobs:
run: |
mkdir build
cd build

SHLIB_EXT=".so"
if [[ ${{ matrix.os }} == macos-* ]]; then
SHLIB_EXT=".dylib"
fi

if [[ ${{ matrix.env }} == *hip ]]; then
export PYTORCH_ROCM_ARCH=gfx1201
export CXX=hipcc
fi
export SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DOPENMM_DIR=${CONDA_PREFIX} \
-DTorch_DIR=${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch/share/cmake/Torch \
-DCMAKE_INSTALL_PREFIX=${SITE_PACKAGES}/OpenMM.libs \
-DOPENMM_DIR=${SITE_PACKAGES}/OpenMM.libs \
-DTorch_DIR=${SITE_PACKAGES}/torch/share/cmake/Torch \
-DNN_BUILD_OPENCL_LIB=ON \
-DCUDAToolkit_ROOT="${{steps.cuda-toolkit.outputs.CUDA_PATH}}" \
-DCMAKE_CUDA_COMPILER="${{steps.cuda-toolkit.outputs.CUDA_PATH}}/bin/nvcc"
Expand All @@ -132,23 +148,26 @@ jobs:
- name: "List plugins"
shell: bash -l {0}
run: |
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch/lib:${LD_LIBRARY_PATH}"
export SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')
export LD_LIBRARY_PATH="${SITE_PACKAGES}/torch/lib:${SITE_PACKAGES}/OpenMM.libs/lib:${LD_LIBRARY_PATH}"
python -c "import openmm as mm; print('---Loaded---', *mm.pluginLoadedLibNames, '---Failed---', *mm.Platform.getPluginLoadFailures(), sep='\n')"

- name: "Run C++ test"
shell: bash -l {0}
run: |
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch/lib:${LD_LIBRARY_PATH}"
export SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')
export LD_LIBRARY_PATH="${SITE_PACKAGES}/torch/lib:${SITE_PACKAGES}/OpenMM.libs/lib:${LD_LIBRARY_PATH}"
cd build
if [[ ${{ matrix.opencl }} == true ]]; then
source /opt/intel/oneapi/setvars.sh
fi
ctest --output-on-failure --exclude-regex "TestCuda|TestOpenCL"
ctest --output-on-failure --exclude-regex "TestCuda|TestOpenCL|TestHip"

- name: "Run Python test"
shell: bash -l {0}
run: |
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib/python${{ matrix.python-version }}/site-packages/torch/lib:${LD_LIBRARY_PATH}"
export SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')
export LD_LIBRARY_PATH="${SITE_PACKAGES}/torch/lib:${SITE_PACKAGES}/OpenMM.libs/lib:${LD_LIBRARY_PATH}"
cd python/tests
if [[ ${{ matrix.opencl }} == true ]]; then
source /opt/intel/oneapi/setvars.sh
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# The version number is set here and copied to anywhere it is needed.
SET(OPENMM_TORCH_VERSION 1.5 CACHE STRING "The version of OpenMM-Torch that will be built." FORCE)

CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
CMAKE_MINIMUM_REQUIRED(VERSION 3.31)
PROJECT(OpenMM-Torch)

# We need to know where OpenMM is installed so we can access the headers and libraries.
SET(OPENMM_DIR "/usr/local/openmm" CACHE PATH "Where OpenMM is installed")
Expand Down Expand Up @@ -129,7 +130,7 @@ add_custom_target(CopyTestFiles ALL DEPENDS ${COPIED_TEST_FILES})
ADD_SUBDIRECTORY(platforms/reference)

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
FIND_PACKAGE(OpenCL QUIET)
FIND_PACKAGE(OPENCL QUIET)
IF(OPENCL_FOUND)
SET(NN_BUILD_OPENCL_LIB ON CACHE BOOL "Build implementation for OpenCL")
ELSE(OPENCL_FOUND)
Expand Down
13 changes: 0 additions & 13 deletions devtools/conda-envs/build-macos-15-intel.yml

This file was deleted.

5 changes: 3 additions & 2 deletions devtools/conda-envs/build-macos-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ dependencies:
- cmake
- compilers
- make
- openmm >=8.2
- pip
- pytest
- python
- pytorch-cpu @PYTORCH_VERSION@
- swig
- pip:
- openmm >= 8.5
- torch == @PYTORCH_VERSION@
17 changes: 17 additions & 0 deletions devtools/conda-envs/build-ubuntu-24.04-hip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: build
channels:
- conda-forge
dependencies:
- cmake
- gxx_linux-64 @GCC_VERSION@
- make
- pip
- pytest
- python
- swig
- sysroot_linux-64 2.17
- libxcrypt
- pip:
- --extra-index-url https://download.pytorch.org/whl/rocm7.2
- openmm[hip7] >=8.5
- torch == @PYTORCH_VERSION@
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ channels:
- conda-forge
dependencies:
- cmake
- cuda-version @CUDATOOLKIT_VERSION@
- gxx_linux-64 @GCC_VERSION@
- make
- nnpops
- ocl-icd
- openmm >=8.1
- pip
- pytest
- python
- pytorch-gpu @PYTORCH_VERSION@
- swig
- sysroot_linux-64 2.17
- torchani
- libxcrypt
- pip:
- openmm[cuda13] >= 8.5
- torch == @PYTORCH_VERSION@
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ add_custom_target(PythonInstall DEPENDS "${WRAP_FILE}" "${CMAKE_CURRENT_SOURCE_
set(NN_PLUGIN_HEADER_DIR "${CMAKE_SOURCE_DIR}/openmmapi/include")
set(NN_PLUGIN_LIBRARY_DIR "${CMAKE_BINARY_DIR}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
add_custom_command(TARGET PythonInstall
add_custom_command(TARGET PythonInstall POST_BUILD
COMMAND "${PYTHON_EXECUTABLE}" -m pip install .
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
Loading