Commit 6d9d084a authored by Xin Zhao's avatar Xin Zhao
Browse files

Add tests of setting window info no_locks to TRUE / FALSE.


Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent c229b00e
......@@ -7,6 +7,7 @@
#include <stdio.h>
#include <mpi.h>
#include <string.h>
#include "mpitest.h"
#define VERBOSE 0
......@@ -26,11 +27,13 @@ int main(int argc, char **argv) {
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
MPI_Win_allocate(sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &base, &win);
/* Test#1: setting and getting invalid key */
MPI_Info_create(&info_in);
MPI_Info_set(info_in, invalid_key, "true");
MPI_Win_allocate(sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &base, &win);
MPI_Win_set_info(win, info_in);
MPI_Win_get_info(win, &info_out);
......@@ -45,9 +48,55 @@ int main(int argc, char **argv) {
}
#endif
MPI_Info_free(&info_in);
MPI_Info_free(&info_out);
/* Test#2: setting info key "no_lock" to false and getting the key */
MPI_Info_create(&info_in);
MPI_Info_set(info_in, "no_locks", "false");
MPI_Win_set_info(win, info_in);
MPI_Win_get_info(win, &info_out);
MPI_Info_get(info_out, "no_locks", MPI_MAX_INFO_VAL, buf, &flag);
if (!flag || strncmp(buf, "false", strlen("false")) != 0) {
if (!flag)
printf("%d: no_locks is not defined\n", rank);
else
printf("%d: no_locks = %s, expected false\n", rank, buf);
errors++;
}
if (flag && VERBOSE) printf("%d: no_locks = %s\n", rank, buf);
MPI_Info_free(&info_in);
MPI_Info_free(&info_out);
/* Test#3: setting info key "no_lock" to true and getting the key */
MPI_Info_create(&info_in);
MPI_Info_set(info_in, "no_locks", "true");
MPI_Win_set_info(win, info_in);
MPI_Win_get_info(win, &info_out);
MPI_Info_get(info_out, "no_locks", MPI_MAX_INFO_VAL, buf, &flag);
if (!flag || strncmp(buf, "true", strlen("true")) != 0) {
if (!flag)
printf("%d: no_locks is not defined\n", rank);
else
printf("%d: no_locks = %s, expected true\n", rank, buf);
errors++;
}
if (flag && VERBOSE) printf("%d: no_locks = %s\n", rank, buf);
MPI_Info_free(&info_in);
MPI_Info_free(&info_out);
/* Test#4: getting other info keys */
MPI_Win_get_info(win, &info_out);
MPI_Info_get(info_out, "accumulate_ordering", MPI_MAX_INFO_VAL, buf, &flag);
if (flag && VERBOSE) printf("%d: accumulate_ordering = %s\n", rank, buf);
......@@ -60,7 +109,6 @@ int main(int argc, char **argv) {
MPI_Info_get(info_out, "alloc_shm", MPI_MAX_INFO_VAL, buf, &flag);
if (flag && VERBOSE) printf("%d: alloc_shm = %s\n", rank, buf);
MPI_Info_free(&info_in);
MPI_Info_free(&info_out);
MPI_Win_free(&win);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment