Skip to content

Commit

Permalink
Merge pull request #934 from davidozog/pr/wait_test_vector_test_types
Browse files Browse the repository at this point in the history
Resolving comparison warnings in p2p vector tests
  • Loading branch information
David Ozog authored Feb 24, 2020
2 parents 1615f66 + cf923bc commit 1f89a0f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
29 changes: 14 additions & 15 deletions test/shmemx/c11_test_shmemx_test_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
int *status = calloc(npes, sizeof(int)); \
TYPE *cmp_values = malloc(npes * sizeof(TYPE)); \
\
size_t i = 0; \
int i = 0; \
int expected_sum = 0; \
int total_sum = 0; \
\
Expand Down Expand Up @@ -46,7 +46,7 @@
int *status = calloc(npes, sizeof(int)); \
TYPE *cmp_values = malloc(npes * sizeof(TYPE)); \
\
size_t i = 0; \
int i = 0; \
int expected_sum = 0; \
int total_sum = 0; \
\
Expand All @@ -57,9 +57,9 @@
\
expected_sum = (npes-1) * npes / 2; \
\
size_t ncompleted = 0; \
int ncompleted = 0; \
while(ncompleted < npes){ \
int ndone = shmemx_test_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \
size_t ndone = shmemx_test_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \
if (ndone != SIZE_MAX){ \
status[ndone] = 1; \
total_sum += ivars[ndone]; \
Expand All @@ -71,7 +71,7 @@
rc = EXIT_FAILURE; \
} \
\
} while(0)
} while(0)

#define TEST_SHMEM_TEST_SOME(TYPE) \
do{ \
Expand All @@ -83,7 +83,7 @@
\
size_t *indices = malloc(npes * sizeof(size_t)); \
\
size_t i = 0; \
int i = 0; \
int expected_sum = 0; \
int total_sum = 0; \
\
Expand All @@ -94,13 +94,13 @@
\
expected_sum = (npes-1) * npes / 2; \
\
size_t ncompleted = 0; \
int ncompleted = 0; \
while(ncompleted < npes){ \
int ndone = shmemx_test_some_vector(ivars, npes, indices, status, SHMEM_CMP_EQ, cmp_values); \
size_t ndone = shmemx_test_some_vector(ivars, npes, indices, status, SHMEM_CMP_EQ, cmp_values); \
if(ndone != 0){ \
for(i = 0; i < ndone; i++){ \
total_sum += ivars[indices[i]]; \
status[indices[i]] = 1; \
for(size_t j = 0; j < ndone; j++){ \
total_sum += ivars[indices[j]]; \
status[indices[j]] = 1; \
} \
ncompleted += ndone; \
} \
Expand All @@ -110,7 +110,7 @@
rc = EXIT_FAILURE; \
} \
\
} while(0)
} while(0)


#else
Expand All @@ -123,7 +123,7 @@

int main(void)
{

shmem_init();

int rc = EXIT_SUCCESS;
Expand Down Expand Up @@ -168,7 +168,6 @@ int main(void)


shmem_finalize();
return rc;

return rc;

}
29 changes: 14 additions & 15 deletions test/shmemx/c11_test_shmemx_wait_until_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
int *status = calloc(npes, sizeof(int)); \
TYPE *cmp_values = malloc(npes * sizeof(TYPE)); \
\
size_t i = 0; \
int i = 0; \
int expected_sum = 0; \
int total_sum = 0; \
\
Expand Down Expand Up @@ -43,7 +43,7 @@
int *status = calloc(npes, sizeof(int)); \
TYPE *cmp_values = malloc(npes * sizeof(TYPE)); \
\
size_t i = 0; \
int i = 0; \
int expected_sum = 0; \
int total_sum = 0; \
\
Expand All @@ -54,9 +54,9 @@
\
expected_sum = (npes-1) * npes / 2; \
\
size_t ncompleted = 0; \
int ncompleted = 0; \
while(ncompleted < npes){ \
int ndone = shmemx_wait_until_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \
size_t ndone = shmemx_wait_until_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \
status[ndone] = 1; \
total_sum += ivars[ndone]; \
ncompleted++; \
Expand All @@ -66,7 +66,7 @@
rc = EXIT_FAILURE; \
} \
\
} while(0)
} while(0)

#define TEST_SHMEM_WAIT_UNTIL_SOME(TYPE) \
do{ \
Expand All @@ -78,7 +78,7 @@
\
size_t *indices = malloc(npes * sizeof(size_t)); \
\
size_t i = 0; \
int i = 0; \
int expected_sum = 0; \
int total_sum = 0; \
\
Expand All @@ -89,12 +89,12 @@
\
expected_sum = (npes-1) * npes / 2; \
\
size_t ncompleted = 0; \
int ncompleted = 0; \
while(ncompleted < npes){ \
int ndone = shmemx_wait_until_some_vector(ivars, npes, indices, status, SHMEM_CMP_EQ, cmp_values); \
for(i = 0; i < ndone; i++){ \
total_sum += ivars[indices[i]]; \
status[indices[i]] = 1; \
size_t ndone = shmemx_wait_until_some_vector(ivars, npes, indices, status, SHMEM_CMP_EQ, cmp_values); \
for(size_t j = 0; j < ndone; j++){ \
total_sum += ivars[indices[j]]; \
status[indices[j]] = 1; \
} \
ncompleted += ndone; \
} \
Expand All @@ -103,7 +103,7 @@
rc = EXIT_FAILURE; \
} \
\
} while(0)
} while(0)


#else
Expand All @@ -116,7 +116,7 @@

int main(void)
{

shmem_init();

int rc = EXIT_SUCCESS;
Expand Down Expand Up @@ -161,7 +161,6 @@ int main(void)


shmem_finalize();
return rc;

return rc;

}

0 comments on commit 1f89a0f

Please sign in to comment.