Invalid memory accesses in dist-array/DA-scatter example

Issue #619 resolved
Dan Bonachea created an issue

The dist-array/DA-scatter example code currently includes a number of memory defects whenever the computed pure-block size BS does not evenly divide the 1000 array elements (an undocumented/unenforced invariant required for correctness). BS is an optional command-line argument to the test, so it's easy to arrange for this situation by passing an argument like 249. Even without passing a command-line argument, the property will be violated by default whenever the number of processes does not evenly divide 1000 (e.g. with 16 processes).

When the property is violated with a single rank, where partial trailing blocks are not allocated (e.g. upcxx-run -n 1 bin/DA-scatter 249), the test writes to array elements that do not exist, overrunning the shared heap array and frequently leading to crashes. When the property is violated with multiple ranks, the test will perform reads that overrun the test's data_to_distribute static array, potentially leading to crashes.

Comments (2)

  1. Log in to comment