Skip to content

Commit 942bbc9

Browse files
committed
also run torch tests on github CI. simplify CI
1 parent 91218da commit 942bbc9

4 files changed

Lines changed: 17 additions & 75 deletions

File tree

.github/workflows/ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
# open3d / open3d_cpu wheels link EGL for offscreen rendering (GUI=ON).
3030
- name: Install Open3D runtime deps
3131
run: sudo apt-get update && sudo apt-get install --yes libegl1
32-
- name: Run Open3D-ML tests (CPU wheel, no torch parity)
32+
- name: Run Open3D-ML tests (CPU wheel)
3333
env:
3434
GH_TOKEN: ${{ github.token }}
3535
run: ./ci/run_ci.sh cpu

ci/run_ci.sh

Lines changed: 9 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@
44
#
55
# Usage: ./ci/run_ci.sh [cpu|cuda|xpu]
66
#
7-
# cpu — open3d_cpu wheel, PyTorch CPU; integration + TF tests only (no torch
8-
# CPU/accelerator parity). Used on GitHub Actions.
9-
# cuda — open3d (CUDA) wheel, PyTorch+cu126; full suite including
10-
# tests/test_models_torch.py parity (requires NVIDIA GPU).
11-
# xpu — open3d_xpu wheel, PyTorch+XPU; full suite including parity
12-
# (requires Intel GPU; torch.xpu.is_available()).
7+
# cpu — open3d_cpu wheel + requirements-torch.txt
8+
# cuda — default open3d manylinux wheel + requirements-torch-cuda.txt
9+
# xpu — open3d_xpu wheel + requirements-torch-xpu.txt
1310
#
14-
# Parity tests (tests/test_models_torch.py) are intentionally omitted for the
15-
# cpu variant: GitHub-hosted runners have no GPU, and parity needs a real
16-
# accelerator. See docs/howtos.md.
11+
# Pytest skips (parity, accelerator-only ops, missing ops) are handled in the
12+
# test modules. See docs/howtos.md.
1713

1814
set -euo pipefail
1915

2016
usage() {
21-
sed -n '2,16p' "$0" | sed 's/^# \?//'
17+
sed -n '2,12p' "$0" | sed 's/^# \?//'
2218
echo
2319
echo "Example: ./ci/run_ci.sh cpu"
2420
exit "${1:-0}"
@@ -43,25 +39,20 @@ case "${BACKEND}" in
4339
cpu)
4440
WHEEL_GLOB="open3d_cpu-*-${PY_TAG}-${PY_TAG}-manylinux*_x86_64.whl"
4541
TORCH_REQUIREMENTS="requirements-torch.txt"
46-
INCLUDE_PARITY_TESTS=false
4742
;;
4843
cuda)
49-
# Default manylinux wheel (not open3d_cpu / open3d_xpu).
5044
WHEEL_GLOB="open3d-[0-9]*-${PY_TAG}-${PY_TAG}-manylinux*_x86_64.whl"
5145
TORCH_REQUIREMENTS="requirements-torch-cuda.txt"
52-
INCLUDE_PARITY_TESTS=true
5346
;;
5447
xpu)
5548
WHEEL_GLOB="open3d_xpu-*-${PY_TAG}-${PY_TAG}-manylinux*_x86_64.whl"
5649
TORCH_REQUIREMENTS="requirements-torch-xpu.txt"
57-
INCLUDE_PARITY_TESTS=true
5850
;;
5951
esac
6052

6153
echo "Open3D-ML CI backend: ${BACKEND}"
6254
echo " wheel pattern: ${WHEEL_GLOB}"
6355
echo " torch requirements: ${TORCH_REQUIREMENTS}"
64-
echo " torch parity tests (test_models_torch.py): ${INCLUDE_PARITY_TESTS}"
6556
echo
6657

6758
echo "1. Download the latest Open3D devel wheel from ${OPEN3D_REPO}@${RELEASE_TAG}"
@@ -91,58 +82,18 @@ python -m pip install "${WHEEL_PATH}"
9182

9283
echo "3. Sanity-check the installed package"
9384
echo
94-
python -W default -c "
95-
import open3d
96-
print('Installed:', open3d)
97-
print('BUILD_PYTORCH_OPS:', open3d._build_config['BUILD_PYTORCH_OPS'])
98-
print('BUILD_SYCL_MODULE:', open3d._build_config.get('BUILD_SYCL_MODULE'))
99-
print('CUDA available:', open3d.core.cuda.is_available())
100-
print('SYCL available:', open3d.core.sycl.is_available())
101-
"
85+
python -W default -c "import open3d; print('Installed:', open3d)"
10286

