From 3598cb53fd8d36b7b55fa92bd878852bdab518af Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Fri, 29 Mar 2019 08:32:47 -0600 Subject: [PATCH 1/3] changes in test_perf2 --- tests/cunit/test_perf2.c | 95 ++++++++-------------------------------- 1 file changed, 19 insertions(+), 76 deletions(-) diff --git a/tests/cunit/test_perf2.c b/tests/cunit/test_perf2.c index 49d2c5a28f6..56806e5dc5a 100644 --- a/tests/cunit/test_perf2.c +++ b/tests/cunit/test_perf2.c @@ -122,36 +122,15 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank char filename[PIO_MAX_NAME + 1]; /* Name for the output files. */ int dimids[NDIM]; /* The dimension IDs. */ int ncid; /* The ncid of the netCDF file. */ - int ncid2; /* The ncid of the re-opened netCDF file. */ int varid; /* The ID of the netCDF varable. */ - int ret; /* Return code. */ PIO_Offset arraylen = EXPECTED_MAPLEN; int int_fillvalue = NC_FILL_INT; void *fillvalue = NULL; int *test_data; - int *test_data2; - int *test_data_in; + int ret; /* Return code. */ if (!(test_data = malloc(sizeof(int) * arraylen))) ERR(PIO_ENOMEM); - if (!(test_data2 = malloc(sizeof(int) * arraylen))) - { - free(test_data); - ERR(PIO_ENOMEM); - } - if (!(test_data_in = malloc(sizeof(int) * arraylen))) - { - free(test_data); - free(test_data2); - ERR(PIO_ENOMEM); - } - - /* Initialize some data. */ - for (int f = 0; f < arraylen; f++) - { - test_data[f] = my_rank * 10 + f; - test_data2[f] = 2 * (my_rank * 10 + f); - } /* Are we providing a fill value? */ if (provide_fill) @@ -169,9 +148,6 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank /* sprintf(filename, "data_%s_iotype_%d.nc", TEST_NAME, flavor[fmt]); */ sprintf(filename, "data__iotype_.nc"); - /* Start the clock. */ - gettimeofday(&starttime, NULL); - /* Create the netCDF output file. */ if ((ret = PIOc_createfile(iosysid, &ncid, &flavor[fmt], filename, PIO_CLOBBER))) ERR(ret); @@ -193,74 +169,41 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank if ((ret = PIOc_enddef(ncid))) ERR(ret); - /* Set the value of the record dimension. */ - if ((ret = PIOc_setframe(ncid, varid, 0))) - ERR(ret); + /* Start the clock. */ + gettimeofday(&starttime, NULL); - /* Write the data. */ - if ((ret = PIOc_write_darray(ncid, varid, ioid, arraylen, test_data, fillvalue))) - ERR(ret); + for (int t = 0; t < NUM_TIMESTEPS; t++) + { + /* Initialize some data. */ + for (int f = 0; f < arraylen; f++) + test_data[f] = (my_rank * 10 + f) * t; - /* Set the value of the record dimension to the second record. */ - if ((ret = PIOc_setframe(ncid, varid, 1))) - ERR(ret); + /* Set the value of the record dimension. */ + if ((ret = PIOc_setframe(ncid, varid, t))) + ERR(ret); - /* Write the data for the second record. */ - if ((ret = PIOc_write_darray(ncid, varid, ioid, arraylen, test_data2, fillvalue))) - ERR(ret); + /* Write the data. */ + if ((ret = PIOc_write_darray(ncid, varid, ioid, arraylen, test_data, fillvalue))) + ERR(ret); - /* Close the netCDF file. */ - if ((ret = PIOc_closefile(ncid))) - ERR(ret); + } /* Stop the clock. */ gettimeofday(&endtime, NULL); + /* Close the netCDF file. */ + if ((ret = PIOc_closefile(ncid))) + ERR(ret); + /* Compute the time delta */ startt = (1000000 * starttime.tv_sec) + starttime.tv_usec; endt = (1000000 * endtime.tv_sec) + endtime.tv_usec; delta = (endt - startt)/NUM_TIMESTEPS; if (!my_rank) printf("%d\t%d\t%d\t%lld\n", rearranger, provide_fill, fmt, delta); - - /* Reopen the file. */ - if ((ret = PIOc_openfile(iosysid, &ncid2, &flavor[fmt], filename, PIO_NOWRITE))) - ERR(ret); - - /* Set the value of the record dimension. */ - if ((ret = PIOc_setframe(ncid2, varid, 0))) - ERR(ret); - - /* Read the data. */ - if ((ret = PIOc_read_darray(ncid2, varid, ioid, arraylen, test_data_in))) - ERR(ret); - - /* Check the results. */ - for (int f = 0; f < arraylen; f++) - if (test_data_in[f] != test_data[f]) - return ERR_WRONG; - - /* Set the value of the record dimension to the second record. */ - if ((ret = PIOc_setframe(ncid2, varid, 1))) - ERR(ret); - - /* Read the data. */ - if ((ret = PIOc_read_darray(ncid2, varid, ioid, arraylen, test_data_in))) - ERR(ret); - - /* Check the results. */ - for (int f = 0; f < arraylen; f++) - if (test_data_in[f] != test_data2[f]) - return ERR_WRONG; - - /* Close the netCDF file. */ - if ((ret = PIOc_closefile(ncid2))) - ERR(ret); } free(test_data); - free(test_data2); - free(test_data_in); return PIO_NOERR; } From 24028956e7f05d937396113406ab65319f1b48e1 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 1 Apr 2019 03:44:47 -0600 Subject: [PATCH 2/3] more work on performance program --- tests/cunit/test_perf2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cunit/test_perf2.c b/tests/cunit/test_perf2.c index 56806e5dc5a..75995b879bc 100644 --- a/tests/cunit/test_perf2.c +++ b/tests/cunit/test_perf2.c @@ -145,8 +145,8 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank long long delta; /* Create the filename. */ - /* sprintf(filename, "data_%s_iotype_%d.nc", TEST_NAME, flavor[fmt]); */ - sprintf(filename, "data__iotype_.nc"); + sprintf(filename, "data_%s_iotype_%d_rearr_%d.nc", TEST_NAME, flavor[fmt], + rearranger); /* Create the netCDF output file. */ if ((ret = PIOc_createfile(iosysid, &ncid, &flavor[fmt], filename, PIO_CLOBBER))) From 8ba35c2de4b95231545756052272eb63758303a2 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 1 Apr 2019 11:25:30 -0600 Subject: [PATCH 3/3] changs to performance measuring program --- tests/cunit/test_perf2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cunit/test_perf2.c b/tests/cunit/test_perf2.c index 75995b879bc..a00bb2e536c 100644 --- a/tests/cunit/test_perf2.c +++ b/tests/cunit/test_perf2.c @@ -11,10 +11,10 @@ #include /* The number of tasks this test should run on. */ -#define TARGET_NTASKS 4 +#define TARGET_NTASKS 16 /* The minimum number of tasks this test should run on. */ -#define MIN_NTASKS 4 +#define MIN_NTASKS TARGET_NTASKS /* The name of this test. */ #define TEST_NAME "test_perf2" @@ -35,7 +35,7 @@ /* The length of our sample data along each dimension. */ #define X_DIM_LEN 512 #define Y_DIM_LEN 512 -#define Z_DIM_LEN 64 +#define Z_DIM_LEN 512 /* This is the length of the map for each task. */ #define EXPECTED_MAPLEN (X_DIM_LEN * Y_DIM_LEN * Z_DIM_LEN / TARGET_NTASKS) @@ -176,7 +176,7 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank { /* Initialize some data. */ for (int f = 0; f < arraylen; f++) - test_data[f] = (my_rank * 10 + f) * t; + test_data[f] = (my_rank * 10 + f) + t * 1000; /* Set the value of the record dimension. */ if ((ret = PIOc_setframe(ncid, varid, t)))