Skip to content

Commit

Permalink
changes to test_perf2
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed May 2, 2019
1 parent 72ce726 commit eb49aa9
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions tests/cunit/test_perf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <sys/time.h>

/* The number of tasks this test should run on. */
#define TARGET_NTASKS 1024
#define TARGET_NTASKS 16

/* The minimum number of tasks this test should run on. */
#define MIN_NTASKS TARGET_NTASKS
Expand All @@ -20,7 +20,7 @@
#define TEST_NAME "test_perf2"

/* Number of processors that will do IO. */
#define NUM_IO_PROCS 128
#define NUM_IO_PROCS 1

/* Number of computational components to create. */
#define COMPONENT_COUNT 1
Expand All @@ -33,9 +33,9 @@
#define NDIM3 3

/* The length of our sample data along each dimension. */
#define X_DIM_LEN 512
#define Y_DIM_LEN 512
#define Z_DIM_LEN 512
#define X_DIM_LEN 128
#define Y_DIM_LEN 128
#define Z_DIM_LEN 64

/* This is the length of the map for each task. */
#define EXPECTED_MAPLEN (X_DIM_LEN * Y_DIM_LEN * Z_DIM_LEN / TARGET_NTASKS)
Expand Down Expand Up @@ -112,12 +112,13 @@ int create_decomposition_3d(int ntasks, int my_rank, int iosysid, int *ioid)
* @param num_flavors the number of IOTYPES available in this build.
* @param flavor array of available iotypes.
* @param my_rank rank of this task.
* @param ntasks number of tasks in test_comm.
* @param provide_fill 1 if fillvalue should be provided to PIOc_write_darray().
* @param rearranger the rearranger in use.
* @returns 0 for success, error code otherwise.
*/
int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank,
int provide_fill, int rearranger)
int test_darray(int iosysid, int ioid, int num_flavors, int *flavor,
int my_rank, int ntasks, int provide_fill, int rearranger)
{
char filename[PIO_MAX_NAME + 1]; /* Name for the output files. */
int dimids[NDIM]; /* The dimension IDs. */
Expand All @@ -143,6 +144,9 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
struct timeval starttime, endtime;
long long startt, endt;
long long delta;
float num_megabytes = 0;
float delta_in_sec;
float mb_per_sec;

/* Create the filename. */
sprintf(filename, "data_%s_iotype_%d_rearr_%d.nc", TEST_NAME, flavor[fmt],
Expand Down Expand Up @@ -186,6 +190,7 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
if ((ret = PIOc_write_darray(ncid, varid, ioid, arraylen, test_data, fillvalue)))
ERR(ret);

num_megabytes += (X_DIM_LEN * Y_DIM_LEN * Z_DIM_LEN * sizeof(int))/(1024*1024);
}

/* Stop the clock. */
Expand All @@ -199,8 +204,11 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
startt = (1000000 * starttime.tv_sec) + starttime.tv_usec;
endt = (1000000 * endtime.tv_sec) + endtime.tv_usec;
delta = (endt - startt)/NUM_TIMESTEPS;
delta_in_sec = (float)delta / 1000000;
mb_per_sec = num_megabytes / delta_in_sec;
if (!my_rank)
printf("%d\t%d\t%d\t%lld\n", rearranger, provide_fill, fmt, delta);
printf("%d\t%d\t%d\t%8.3f\t%8.3f\t%8.3f\n", rearranger,
provide_fill, fmt, delta_in_sec, num_megabytes, mb_per_sec);
}

free(test_data);
Expand Down Expand Up @@ -300,13 +308,14 @@ int test_decomp_read_write(int iosysid, int ioid, int num_flavors, int *flavor,
* @param num_flavors number of available iotypes in the build.
* @param flavor pointer to array of the available iotypes.
* @param my_rank rank of this task.
* @param ntasks number of tasks in test_comm.
* @param rearranger the rearranger to use (PIO_REARR_BOX or
* PIO_REARR_SUBSET).
* @param test_comm the communicator the test is running on.
* @returns 0 for success, error code otherwise.
*/
int test_all_darray(int iosysid, int num_flavors, int *flavor, int my_rank,
int rearranger, MPI_Comm test_comm)
int ntasks, int rearranger, MPI_Comm test_comm)
{
int ioid;
int my_test_size;
Expand All @@ -329,7 +338,7 @@ int test_all_darray(int iosysid, int num_flavors, int *flavor, int my_rank,
{
/* Run a simple darray test. */
if ((ret = test_darray(iosysid, ioid, num_flavors, flavor, my_rank,
provide_fill, rearranger)))
ntasks, provide_fill, rearranger)))
return ret;
}

Expand Down Expand Up @@ -372,7 +381,8 @@ int main(int argc, char **argv)
ERR(ret);

if (!my_rank)
printf("rearr\tfill\tformat\ttime\n");
printf("rearr\tfill\tformat\ttime(s)\tdata size (MB)\t"
"performance(MB/s)\n");


for (int r = 0; r < NUM_REARRANGERS_TO_TEST; r++)
Expand All @@ -385,7 +395,7 @@ int main(int argc, char **argv)

/* Run tests. */
if ((ret = test_all_darray(iosysid, num_flavors, flavor, my_rank,
rearranger[r], test_comm)))
ntasks, rearranger[r], test_comm)))
return ret;

/* Finalize PIO system. */
Expand Down

0 comments on commit eb49aa9

Please sign in to comment.