Skip to content

Commit

Permalink
Bitonic: shrink amount of used local memory in accordance with @inferrna
Browse files Browse the repository at this point in the history
's comments in #80
  • Loading branch information
inducer committed Jul 16, 2015
1 parent 2b98b07 commit 9d6dd85
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyopencl/bitonic_sort.py
Expand Up @@ -121,8 +121,8 @@ def __call__(self, arr, idx=None, queue=None, wait_for=None, axis=0):
if aux:
last_evt = knl(
queue, (nt,), wg, arr.data, idx.data,
cl.LocalMemory(wg[0]*4*arr.dtype.itemsize),
cl.LocalMemory(wg[0]*4*idx.dtype.itemsize),
cl.LocalMemory(wg[0]*arr.dtype.itemsize),
cl.LocalMemory(wg[0]*idx.dtype.itemsize),
wait_for=[last_evt])
for knl, nt, wg, _ in run_queue[1:]:
last_evt = knl(
Expand Down Expand Up @@ -184,9 +184,9 @@ def sort_b_prepare_wl(self, argsort, key_dtype, idx_dtype, shape, axis):

available_lmem = dev.local_mem_size
while True:
lmem_size = wg*4*key_dtype.itemsize
lmem_size = wg*key_dtype.itemsize
if argsort:
lmem_size += wg*4*idx_dtype.itemsize
lmem_size += wg*idx_dtype.itemsize

if lmem_size + 512 > available_lmem:
wg //= 2
Expand Down

0 comments on commit 9d6dd85

Please sign in to comment.