sandialabs / compadre

Compadre (Compatible Particle Discretization and Remap)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Batching not working as expected when mod(targets,targets/#batches) is small

kuberry opened this issue · comments

On CUDA, for 151-152 targets with 15 batches, "an illegal memory access was encountered."

Why it broke: For example, with 200 target sites and 18 batches,
It had to round up for maximum job size, lso200/18 gives 11.1 targets per batch.
Rounded max_batch_size to 12. 12*17 is already 204, so only 17 batches were needed, but nothing was there to catch this. Also, we += the index by max_batch_size which gave 204, instead of this_batch_size, which would have given 200 on the 17th batch.
Added a break to catch it and end the loop so that we don’t do any loops with 0 targets.