Skip to content

Commit

Permalink
more codacy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Mar 27, 2019
1 parent c13e689 commit 437541a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 32 deletions.
21 changes: 9 additions & 12 deletions tests/cunit/test_async_manyproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,9 @@ int main(int argc, char **argv)
{
int my_rank; /* Zero-based rank of processor. */
int ntasks; /* Number of processors involved in current execution. */
int iosysid[COMPONENT_COUNT]; /* The ID for the parallel I/O system. */
int num_iotypes; /* Number of PIO netCDF iotypes in this build. */
int iotype[NUM_IOTYPES]; /* iotypes for the supported netCDF IO iotypes. */
int num_procs[COMPONENT_COUNT] = {NUM_COMP_PROCS, NUM_COMP_PROCS}; /* Num procs for IO and computation. */
int io_proc_list[NUM_IO_PROCS];
int comp_proc_list1[NUM_COMP_PROCS] = {NUM_IO_PROCS, NUM_IO_PROCS + 1};
int comp_proc_list2[NUM_COMP_PROCS] = {NUM_IO_PROCS + 2, NUM_IO_PROCS + 3};
int *proc_list[COMPONENT_COUNT] = {comp_proc_list1, comp_proc_list2};
MPI_Comm test_comm;
int verbose = 0;
int ret; /* Return code. */

/* Initialize our list of IO tasks. */
Expand All @@ -61,6 +54,13 @@ int main(int argc, char **argv)
/* Only do something on TARGET_NTASKS tasks. */
if (my_rank < TARGET_NTASKS)
{
int iosysid[COMPONENT_COUNT]; /* The ID for the parallel I/O system. */
int iotype[NUM_IOTYPES]; /* iotypes for the supported netCDF IO iotypes. */
int num_procs[COMPONENT_COUNT] = {NUM_COMP_PROCS, NUM_COMP_PROCS}; /* Num procs for IO and computation. */
int comp_proc_list1[NUM_COMP_PROCS] = {NUM_IO_PROCS, NUM_IO_PROCS + 1};
int comp_proc_list2[NUM_COMP_PROCS] = {NUM_IO_PROCS + 2, NUM_IO_PROCS + 3};
int *proc_list[COMPONENT_COUNT] = {comp_proc_list1, comp_proc_list2};

/* Figure out iotypes. */
if ((ret = get_iotypes(&num_iotypes, iotype)))
ERR(ret);
Expand All @@ -71,9 +71,6 @@ int main(int argc, char **argv)
if ((ret = PIOc_init_async(test_comm, NUM_IO_PROCS, io_proc_list, COMPONENT_COUNT,
num_procs, (int **)proc_list, NULL, NULL, PIO_REARR_BOX, iosysid)))
ERR(ERR_INIT);
if (verbose)
for (int c = 0; c < COMPONENT_COUNT; c++)
printf("my_rank %d cmp %d iosysid[%d] %d\n", my_rank, c, c, iosysid[c]);

/* All the netCDF calls are only executed on the computation
* tasks. */
Expand All @@ -88,12 +85,12 @@ int main(int argc, char **argv)

/* /\* Create sample file. *\/ */
/* if ((ret = create_nc_sample_3(iosysid[my_comp_idx], iotype[i], my_rank, my_comp_idx, */
/* filename, TEST_NAME, verbose, 0, 0))) */
/* filename, TEST_NAME, 0, 0, 0))) */
/* ERR(ret); */

/* /\* Check the file for correctness. *\/ */
/* if ((ret = check_nc_sample_3(iosysid[my_comp_idx], iotype[i], my_rank, my_comp_idx, */
/* filename, verbose, 0, 0))) */
/* filename, 0, 0, 0))) */
/* ERR(ret); */
} /* next netcdf iotype */

Expand Down
23 changes: 10 additions & 13 deletions tests/cunit/test_async_multicomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,8 @@ int main(int argc, char **argv)
{
int my_rank; /* Zero-based rank of processor. */
int ntasks; /* Number of processors involved in current execution. */
int iosysid[COMPONENT_COUNT]; /* The ID for the parallel I/O system. */
int num_iotypes; /* Number of PIO netCDF iotypes in this build. */
int iotype[NUM_IOTYPES]; /* iotypes for the supported netCDF IO iotypes. */
int num_procs[COMPONENT_COUNT] = {1, 1}; /* Num procs for IO and computation. */
int io_proc_list[NUM_IO_PROCS] = {0};
int comp_proc_list1[NUM_COMP_PROCS] = {1};
int comp_proc_list2[NUM_COMP_PROCS] = {2};
int *proc_list[COMPONENT_COUNT] = {comp_proc_list1, comp_proc_list2};
MPI_Comm test_comm;
int verbose = 0;
int ret; /* Return code. */

/* Initialize test. */
Expand All @@ -61,6 +53,14 @@ int main(int argc, char **argv)
/* Only do something on TARGET_NTASKS tasks. */
if (my_rank < TARGET_NTASKS)
{
int iosysid[COMPONENT_COUNT]; /* The ID for the parallel I/O system. */
int iotype[NUM_IOTYPES]; /* iotypes for the supported netCDF IO iotypes. */
int num_procs[COMPONENT_COUNT] = {1, 1}; /* Num procs for IO and computation. */
int io_proc_list[NUM_IO_PROCS] = {0};
int comp_proc_list1[NUM_COMP_PROCS] = {1};
int comp_proc_list2[NUM_COMP_PROCS] = {2};
int *proc_list[COMPONENT_COUNT] = {comp_proc_list1, comp_proc_list2};

/* Figure out iotypes. */
if ((ret = get_iotypes(&num_iotypes, iotype)))
ERR(ret);
Expand All @@ -76,9 +76,6 @@ int main(int argc, char **argv)
if ((ret = PIOc_init_async(test_comm, NUM_IO_PROCS, io_proc_list, COMPONENT_COUNT,
num_procs, (int **)proc_list, NULL, NULL, PIO_REARR_BOX, iosysid)))
ERR(ERR_INIT);
if (verbose)
for (int c = 0; c < COMPONENT_COUNT; c++)
printf("my_rank %d cmp %d iosysid[%d] %d\n", my_rank, c, c, iosysid[c]);

/* All the netCDF calls are only executed on the computation
* tasks. */
Expand All @@ -101,12 +98,12 @@ int main(int argc, char **argv)

/* Create sample file. */
if ((ret = create_nc_sample_3(iosysid[my_comp_idx], iotype[i], my_rank, my_comp_idx,
filename, TEST_NAME, verbose, use_darray, ioid)))
filename, TEST_NAME, 0, use_darray, ioid)))
ERR(ret);

