Skip to content

Commit 236f7ca

Browse files
author
David Ozog
committed
Move dims init into function in 2D split example
Avoids an uninitialized variable warning on some compilers Signed-off-by: David Ozog <[email protected]>
1 parent ec66ff2 commit 236f7ca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

example_code/shmem_team_split_2D.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ static void find_xy_dims(int npes, int *x, int *y) {
1515
/* Find x, y, and z such that x * y * z == npes and
1616
* abs(x - y) + abs(x - z) + abs(y - z) is minimized. */
1717
static void find_xyz_dims(int npes, int *x, int *y, int *z) {
18+
*x = *y = *z = 1;
1819
for(int divider = ceil(cbrt(npes)); divider >= 1; divider--)
1920
if (npes % divider == 0) {
2021
*x = divider;
@@ -24,7 +25,7 @@ static void find_xyz_dims(int npes, int *x, int *y, int *z) {
2425
}
2526

2627
int main(void) {
27-
int xdim = 1, ydim = 1, zdim = 1;
28+
int xdim, ydim, zdim;
2829

2930
shmem_init();
3031
int mype = shmem_my_pe();

0 commit comments

Comments
 (0)