Skip to content

Commit

Permalink
fixed up test program
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Dec 7, 2019
1 parent 6ddc1a0 commit 341c123
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/clib/pio.h
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ extern "C" {
const unsigned long long *op);

/* These functions are for the netCDF integration layer. */
int nc_def_iosystemm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, int rearr,
int nc_def_iosystem(MPI_Comm comp_comm, int num_iotasks, int stride, int base, int rearr,
int *iosysidp);

int nc_def_async(MPI_Comm world, int num_io_procs, int *io_proc_list,
Expand Down
4 changes: 2 additions & 2 deletions src/ncint/ncint_pio.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ extern int diosysid;
* @author Ed Hartnett
*/
int
nc_def_iosystemm(MPI_Comm comp_comm, int num_iotasks, int stride, int base,
int rearr, int *iosysidp)
nc_def_iosystem(MPI_Comm comp_comm, int num_iotasks, int stride, int base,
int rearr, int *iosysidp)
{
int ret;

Expand Down
2 changes: 1 addition & 1 deletion tests/ncint/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LDADD = ${top_builddir}/src/clib/libpioc.la

# Build the test for make check.
check_PROGRAMS = tst_pio_udf tst_pio_async tst_async_multi \
tst_ncint_perf
tst_ncint_async_perf tst_ncint_perf

tst_pio_udf_SOURCES = tst_pio_udf.c pio_err_macros.h
tst_pio_async_SOURCES = tst_pio_async.c pio_err_macros.h
Expand Down
31 changes: 12 additions & 19 deletions tests/ncint/tst_ncint_perf.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/* Test netcdf integration layer.
This is a performance test of async mode in PIO, using the netCDF
integration layer.
This is a performance test of intercomm mode in PIO, using the
netCDF integration layer.
Ed Hartnett
12/2/19
12/7/19
*/

#include "config.h"
#include <pio.h>
#include <sys/time.h>
#include "pio_err_macros.h"

#define FILE_NAME "tst_pio_async.nc"
#define FILE_NAME "tst_ncint_perf.nc"
#define VAR_NAME "data_var"
#define DIM_NAME_UNLIMITED "dim_unlimited"
#define DIM_NAME_X "dim_x"
Expand Down Expand Up @@ -47,7 +47,7 @@ main(int argc, char **argv)
if (!my_rank)
printf("\n*** Testing netCDF integration PIO performance.\n");
if (!my_rank)
printf("*** testing simple async use of netCDF integration layer...\n");
printf("*** testing simple intercomm use of netCDF integration layer...\n");
{
int ncid, ioid;
int dimid[NDIM3], varid;
Expand All @@ -56,7 +56,6 @@ main(int argc, char **argv)
size_t elements_per_pe;
size_t *compdof; /* The decomposition mapping. */
int *my_data;
int num_procs2[COMPONENT_COUNT];
int num_io_procs;
int i;

Expand All @@ -77,17 +76,10 @@ main(int argc, char **argv)
else if (ntasks <= 2048)
num_io_procs = 256;

/* Figure out how many computation processors. */
num_procs2[0] = ntasks - num_io_procs;

/* Initialize the intracomm. The IO task will not return from
* this call until the PIOc_finalize() is called by the
* compute tasks. */
if (nc_def_async(MPI_COMM_WORLD, num_io_procs, NULL, COMPONENT_COUNT,
num_procs2, NULL, NULL, NULL, PIO_REARR_BOX, &iosysid))
/* Initialize the intracomm. */
if (nc_def_iosystem(MPI_COMM_WORLD, num_io_procs, 1, 0, PIO_REARR_BOX, &iosysid))
PERR;

if (my_rank >= num_io_procs)
{
struct timeval starttime, endtime;
long long startt, endt;
Expand All @@ -105,7 +97,7 @@ main(int argc, char **argv)
int t, m;

/* Print header. */
if (my_rank == num_io_procs)
if (!my_rank)
printf("access,\t\t\tntasks,\tnio,\trearr,\ttime(s),\tdata size (MB),\t"
"performance(MB/s)\n");

Expand All @@ -120,14 +112,14 @@ main(int argc, char **argv)
if (nc_enddef(ncid)) PERR;

/* Calculate a decomposition for distributed arrays. */
elements_per_pe = DIM_LEN_X * DIM_LEN_Y / (ntasks - num_io_procs);
elements_per_pe = DIM_LEN_X * DIM_LEN_Y / ntasks;
/* printf("my_rank %d elements_per_pe %ld\n", my_rank, elements_per_pe); */

if (!(compdof = malloc(elements_per_pe * sizeof(size_t))))
PERR;
for (i = 0; i < elements_per_pe; i++)
{
compdof[i] = (my_rank - num_io_procs) * elements_per_pe + i;
compdof[i] = my_rank * elements_per_pe + i;
/* printf("my_rank %d compdof[%d]=%ld\n", my_rank, i, compdof[i]); */
}

Expand Down Expand Up @@ -166,8 +158,9 @@ main(int argc, char **argv)

free(my_data);
if (nc_free_decomp(ioid)) PERR;
if (nc_free_iosystem(iosysid)) PERR;
}
if (nc_free_iosystem(iosysid)) PERR;

}
if (!my_rank)
PSUMMARIZE_ERR;
Expand Down
2 changes: 1 addition & 1 deletion tests/ncint/tst_pio_udf.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ main(int argc, char **argv)
/* PIOc_set_log_level(3); */

/* Initialize the intracomm. */
if (nc_def_iosystemm(MPI_COMM_WORLD, 1, 1, 0, 0, &iosysid)) PERR;
if (nc_def_iosystem(MPI_COMM_WORLD, 1, 1, 0, 0, &iosysid)) PERR;

/* Create a file with a 3D record var. */
if (nc_create(FILE_NAME, NC_PIO, &ncid)) PERR;
Expand Down

0 comments on commit 341c123

Please sign in to comment.