/* Check the file for correctness. */
if ((ret = check_nc_sample_3(iosysid[my_comp_idx], iotype[i], my_rank, my_comp_idx,
filename, verbose, 0, ioid)))
filename, 0, 0, ioid)))
ERR(ret);
} /* next use_darray */

Expand Down
15 changes: 8 additions & 7 deletions tests/cunit/test_async_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,9 @@ int main(int argc, char **argv)
#define NUM_COMP_PROCS 1
int my_rank; /* Zero-based rank of processor. */
int ntasks; /* Number of processors involved in current execution. */
int iosysid[COMPONENT_COUNT]; /* The ID for the parallel I/O system. */
int num_flavors; /* Number of PIO netCDF flavors in this build. */
int flavor[NUM_FLAVORS]; /* iotypes for the supported netCDF IO flavors. */
int ret; /* Return code. */
int num_procs[COMPONENT_COUNT] = {1}; /* Num procs for IO and computation. */
int io_proc_list[NUM_IO_PROCS] = {0};
int comp_proc_list[NUM_COMP_PROCS] = {1};
int *proc_list[COMPONENT_COUNT] = {comp_proc_list};
MPI_Comm test_comm;
int ret; /* Return code. */

/* Initialize test. */
if ((ret = pio_test_init2(argc, argv, &my_rank, &ntasks, TARGET_NTASKS, TARGET_NTASKS,
Expand All @@ -52,6 +46,13 @@ int main(int argc, char **argv)
/* Only do something on TARGET_NTASKS tasks. */
if (my_rank < TARGET_NTASKS)
{
int iosysid[COMPONENT_COUNT]; /* The ID for the parallel I/O system. */
int flavor[NUM_FLAVORS]; /* iotypes for the supported netCDF IO flavors. */
int num_procs[COMPONENT_COUNT] = {1}; /* Num procs for IO and computation. */
int io_proc_list[NUM_IO_PROCS] = {0};
int comp_proc_list[NUM_COMP_PROCS] = {1};
int *proc_list[COMPONENT_COUNT] = {comp_proc_list};

/* Figure out iotypes. */
if ((ret = get_iotypes(&num_flavors, flavor)))
ERR(ret);
Expand Down

0 comments on commit 437541a

Please sign in to comment.