Skip to content

Commit 04a7c3c

Browse files
authored
Merge pull request #12729 from gbtitus/ugni-overlong-memcpy
Fix a memcpy() that used the wrong size. (Reviewed by @ronawho.) While distributing all the nodes' initial memory region tables around the job, when copying each node's initial table entries from the allgathered data to our map we were copying enough bytes for the total size of the entire table, including its header and all the entries allocated for it. That's way too many; the target has that much room, by definition, but the source doesn't have that many valid bytes. We should instead copy just enough bytes to cover the maximum number of table entries that are in use on any node at this point. Only that many were transmitted in the allgather. This resolves Cray/chapel-private#91.
2 parents 578604d + 966a9f2 commit 04a7c3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

runtime/src/comm/ugni/comm-ugni.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2647,7 +2647,7 @@ void register_memory(void)
26472647
gnr_mreg_map[node] = gdp->gnr_mreg;
26482648
mem_regions_all_entries[node]->mreg_cnt = gdp->mreg_cnt;
26492649
memcpy(&mem_regions_all_entries[node]->mregs, &gdp->mregs,
2650-
mem_regions_size);
2650+
gdata_mregs_size);
26512651
mem_regions_all_my_entry_map[node] =
26522652
(mem_region_table_t*)
26532653
((char*) gdp->mem_regions_all + chpl_nodeID * mem_regions_size);

0 commit comments

Comments
 (0)