Skip to content

Commit 1f89a0f

Browse files
author
David Ozog
authored
Merge pull request #934 from davidozog/pr/wait_test_vector_test_types
Resolving comparison warnings in p2p vector tests
2 parents 1615f66 + cf923bc commit 1f89a0f

File tree

2 files changed

+28
-30
lines changed

2 files changed

+28
-30
lines changed

test/shmemx/c11_test_shmemx_test_vector.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
int *status = calloc(npes, sizeof(int)); \
1515
TYPE *cmp_values = malloc(npes * sizeof(TYPE)); \
1616
\
17-
size_t i = 0; \
17+
int i = 0; \
1818
int expected_sum = 0; \
1919
int total_sum = 0; \
2020
\
@@ -46,7 +46,7 @@
4646
int *status = calloc(npes, sizeof(int)); \
4747
TYPE *cmp_values = malloc(npes * sizeof(TYPE)); \
4848
\
49-
size_t i = 0; \
49+
int i = 0; \
5050
int expected_sum = 0; \
5151
int total_sum = 0; \
5252
\
@@ -57,9 +57,9 @@
5757
\
5858
expected_sum = (npes-1) * npes / 2; \
5959
\
60-
size_t ncompleted = 0; \
60+
int ncompleted = 0; \
6161
while(ncompleted < npes){ \
62-
int ndone = shmemx_test_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \
62+
size_t ndone = shmemx_test_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \
6363
if (ndone != SIZE_MAX){ \
6464
status[ndone] = 1; \
6565
total_sum += ivars[ndone]; \
@@ -71,7 +71,7 @@
7171
rc = EXIT_FAILURE; \
7272
} \
7373
\
74-
} while(0)
74+
} while(0)
7575

7676
#define TEST_SHMEM_TEST_SOME(TYPE) \
7777
do{ \
@@ -83,7 +83,7 @@
8383
\
8484
size_t *indices = malloc(npes * sizeof(size_t)); \
8585
\
86-
size_t i = 0; \
86+
int i = 0; \
8787
int expected_sum = 0; \
8888
int total_sum = 0; \
8989
\
@@ -94,13 +94,13 @@
9494
\
9595
expected_sum = (npes-1) * npes / 2; \
9696
\
97-
size_t ncompleted = 0; \
97+
int ncompleted = 0; \
9898
while(ncompleted < npes){ \
99-
int ndone = shmemx_test_some_vector(ivars, npes, indices, status, SHMEM_CMP_EQ, cmp_values); \
99+
size_t ndone = shmemx_test_some_vector(ivars, npes, indices, status, SHMEM_CMP_EQ, cmp_values); \
100100
if(ndone != 0){ \
101-
for(i = 0; i < ndone; i++){ \
102-
total_sum += ivars[indices[i]]; \
103-
status[indices[i]] = 1; \
101+
for(size_t j = 0; j < ndone; j++){ \
102+
total_sum += ivars[indices[j]]; \
103+
status[indices[j]] = 1; \
104104
} \
105105
ncompleted += ndone; \
106106
} \
@@ -110,7 +110,7 @@
110110
rc = EXIT_FAILURE; \
111111
} \
112112
\
113-
} while(0)
113+
} while(0)
114114

115115

116116
#else
@@ -123,7 +123,7 @@
123123

124124
int main(void)
125125
{
126-
126+
127127
shmem_init();
128128

129129
int rc = EXIT_SUCCESS;
@@ -168,7 +168,6 @@ int main(void)
168168

169169

170170
shmem_finalize();
171-
return rc;
172-
171+
return rc;
173172

174173
}

test/shmemx/c11_test_shmemx_wait_until_vector.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
int *status = calloc(npes, sizeof(int)); \
1515
TYPE *cmp_values = malloc(npes * sizeof(TYPE)); \
1616
\
17-
size_t i = 0; \
17+
int i = 0; \
1818
int expected_sum = 0; \
1919
int total_sum = 0; \
2020
\
@@ -43,7 +43,7 @@
4343
int *status = calloc(npes, sizeof(int)); \
4444
TYPE *cmp_values = malloc(npes * sizeof(TYPE)); \
4545
\
46-
size_t i = 0; \
46+
int i = 0; \
4747
int expected_sum = 0; \
4848
int total_sum = 0; \
4949
\
@@ -54,9 +54,9 @@
5454
\
5555
expected_sum = (npes-1) * npes / 2; \
5656
\
57-
size_t ncompleted = 0; \
57+
int ncompleted = 0; \
5858
while(ncompleted < npes){ \
59-
int ndone = shmemx_wait_until_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \
59+
size_t ndone = shmemx_wait_until_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \
6060
status[ndone] = 1; \
6161
total_sum += ivars[ndone]; \
6262
ncompleted++; \
@@ -66,7 +66,7 @@
6666
rc = EXIT_FAILURE; \
6767
} \
6868
\
69-
} while(0)
69+
} while(0)
7070

7171
#define TEST_SHMEM_WAIT_UNTIL_SOME(TYPE) \
7272
do{ \
@@ -78,7 +78,7 @@
7878
\
7979
size_t *indices = malloc(npes * sizeof(size_t)); \
8080
\
81-
size_t i = 0; \
81+
int i = 0; \
8282
int expected_sum = 0; \
8383
int total_sum = 0; \
8484
\
@@ -89,12 +89,12 @@
8989
\
9090
expected_sum = (npes-1) * npes / 2; \
9191
\
92-
size_t ncompleted = 0; \
92+
int ncompleted = 0; \
9393
while(ncompleted < npes){ \
94-
int ndone = shmemx_wait_until_some_vector(ivars, npes, indices, status, SHMEM_CMP_EQ, cmp_values); \
95-
for(i = 0; i < ndone; i++){ \
96-
total_sum += ivars[indices[i]]; \
97-
status[indices[i]] = 1; \
94+
size_t ndone = shmemx_wait_until_some_vector(ivars, npes, indices, status, SHMEM_CMP_EQ, cmp_values); \
95+
for(size_t j = 0; j < ndone; j++){ \
96+
total_sum += ivars[indices[j]]; \
97+
status[indices[j]] = 1; \
9898
} \
9999
ncompleted += ndone; \
100100
} \
@@ -103,7 +103,7 @@
103103
rc = EXIT_FAILURE; \
104104
} \
105105
\
106-
} while(0)
106+
} while(0)
107107

108108

109109
#else
@@ -116,7 +116,7 @@
116116

117117
int main(void)
118118
{
119-
119+
120120
shmem_init();
121121

122122
int rc = EXIT_SUCCESS;
@@ -161,7 +161,6 @@ int main(void)
161161

162162

163163
shmem_finalize();
164-
return rc;
165-
164+
return rc;
166165

167166
}

0 commit comments

Comments
 (0)