Skip to content

Commit

Permalink
Merge pull request #58 from tberlok/joss-50
Browse files Browse the repository at this point in the history
Joss 50
  • Loading branch information
tberlok authored Feb 29, 2024
2 parents 7a356a7 + 46a757f commit 4b4784c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ checks:
cd tests; pytest comoving
cd tests; pytest non-comoving
cd tests; pytest general
cd tests; pytest cuda-gpu

linting:
flake8 ./
Expand All @@ -29,9 +30,3 @@ linting:
dev_checks:
make checks
make linting

# Tests that can only run on some systems
gpu_checks:
cd tests; python cuda-gpu/test_gpu_binary_tree.py
cd tests; python cuda-gpu/test_gpu_ray_projector.py
cd tests; python cuda-gpu/test_gpu_sph_projector.py
1 change: 1 addition & 0 deletions docs/source/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ into the `tests` directory and running
pytest comoving
pytest non-comoving
pytest general
pytest cuda-gpu
```
but it is also possible to run each test from the command line,
e.g.
Expand Down
13 changes: 11 additions & 2 deletions tests/cuda-gpu/test_gpu_binary_tree.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import pytest


@pytest.mark.xfail(raises=RuntimeError)
def test_gpu_binary_tree():
import cupy as cp
from numba import cuda
try:
import cupy
import numba
except ImportError:
msg = ("Import of cupy and numba failed "
+ " and GPU-tests can't run.")
pytest.xfail(msg)

import paicos as pa
from scipy.spatial import KDTree
from paicos.trees.bvh_gpu import GpuBinaryTree
Expand Down
11 changes: 11 additions & 0 deletions tests/cuda-gpu/test_gpu_ray_projector.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import pytest


def test_gpu_ray_projector(show=False):
"""
We compare the CPU and GPU implementations of ray-tracing.
"""
try:
import cupy
import numba
except ImportError:
msg = ("Import of cupy and numba failed "
+ " and GPU-tests can't run.")
pytest.xfail(msg)

import paicos as pa
import numpy as np
pa.use_units(True)
Expand Down
11 changes: 11 additions & 0 deletions tests/cuda-gpu/test_gpu_sph_projector.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import pytest


def test_gpu_sph_projector(show=False):
"""
We compare the CPU and GPU implementations of SPH-projection.
"""
try:
import cupy
import numba
except ImportError:
msg = ("Import of cupy and numba failed "
+ " and GPU-tests can't run.")
pytest.xfail(msg)

import paicos as pa
import numpy as np
pa.use_units(True)
Expand Down

0 comments on commit 4b4784c

Please sign in to comment.