Skip to content

Commit

Permalink
Merge pull request #546 from bccp/odd-chunksizes
Browse files Browse the repository at this point in the history
Fix index error in painting during throttling.
  • Loading branch information
rainwoodman committed Jan 2, 2019
2 parents 522d35c + ca78ecb commit 677a214
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nbodykit/source/mesh/catalog.py
Expand Up @@ -318,7 +318,7 @@ def dochunk(s):
Nlocal1, Wlocal1, W2local1 = dochunk(s)
chunksize = min(max_chunksize, int(chunksize * 1.5))
except StopIteration:
chunksize = chunksize / 2
chunksize = chunksize // 2
if chunksize < 1:
raise RuntimeError("Cannot find a chunksize that fits into memory.")
continue
Expand Down
13 changes: 13 additions & 0 deletions nbodykit/source/mesh/tests/test_catalogmesh.py
Expand Up @@ -137,6 +137,19 @@ def test_no_compensation(comm):
with pytest.raises(ValueError):
actions = mesh.actions

@MPITest([4])
def test_odd_chunksize(comm):
# no errors shall occur. This is a regression test.

source = ArrayCatalog({
'Position': numpy.ones((2000, 3)),
}, BoxSize=512., comm=comm)

# make the mesh
mesh = source.to_mesh(resampler='cic', Nmesh=64, interlaced=True, compensated=True)

with set_options(paint_chunk_size=1111):
mesh.compute()

@MPITest([1, 4])
def test_view(comm):
Expand Down

0 comments on commit 677a214

Please sign in to comment.