10387
echo "4. Install Open3D-ML dependencies"
10488
echo
10589
export PATH_TO_OPEN3D_ML="$PWD"
10690
python -m pip install -r requirements.txt -r "${TORCH_REQUIREMENTS}" \
10791
-r requirements-tensorflow.txt
10892

109-
echo "4b. PyTorch accelerator visibility"
110-
echo
111-
python -c "
112-
import torch
113-
print('torch:', torch.__version__)
114-
print('torch.cuda.is_available():', torch.cuda.is_available())
115-
if hasattr(torch, 'xpu'):
116-
print('torch.xpu.is_available():', torch.xpu.is_available())
117-
"
118-
119-
if [[ "${INCLUDE_PARITY_TESTS}" == true ]]; then
120-
python -c "
121-
import open3d as o3d
122-
import torch
123-
import sys
124-
backend = '${BACKEND}'
125-
if backend == 'cuda' and not torch.cuda.is_available():
126-
sys.exit('cuda CI variant requires torch.cuda.is_available()')
127-
if backend == 'xpu' and not (hasattr(torch, 'xpu') and torch.xpu.is_available()):
128-
sys.exit('xpu CI variant requires torch.xpu.is_available()')
129-
print('Accelerator check passed for', backend)
130-
"
131-
fi
132-
133-
if [[ "${INCLUDE_PARITY_TESTS}" == true ]]; then
134-
TEST_TARGETS=(tests)
135-
else
136-
TEST_TARGETS=(
137-
tests/test_integration.py
138-
tests/test_models_tf.py
139-
)
140-
fi
141-
14293
run_test_suite() {
143-
echo "Running: ./tests/run_tests.sh ${TEST_TARGETS[*]}"
94+
echo "Running: ./tests/run_tests.sh tests"
14495
echo "Add --randomly-seed=SEED via pytest env if reproducing order."
145-
./tests/run_tests.sh "${TEST_TARGETS[@]}"
96+
./tests/run_tests.sh tests
14697
}
14798

14899
echo "5. Run the Open3D-ML pytest suite against the installed wheel"

docs/howtos.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,8 @@ Run the full suite locally with:
280280
### Note on GitHub Actions CI
281281

282282
GitHub-hosted runners have no NVIDIA or Intel GPU. CI runs `./ci/run_ci.sh cpu`,
283-
which installs the `open3d_cpu` wheel and PyTorch CPU, then runs integration and
284-
TensorFlow model tests only. **Torch CPU/accelerator parity** (`tests/test_models_torch.py`)
285-
is not part of CPU CI.
283+
which installs the `open3d_cpu` wheel and PyTorch CPU, then runs the full pytest
284+
tree. Individual tests skip when an op backend or accelerator is unavailable.
286285

287-
Run parity locally (or on GPU machines) with:
288-
289-
```bash
290-
./ci/run_ci.sh cuda # NVIDIA GPU + open3d CUDA wheel
291-
./ci/run_ci.sh xpu # Intel GPU + open3d_xpu wheel
292-
```
293-
294-
Both `cuda` and `xpu` variants install the matching PyTorch build and run the
295-
full test tree, including `test_models_torch.py`. The `cpu` variant skips those
296-
parity tests because they require a real accelerator and are not meaningful on
297-
CPU-only hosts.
286+
Run `./ci/run_ci.sh cuda` or `./ci/run_ci.sh xpu` locally or on GPU machines to
287+
exercise CUDA/XPU wheels and PyTorch builds.

tests/test_models_torch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
RandLANet from a config (no forward pass).
3434
3535
Parity tests need ``BUILD_PYTORCH_OPS`` and a CUDA or XPU device for the
36-
accelerator half. CPU CI (``./ci/run_ci.sh cpu``) does not run this file; use
37-
``./ci/run_ci.sh cuda`` or ``xpu`` locally for the full matrix.
36+
accelerator half; without a GPU, ``assert_cpu_accelerator_parity`` runs CPU only.
37+
CPU CI (``./ci/run_ci.sh cpu``) runs the same torch model tests with parity
38+
skipped on GPU-less runners; use ``./ci/run_ci.sh cuda`` or ``xpu`` for full parity.
3839
"""
3940

4041
import copy

0 commit comments

Comments
 (0)