Skip to content

Commit

Permalink
Merge pull request ESMCI#1349 from NetCDF-World-Domination-Council/ej…
Browse files Browse the repository at this point in the history
…h_travis1

Ejh travis1
  • Loading branch information
edhartnett authored Mar 11, 2019
2 parents 19773d5 + c0e6b25 commit ebd44d3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 29 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env:
global:
- CC=mpicc
- CPPFLAGS='-I/usr/include'
- CFLAGS='-std=c99'
- LDFLAGS='-L/usr/lib'

script:
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ AC_DEFINE([PIO_VERSION_MAJOR], [2], [PIO major version])
AC_DEFINE([PIO_VERSION_MINOR], [4], [PIO minor version])
AC_DEFINE([PIO_VERSION_PATCH], [0], [PIO patch version])

# ???
# ????
AC_DEFINE([CPRGNU], [1], [defined by CMake build])

# We must have MPI to build PIO.
Expand Down
2 changes: 1 addition & 1 deletion src/clib/pioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ int PIOc_set_hint(int iosysid, const char *hint, const char *hintval)

/* Set the MPI hint. */
if (ios->ioproc)
if ((mpierr = MPI_Info_set(ios->info, hint, hintval)))
if ((mpierr = MPI_Info_set(ios->info, (char *)hint, (char *)hintval)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);

return PIO_NOERR;
Expand Down
62 changes: 35 additions & 27 deletions tests/cunit/test_async_mpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ int get_test_comm(int my_rank, int ntasks, int min_ntasks, int max_ntasks, MPI_C
* @returns 0 for success, error code otherwise.
* @author Ed Hartnett
*/
int msg_handler(int verbose, int my_rank, int io_rank, int component_count, MPI_Comm *union_comm,
MPI_Comm *comp_comm, int *comproot, MPI_Comm io_comm)
int msg_handler(int verbose, int my_rank, int io_rank, int component_count,
MPI_Comm *union_comm, MPI_Comm *comp_comm, int *comproot,
MPI_Comm io_comm)
{
int msg = 0;
MPI_Request req[component_count];
Expand All @@ -133,13 +134,15 @@ int msg_handler(int verbose, int my_rank, int io_rank, int component_count, MPI_
for (int cmp = 0; cmp < component_count; cmp++)
{
if (verbose)
printf("my_rank %d cmp %d about to call MPI_Irecv comproot[cmp] %d union_comm[cmp] %d\n",
my_rank, cmp, comproot[cmp], union_comm[cmp]);
printf("my_rank %d cmp %d about to call MPI_Irecv comproot[cmp] %d "
"union_comm[cmp] %lld\n", my_rank, cmp, comproot[cmp],
(long long int)(union_comm[cmp]));
if ((mpierr = MPI_Irecv(&msg, 1, MPI_INT, comproot[cmp], MPI_ANY_TAG,
union_comm[cmp], &req[cmp])))
MPIERR(mpierr);
if (verbose)
printf("my_rank %d MPI_Irecv req[%d] = %d\n", my_rank, cmp, req[cmp]);
printf("my_rank %d MPI_Irecv req[%d] = %lld\n", my_rank, cmp,
(long long int)(req[cmp]));
}
}

Expand All @@ -156,28 +159,30 @@ int msg_handler(int verbose, int my_rank, int io_rank, int component_count, MPI_
{
if (verbose)
{
printf("my_rank %d about to call MPI_Waitany req[0] = %d MPI_REQUEST_NULL = %d\n",
my_rank, req[0], MPI_REQUEST_NULL);
printf("my_rank %d about to call MPI_Waitany req[0] = %lld\n",
my_rank, (long long int)(req[0]));
for (int c = 0; c < component_count; c++)
printf("my_rank %d req[%d] = %d\n", my_rank, c, req[c]);
printf("my_rank %d req[%d] = %lld\n", my_rank, c,
(long long int)(req[c]));
}
if ((mpierr = MPI_Waitany(component_count, req, &index, &status)))
MPIERR(mpierr);
if (verbose)
printf("my_rank %d Waitany returned index = %d req[%d] = %d\n", my_rank, index, index, req[index]);
printf("my_rank %d Waitany returned index = %d req[%d] = %lld\n",
my_rank, index, index, (long long int)req[index]);
}

/* Broadcast the index and msg value to the rest of the IO tasks. */
if (verbose)
printf("my_rank %d about to MPI_Bcast io_comm %d index %d msg %d\n", my_rank, io_comm,
index, msg);
printf("my_rank %d about to MPI_Bcast io_comm %lld index %d msg %d\n",
my_rank, (long long int)io_comm, index, msg);
if ((mpierr = MPI_Bcast(&index, 1, MPI_INT, 0, io_comm)))
MPIERR(mpierr);
if ((mpierr = MPI_Bcast(&msg, 1, MPI_INT, 0, io_comm)))
MPIERR(mpierr);
if (verbose)
printf("my_rank %d MPI_Bcast io_comm %d index %d msg %d\n", my_rank, io_comm,
index, msg);
printf("my_rank %d MPI_Bcast io_comm %lld index %d msg %d\n",
my_rank, (long long int)io_comm, index, msg);

/* Handle the message. This code is run on all IO tasks. */
switch (msg)
Expand All @@ -196,17 +201,19 @@ int msg_handler(int verbose, int my_rank, int io_rank, int component_count, MPI_
if (!io_rank && msg != -1)
{
if (verbose)
printf("my_rank %d msg_handler about to Irecv index = %d comproot = %d union_comm = %d\n",
my_rank, index, comproot[index], union_comm[index]);
printf("my_rank %d msg_handler about to Irecv index = %d comproot = %d union_comm = %lld\n",
my_rank, index, comproot[index], (long long int)union_comm[index]);
if ((mpierr = MPI_Irecv(&msg, 1, MPI_INT, comproot[index], MPI_ANY_TAG, union_comm[index],
&req[index])))
MPIERR(mpierr);
if (verbose)
printf("my_rank %d msg_handler called MPI_Irecv req[%d] = %d\n", my_rank, index, req[index]);
printf("my_rank %d msg_handler called MPI_Irecv req[%d] = %lld\n",
my_rank, index, (long long int)req[index]);
}

if (verbose)
printf("my_rank %d msg_handler done msg = %d open_components = %d\n", my_rank, msg, open_components);
printf("my_rank %d msg_handler done msg = %d open_components = %d\n",
my_rank, msg, open_components);

/* If there are no more open components, exit. */
if (msg == -1)
Expand Down Expand Up @@ -273,17 +280,15 @@ int main(int argc, char **argv)
if ((ret = MPI_Comm_group(test_comm, &world_group)))
MPIERR(ret);

if (verbose)
printf("MPI_GROUP_NULL %d MPI_COMM_NULL %d\n", MPI_GROUP_NULL, MPI_COMM_NULL);

/* There is one shared IO comm. Create it. */
if ((ret = MPI_Group_incl(world_group, num_io_procs, my_io_proc_list, &io_group)))
MPIERR(ret);
if ((ret = MPI_Comm_create(test_comm, io_group, &io_comm)))
MPIERR(ret);
MPI_Group_free(&io_group);
if (verbose)
printf("my_rank %d created io comm io_comm = %d\n", my_rank, io_comm);
printf("my_rank %d created io comm io_comm = %lld\n", my_rank,
(long long int)io_comm);

/* For processes in the IO component, get their rank within the IO
* communicator. */
Expand Down Expand Up @@ -317,7 +322,8 @@ int main(int argc, char **argv)
if ((ret = MPI_Group_incl(world_group, 1, my_proc_list[cmp], &group[cmp])))
MPIERR(ret);
if (verbose)
printf("my_rank %d created component MPI group - group[%d] = %d\n", my_rank, cmp, group[cmp]);
printf("my_rank %d created component MPI group - group[%d] = %lld\n",
my_rank, cmp, (long long int)group[cmp]);

/* Add proc numbers from IO. */
proc_list_union[0] = 0;
Expand Down Expand Up @@ -347,8 +353,8 @@ int main(int argc, char **argv)
MPIERR(ret);
}
if (verbose)
printf("my_rank %d intracomm created for cmp = %d comp_comm[cmp] = %d comp_rank = %d\n",
my_rank, cmp, comp_comm[cmp], comp_rank);
printf("my_rank %d intracomm created for cmp = %d comp_comm[cmp] = %lld comp_rank = %d\n",
my_rank, cmp, (long long int)comp_comm[cmp], comp_rank);

/* If this is the IO component, make a copy of the IO comm for
* each computational component. */
Expand All @@ -357,7 +363,8 @@ int main(int argc, char **argv)
if ((ret = MPI_Comm_dup(io_comm, &io_comm2)))
MPIERR(ret);
if (verbose)
printf("my_rank %d dup of io_comm = %d io_rank = %d\n", my_rank, io_comm, io_rank);
printf("my_rank %d dup of io_comm = %lld io_rank = %d\n", my_rank,
(long long int)io_comm, io_rank);
}

/* Create a group for the union of the IO component
Expand All @@ -368,8 +375,9 @@ int main(int argc, char **argv)
MPIERR(ret);
MPI_Group_free(&union_group[cmp]);
if (verbose)
printf("my_rank %d created union - union_group[%d] %d with %d procs union_comm[%d] %d\n",
my_rank, cmp, union_group[cmp], nprocs_union, cmp, union_comm[cmp]);
printf("my_rank %d created union - union_group[%d] %lld with %d procs union_comm[%d] %lld\n",
my_rank, cmp, (long long int)union_group[cmp], nprocs_union, cmp,
(long long int)union_comm[cmp]);


if (in_io || in_cmp[cmp])
Expand Down

0 comments on commit ebd44d3

Please sign in to comment.