Skip to content

Commit

Permalink
Fix nightly tests (#142)
Browse files Browse the repository at this point in the history
* install pytorch before dgl?

* check dgl is broken pre-repo install [skip ci]

* add a pip list to see whats installed

* switch to pip install [skip ci]

* try not installing pytorch specifically [skip ci]

* work backwards [skip ci]

* add pytorch spec [skip ci]

* build dgl from src [skip ci]

* use own make build for both os [skip ci]

* fix errors [skip ci]

* add ubuntu back in? [skip ci]

* fix schema [skip ci]

* include openeye [skip ci]

* make import check more detailed [skip ci]

* add dgl home variable [skip ci]

* update env variables [skip ci]

* fix case [skip ci]

* use pip to install pytorch [skip ci]

* lower pytorch versions [skip ci]

* split out ubuntu build [skip ci]

* remove conda check [skip ci]

* unspecify openmm flag [skip ci]

* fix get_schema call [skip ci]

* parallelize make [skip ci]

* huh. unparallelize make [skip ci]

* try switching back to pytorch nightly [skip ci]

* only test on 3.11+ [skip ci]
  • Loading branch information
lilyminium authored Oct 18, 2024
1 parent 6cb4387 commit 12844b9
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 19 deletions.
68 changes: 55 additions & 13 deletions .github/workflows/dev-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ concurrency:
defaults:
run:
shell: bash -l {0}

env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
DGL_HOME: ${{ github.workspace }}/dgl

jobs:
nightly_check:
Expand All @@ -22,8 +26,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macOS-12, ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
os: [macOS-13, macOS-latest, ubuntu-latest]
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -42,25 +46,63 @@ jobs:
python=${{ matrix.python-version }}
pydantic=2
- name: Install nightly pytorch-lightning and DGL
- name: Install nightly pytorch
run: |
python -m pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html
python -m pip install --pre dglgo -f https://data.dgl.ai/wheels-test/repo.html
python -m pip install https://github.com/Lightning-AI/lightning/archive/refs/heads/master.zip -U
python -m pip install https://github.com/Lightning-AI/lightning/archive/refs/heads/master.zip -U
- name: Install package
- name: Download DGL source
run: |
python -m pip install . --no-deps
git clone --recurse-submodules https://github.com/dmlc/dgl.git
- name: Set up DGL
if: matrix.os != 'ubuntu-latest'
run: |
# from https://docs.dgl.ai/en/latest/install/index.html#macos
cd dgl/
mkdir build && cd build
cmake -DUSE_OPENMP=off -DUSE_LIBXSMM=OFF ..
make -j4
cd ../..
- name: Set up DGL (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
cd dgl/
mkdir build && cd build
cmake -DBUILD_TYPE=dev -DUSE_CUDA=OFF -DUSE_LIBXSMM=OFF ..
make
cd ../..
- name: Install DGL Python bindings
run: |
cd dgl/python
python setup.py install
python setup.py build_ext --inplace
cd ../..
- name: Python information
- uses: ./.github/actions/include-openeye
with:
openeye-license-text: ${{ secrets.OE_LICENSE }}
openeye-license-file: ${{ env.OE_LICENSE }}

- name: Check toolkit installations
shell: bash -l -c "python -u {0}"
run: |
which python
conda info
conda list
from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE, RDKIT_AVAILABLE
assert str(OPENEYE_AVAILABLE).lower() == 'true'
assert str(RDKIT_AVAILABLE).lower() == 'true'
- name: Check Python environment
run: |
pip list
- name: Import DGL
run: |
python -c "import dgl"
python -c "import dgl; import dgl.nn"
- name: Install package
run: |
python -m pip install . --no-deps
- name: Run tests
run: |
Expand Down
16 changes: 12 additions & 4 deletions devtools/conda-envs/nightly.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: openff-nagl-test
channels:
- openeye
- pytorch-nightly
- conda-forge
- pytorch-nightly
- defaults
dependencies:
# Base depends
Expand All @@ -18,13 +18,16 @@ dependencies:
- pydantic <3
- rdkit
- scipy
- openeye-toolkits

# gnn
- pytorch
- torchvision
- torchaudio

# database
- pyarrow

# gcn
- pytorch

# parallelism
- dask-jobqueue

Expand All @@ -49,6 +52,11 @@ dependencies:
- sqlite
- xmltodict

# building
- make
- cmake
- cython

# Pip-only installs
- pip:
- git+https://github.com/openforcefield/openff-utilities.git@main
Expand Down
10 changes: 8 additions & 2 deletions openff/nagl/nn/_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,15 @@ class _LazyDGLMoleculeDataset(Dataset):

@property
def schema(self):
self.get_schema()

@classmethod
def get_schema(cls):
import pyarrow as pa

return pa.schema([pa.field("pickled", pa.binary())])



def __len__(self):
return self.n_entries
Expand Down Expand Up @@ -370,15 +376,15 @@ def from_arrow_dataset(
input_dataset = ds.dataset(path, format=format)

with pa.OSFile(str(output_path), "wb") as sink:
with pa.ipc.new_file(sink, cls.schema) as writer:
with pa.ipc.new_file(sink, cls.get_schema()) as writer:
input_batches = input_dataset.to_batches(columns=columns)
for input_batch in input_batches:
with get_mapper_to_processes(n_processes=n_processes) as mapper:
pickled = list(mapper(converter, input_batch.to_pylist()))

output_batch = pa.RecordBatch.from_arrays(
[pa.array(pickled)],
schema=cls.schema
schema=cls.get_schema()
)
writer.write_batch(output_batch)

Expand Down

0 comments on commit 12844b9

Please sign in to comment.