diff options
author | Vishwanath Venkatesan <vish@hdfgroup.org> | 2013-08-21 21:48:17 (GMT) |
---|---|---|
committer | Vishwanath Venkatesan <vish@hdfgroup.org> | 2013-08-21 21:48:17 (GMT) |
commit | 6bdf45c74ae6e35cc9e934328fb8207b0a716288 (patch) | |
tree | b3add7dc7fe58a3220bf8400bea2316118725c69 | |
parent | 51787c94a84a5e9252d648699d5924f3be424cf3 (diff) | |
download | hdf5-6bdf45c74ae6e35cc9e934328fb8207b0a716288.zip hdf5-6bdf45c74ae6e35cc9e934328fb8207b0a716288.tar.gz hdf5-6bdf45c74ae6e35cc9e934328fb8207b0a716288.tar.bz2 |
[svn-r24052] Adding tests for Write-morphing also!
-rw-r--r-- | benchmark/FFbench/eff_benchmark.c | 125 | ||||
-rw-r--r-- | benchmark/FFbench/ffbench.c | 108 | ||||
-rw-r--r-- | benchmark/FFbench/ffbench_common.h | 1 | ||||
-rw-r--r-- | benchmark/FFbench/test_config | 8 |
4 files changed, 192 insertions, 50 deletions
diff --git a/benchmark/FFbench/eff_benchmark.c b/benchmark/FFbench/eff_benchmark.c index 114f106..d011484 100644 --- a/benchmark/FFbench/eff_benchmark.c +++ b/benchmark/FFbench/eff_benchmark.c @@ -38,8 +38,9 @@ int main (int argc, char **argv){ int num_requests = 0; H5_status_t *status = NULL; hsize_t **count=NULL, **offset=NULL; - int num_dataspaces, i; + int num_dataspaces, i, l; int *data = NULL, k ,j, count_size = 1; + int **data_overlap=NULL; double start, end; double totallength = 0; double totaltime = 0, max_time; @@ -95,64 +96,98 @@ int main (int argc, char **argv){ event_q = H5EQcreate(fapl_id); assert(event_q); - - start = MPI_Wtime(); - - for (i = 0; i < num_dataspaces; i++){ - count_size = 1; - - for ( j = 0; j < input_args->n_coords; j++){ - count_size *= count[i][j]; - } - - data = (int *) malloc - (sizeof(int)*count_size); + if (!input_args->overlap){ + start = MPI_Wtime(); - totallength += count_size * sizeof(int); - - for (k=0; k < count_size; k++) { - data[k] = rank + 1001 + i; - } - - ret = H5Dwrite_ff(dset_id, - H5T_NATIVE_INT, - m_dataspaces[i], - f_dataspaces[i], - H5P_DEFAULT, - data, - 0, - event_q); - assert(ret == 0); - - + for (i = 0; i < num_dataspaces; i++){ + + count_size = 1; + + for ( j = 0; j < input_args->n_coords; j++){ + count_size *= count[i][j]; + } + + data = (int *) malloc + (sizeof(int)*count_size); + + totallength += count_size * sizeof(int); + + for (k=0; k < count_size; k++) { + data[k] = rank + 1001 + i; + } + + ret = H5Dwrite_ff(dset_id, + H5T_NATIVE_INT, + m_dataspaces[i], + f_dataspaces[i], + H5P_DEFAULT, + data, + 0, + event_q); + assert(ret == 0); + + H5EQwait(event_q, &num_requests, &status); free(status); if (data) free (data); + } + end = MPI_Wtime(); + totaltime = difftime (end, start); + totallength *= size; + + MPI_Reduce(&totaltime, &max_time, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); } - end = MPI_Wtime(); - totaltime = difftime (end, start); - totallength *= size; - - - MPI_Reduce(&totaltime, &max_time, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); - - if (!rank){ + else{ + start = MPI_Wtime(); + for (i = 0; i < num_dataspaces; i+=NUM_BUFFERS){ + count_size = 1; + for ( j = 0; j < input_args->n_coords; j++){ + count_size *= count[i][j]; + } + + data_overlap = (int **)malloc (NUM_BUFFERS * sizeof(int *)); + for (l = 0; l < 8; l++){ + data_overlap[l] = (int *) malloc (sizeof(int) * count_size); + totallength += count_size * sizeof(int); + for (k = 0; k < count_size; k++){ + data_overlap[l][k] = rank + 1001 + i + l; + } + ret = H5Dwrite_ff(dset_id, + H5T_NATIVE_INT, + m_dataspaces[i+l], + f_dataspaces[i+l], + H5P_DEFAULT, + data_overlap[l], + 0, + event_q); + assert(ret == 0); + } + H5EQwait (event_q, &num_requests, &status); + free(status); + if (data_overlap){ + for (l = 0; l < NUM_BUFFERS; l ++){ + free(data_overlap[l]); + } + free(data_overlap); + } + } + end = MPI_Wtime(); + totaltime = difftime(end, start); + } + + if (!rank){ + totallength /= 1024*1024; - - - fprintf (stderr, - "Approx. %lf MB data took %lf(s) with write bandwidth of %lf MB/s\n", + "Approx. %lf MB data took %lf(s)\n", totallength, - max_time, - totallength/max_time); + max_time); } - if (f_dataspaces) free(f_dataspaces); diff --git a/benchmark/FFbench/ffbench.c b/benchmark/FFbench/ffbench.c index c0515a2..76d44a7 100644 --- a/benchmark/FFbench/ffbench.c +++ b/benchmark/FFbench/ffbench.c @@ -324,7 +324,7 @@ int FFbench_create_dataspaces(hid_t **f_dataspaces, hsize_t coords = 0, j = 0; hsize_t **count = NULL; hsize_t **offset = NULL; - hsize_t *dimsf = NULL; + hsize_t *dimsf = NULL, tmp = 0; int ret_value = FFB_SUCCESS; dimsf = (hsize_t *) malloc (input_args->n_coords * @@ -457,8 +457,114 @@ int FFbench_create_dataspaces(hid_t **f_dataspaces, ret_value = FFB_FAIL; } + if ( input_args->n_coords > 1){ + coords = input_args->coords[1]; + } + else + coords = input_args->coords[0]; + + if (((coords % (input_args->num_ops)) == 0)){ + + num_dataspaces = input_args->num_ops; + + if (num_dataspaces < 1){ + DEBUG_ERROR ("Error num_dataspaces cannot be less than 1"); + ret_value = FFB_FAIL; + } + } + else{ + DEBUG_ERROR("ERROR! the Y coords are not exactly divisible \n"); + ret_value = FFB_FAIL; + } + + memory_spaces = (hid_t *) malloc (num_dataspaces * + sizeof(hid_t)); + if (NULL == memory_spaces){ + DEBUG_ERROR ("Error allocating memory spaces \n"); + ret_value = FFB_FAIL; + } + file_spaces = (hid_t *) malloc (num_dataspaces * + sizeof(hid_t)); + if (NULL == file_spaces){ + DEBUG_ERROR ("Error Allocating file spaces"); + ret_value = FFB_FAIL; + } + + count = (hsize_t **) malloc (num_dataspaces * + sizeof(hsize_t *)); + if (NULL == count){ + DEBUG_ERROR ("Error Allocation count array"); + ret_value = FFB_FAIL; + } + + offset = (hsize_t **) malloc (num_dataspaces * + sizeof(hsize_t *)); + if (NULL == offset){ + DEBUG_ERROR ("Error Allocating offset array"); + ret_value = FFB_FAIL; + } + for (i = 0; i < num_dataspaces; i++){ + + count[i] = (hsize_t *) malloc (input_args->n_coords * + sizeof(hsize_t)); + if (NULL == count[i]){ + DEBUG_ERROR ("Error while allocating count[i] \n"); + ret_value = FFB_FAIL; + } + + offset[i]= (hsize_t *) malloc (input_args->n_coords * + sizeof(hsize_t)); + if (NULL == offset[i]){ + DEBUG_ERROR ("Error while allocating offset[i] \n"); + ret_value = FFB_FAIL; + } + + file_spaces[i] = H5Screate_simple(input_args->n_coords, + dimsf, + NULL); + } + + count[0][0] = dimsf[0]/(input_args->num_ops); + for (j = 1; j < input_args->n_coords; j++){ + count[0][j] = dimsf[j]; + } + + offset[0][0] = rank; + offset[0][1] = 0; + for (i = 1; i< num_dataspaces; i++){ + count[i][0] = dimsf[0]/(input_args->num_ops) ; + for (j = 1; j< input_args->n_coords; j++){ + count[i][j] = dimsf[j]; + offset[i][j] = 0; + } + offset[i][0] = offset[i - 1][0] + count[i][0] - (count[i-1][0]/4); + } + + + for (i = 0; i< num_dataspaces; i++){ +#if 0 + DEBUG_PRINT("%d: count[%d][0]: %lli, count[%d][1]: %lli off[%d][0]: %lli, off[%d][1]: %lli\n", + rank, i, count[i][0], i, count[i][1], i, offset[i][0], i, offset[i][1]); +#endif + + memory_spaces[i] = H5Screate_simple(input_args->n_coords, + count[i], + NULL); + + H5Sselect_hyperslab (file_spaces[i], + H5S_SELECT_SET, + offset[i], + NULL, + count[i], + NULL); + + + } + + + } diff --git a/benchmark/FFbench/ffbench_common.h b/benchmark/FFbench/ffbench_common.h index 581de08..85de570 100644 --- a/benchmark/FFbench/ffbench_common.h +++ b/benchmark/FFbench/ffbench_common.h @@ -30,6 +30,7 @@ #define READ 290 #define WRITE 390 +#define NUM_BUFFERS 8 typedef time_t timer; typedef unsigned long long length_t; diff --git a/benchmark/FFbench/test_config b/benchmark/FFbench/test_config index 6a20be6..b487256 100644 --- a/benchmark/FFbench/test_config +++ b/benchmark/FFbench/test_config @@ -15,8 +15,8 @@ eff_file.h5 D1 2 -1536 -12288 +1024 +1024 WRITE -8 -0
\ No newline at end of file +32 +1
\ No newline at end of file |