Skip to content

Commit

Permalink
Enable OpenCL tests on gh actions. (#317)
Browse files Browse the repository at this point in the history
* Enable opencl tests and errors with memoization.

This used to work with old versions of pytools but caused many failures
with recent versions.  Fix issue where the CUDA tests would fail. This was 
because the memoization was ignoring the kwargs.  Also fix an issue 
when using start_idx on CUDA due to type inconsistencies.
  • Loading branch information
prabhuramachandran committed Aug 30, 2021
1 parent b3d887a commit 805b8a7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
- name: Install dependencies on Linux/MacOS
run: |
conda info
#conda install -c conda-forge pocl=1.5 pyopencl
#python -c 'import pyopencl as cl'
conda install -c conda-forge pocl pyopencl
python -c 'import pyopencl as cl'
if: ${{ runner.os != 'Windows' }}
- name: Install dependencies
run: |
Expand Down
8 changes: 6 additions & 2 deletions pysph/base/gpu_helper_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
from pytools import memoize


@memoize(key=lambda *args: tuple(args))
def key_func(*args, **kw):
return args, frozenset(kw.items())


@memoize(key=key_func)
def get_elwise(f, backend):
return Elementwise(f, backend=backend)


@memoize(key=lambda *args: tuple(args))
@memoize(key=key_func)
def get_scan(inp_f, out_f, dtype, backend):
return Scan(input=inp_f, output=out_f, dtype=dtype,
backend=backend)
Expand Down
2 changes: 1 addition & 1 deletion pysph/sph/acceleration_eval_gpu_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def _call_kernel(self, info, extra_args):
n = dest.get_number_of_particles(info.get('real', True))
else:
n = self._get_index(dest, stop_idx)
n_iter = n - start_idx
n_iter = int(n - start_idx)

# args is actually [queue, None, None, actual_meaningful_args]
# we do not need the first 3 args on CUDA.
Expand Down

0 comments on commit 805b8a7

Please sign in to comment.