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

Fix and improve CI #56

Merged
merged 7 commits into from
May 24, 2022
Merged
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
53 changes: 32 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,40 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
# Run every Sunday at midnight
- cron: '0 0 * * 0'

defaults:
run:
shell: bash -l {0}

jobs:
build:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
include:
# Oldest supported versions
- enable_cuda: true
cuda: 10.2.89
gcc: 8.5.0
nvcc: 10.2
python: 3.8
pytorch: 1.8.0
cuda: "10.2.89"
gcc: "8.5.0"
nvcc: "10.2"
python: "3.7"
pytorch: "1.11.0"
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean we're no longer trying to support any version before 1.11?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, only PyTorch 1.11. conda-forge has pinned the version of PyTorch (conda-forge/conda-forge-pinning-feedstock#2812), so there will be no more packages for the older versions.

# Latest supported versions
- enable_cuda: true
cuda: 11.2.2
gcc: 10.3.0
nvcc: 11.2
python: 3.9
pytorch: 1.10.0
cuda: "11.2.2"
gcc: "10.3.0"
nvcc: "11.2"
python: "3.10"
pytorch: "1.11.0"
# Without CUDA
- enable_cuda: false
gcc: 10.3.0
python: 3.9
pytorch: 1.10.0
gcc: "10.3.0"
python: "3.10"
pytorch: "1.11.0"

steps:
- name: Check out
Expand All @@ -50,33 +58,37 @@ jobs:
miniforge-variant: Miniforge3

- name: Prepare dependencies (with CUDA)
shell: bash -l {0}
if: ${{ matrix.enable_cuda }}
run: |
sed -i -e "/cudatoolkit/c\ - cudatoolkit ${{ matrix.cuda }}" \
-e "/gxx_linux-64/c\ - gxx_linux-64 ${{ matrix.gcc }}" \
-e "/nvcc_linux-64/c\ - nvcc_linux-64 ${{ matrix.nvcc }}" \
-e "/python/c\ - python ${{ matrix.python }}" \
-e "/python/c\ - python ${{ matrix.python }}.*" \
-e "/pytorch-gpu/c\ - pytorch-gpu ${{ matrix.pytorch }}" \
environment.yml

- name: Prepare dependencies (without CUDA)
shell: bash -l {0}
if: ${{ !matrix.enable_cuda }}
run: |
sed -i -e "/cudatoolkit/c\ # - cudatoolkit" \
-e "/gxx_linux-64/c\ - gxx_linux-64 ${{ matrix.gcc }}" \
-e "/nvcc_linux-64/c\ # - nvcc_linux-64" \
-e "/python/c\ - python ${{ matrix.python }}" \
-e "/python/c\ - python ${{ matrix.python }}.*" \
-e "/pytorch-gpu/c\ - pytorch-cpu ${{ matrix.pytorch }}" \
environment.yml

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

- name: Install dependencies
shell: bash -l {0}
run: conda env create -n nnpops -f environment.yml

- name: List conda environment
run: |
conda activate nnpops
conda list

- name: Configure, compile, and install
shell: bash -l {0}
run: |
conda activate nnpops
mkdir build && cd build
Expand All @@ -87,8 +99,7 @@ jobs:
make install

- name: Test
shell: bash -l {0}
run: |
conda activate nnpops
cd build
ctest --verbose --exclude-regex TestCuda
ctest --verbose --exclude-regex TestCuda
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ set(SRC_FILES src/ani/CpuANISymmetryFunctions.cpp
# Build the library
set(LIBRARY ${NAME}PyTorch)
add_library(${LIBRARY} SHARED ${SRC_FILES})
set_property(TARGET ${LIBRARY} PROPERTY CXX_STANDARD 14)
target_include_directories(${LIBRARY} PRIVATE src/ani src/schnet)
target_link_libraries(${LIBRARY} ${TORCH_LIBRARIES} ${PYTHON_LIBRARIES})
if(ENABLE_CUDA)
set_property(TARGET ${LIBRARY} PROPERTY CUDA_STANDARD 14)
target_compile_definitions(${LIBRARY} PRIVATE ENABLE_CUDA)
endif(ENABLE_CUDA)

# Test of the library
# Tests of the library
set(TEST_PATHS src/ani/TestCpuANISymmetryFunctions.cpp
src/schnet/TestCpuCFConv.cpp)
if(ENABLE_CUDA)
Expand All @@ -43,6 +45,10 @@ endif(ENABLE_CUDA)
foreach(TEST_PATH ${TEST_PATHS})
cmake_path(GET TEST_PATH STEM TEST_NAME)
add_executable(${TEST_NAME} ${TEST_PATH})
set_property(TARGET ${TEST_NAME} PROPERTY CXX_STANDARD 14)
if(ENABLE_CUDA)
set_property(TARGET ${TEST_NAME} PROPERTY CUDA_STANDARD 14)
endif(ENABLE_CUDA)
target_link_libraries(${TEST_NAME} ${LIBRARY})
add_test(${TEST_NAME} ${TEST_NAME})
endforeach()
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ dependencies:
- nvcc_linux-64 11.2
- torchani 2.2.2
- pytest
- python 3.9
- pytorch-gpu 1.10.0
- python 3.10.*
- pytorch-gpu 1.11.0
- sysroot_linux-64 2.17