Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OSX Support #115

Closed
wants to merge 10 commits into from
Closed
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
28 changes: 26 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ defaults:

jobs:
build:
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:

# Oldest supported versions
- name: Linux (CUDA 10.2, Python 3.8, PyTorch 1.11)
os: ubuntu-22.04
enable_cuda: true
cuda: "10.2.89"
gcc: "8.5.*"
Expand All @@ -34,6 +35,7 @@ jobs:

# Older supported versions
- name: Linux (CUDA 11.2, Python 3.9, PyTorch 1.12)
os: ubuntu-22.04
enable_cuda: true
cuda: "11.2.2"
gcc: "10.3.*"
Expand All @@ -44,6 +46,7 @@ jobs:

# Latest supported versions (with CUDA)
- name: Linux (CUDA 11.8, Python 3.10, PyTorch 2.0)
os: ubuntu-22.04
enable_cuda: true
cuda: "11.8.0"
gcc: "10.3.*"
Expand All @@ -54,12 +57,20 @@ jobs:

# Latest supported versions (without CUDA)
- name: Linux (no CUDA, Python 3.10, PyTorch 2.0)
os: ubuntu-22.04
enable_cuda: false
gcc: "10.3.*"
python: "3.10.*"
pytorch: "2.0.*"
torchani: "2.2.*"

# Intel Mac
- name: Mac Intel (no CUDA, Python 3.10, PyTorch 2.0)
os: macos-latest
enable_cuda: false
python: "3.10"
pytorch: "2.0.*"

steps:
- name: Check out
uses: actions/checkout@v2
Expand Down Expand Up @@ -90,7 +101,7 @@ jobs:
environment.yml

- name: Prepare dependencies (without CUDA)
if: ${{ !matrix.enable_cuda }}
if: ${{ contains(matrix.os, 'ubuntu') && !matrix.enable_cuda }}
run: |
sed -i -e "/cudatoolkit/c\ # - cudatoolkit" \
-e "/gxx_linux-64/c\ - gxx_linux-64 ${{ matrix.gcc }}" \
Expand All @@ -100,6 +111,19 @@ jobs:
-e "/pytorch-gpu/c\ - pytorch-cpu ${{ matrix.pytorch }}" \
environment.yml

- name: Prepare dependencies (Mac)
if: ${{ contains(matrix.os, 'macos') }}
run: |
sed -i '' -e "/- cudatoolkit/d" \
-e "/- gxx_linux-64/d" \
Copy link
Contributor

Choose a reason for hiding this comment

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

You dont need to install some version of gxx for Mac?

-e "/- nvcc_linux-64/d" \
-e "/- sysroot_linux-64/d" \
-e "s/- python 3.10.\*/- python ${{ matrix.python }}.*/" \
-e "s/- pytorch-gpu 2.0.\*/- pytorch-cpu ${{ matrix.pytorch }}/" \
environment.yml

echo " - compilers" >> environment.yml

- name: Show dependency file
run: cat environment.yml

Expand Down
8 changes: 7 additions & 1 deletion src/pytorch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
'''
import os.path
import torch
from torch.utils.cpp_extension import IS_WINDOWS, IS_MACOS, LIB_EXT

torch.ops.load_library(os.path.join(os.path.dirname(__file__), 'libNNPOpsPyTorch.so'))
# by default torch assumes OSX has a .so ext, so we need to override
_LIBRARY_SUFFIX = LIB_EXT if not IS_MACOS else ".dylib"
_LIBRARY_PREFIX = '' if IS_WINDOWS else "lib"
_LIBRARY_NAME = f'{_LIBRARY_PREFIX}NNPOpsPyTorch{_LIBRARY_SUFFIX}'

torch.ops.load_library(os.path.join(os.path.dirname(__file__), _LIBRARY_NAME))


from NNPOps.OptimizedTorchANI import OptimizedTorchANI
Loading