summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishwanath Venkatesan <vish@hdfgroup.org>2013-08-16 22:28:46 (GMT)
committerVishwanath Venkatesan <vish@hdfgroup.org>2013-08-16 22:28:46 (GMT)
commit3d6f13a43812ca8af0c158817673518d1654823f (patch)
tree8fa595473845b3b6d71eccb142ac267b3889ac4e
parent38f6eecef077daaaf0ff97e378503604179d3e40 (diff)
downloadhdf5-3d6f13a43812ca8af0c158817673518d1654823f.zip
hdf5-3d6f13a43812ca8af0c158817673518d1654823f.tar.gz
hdf5-3d6f13a43812ca8af0c158817673518d1654823f.tar.bz2
[svn-r24016] Fixes to the benchmark.
-rw-r--r--benchmark/FFbench/Makefile2
-rw-r--r--benchmark/FFbench/eff_benchmark.c91
-rw-r--r--benchmark/FFbench/ffbench.c226
-rw-r--r--benchmark/FFbench/ffbench.h13
-rw-r--r--benchmark/FFbench/ffbench_common.h2
-rw-r--r--benchmark/FFbench/test_config8
6 files changed, 318 insertions, 24 deletions
diff --git a/benchmark/FFbench/Makefile b/benchmark/FFbench/Makefile
index 51b5644..3b5c194 100644
--- a/benchmark/FFbench/Makefile
+++ b/benchmark/FFbench/Makefile
@@ -18,6 +18,6 @@ ffbench_util.o: ffbench_util.c ffbench_util.h ffbench_common.h
server:
$(CC) -o server test_server.c
clean:
- rm -rf *.o *~ *.cfg
+ rm -rf *.o *~ *.cfg *.h5
rm -rf test/*~ test/test_clock
rm -rf eff_bench server
diff --git a/benchmark/FFbench/eff_benchmark.c b/benchmark/FFbench/eff_benchmark.c
index f7e43a9..861e3bf 100644
--- a/benchmark/FFbench/eff_benchmark.c
+++ b/benchmark/FFbench/eff_benchmark.c
@@ -31,8 +31,15 @@ int main (int argc, char **argv){
int ret_value = FFB_SUCCESS;
hid_t file_id, dset_id;
hid_t fapl_id;
- int rank;
+ int rank, ret = FFB_SUCCESS;
int size;
+ hid_t *f_dataspaces, *m_dataspaces;
+ hid_t event_q, int_id;
+ int num_requests = 0;
+ H5_status_t *status = NULL;
+ hsize_t **count=NULL, **offset=NULL;
+ int num_dataspaces, i;
+ int *data = NULL, k ,j, count_size = 1;
MPI_Init_thread(&argc,&argv, MPI_THREAD_MULTIPLE, &provided);
if(MPI_THREAD_MULTIPLE != provided) {
@@ -41,8 +48,10 @@ int main (int argc, char **argv){
goto exit;
}
+ EFF_init (comm, info);
if (argc < 2){
- DEBUG_LINE ("Configuration file needed to start \n")
+ DEBUG_ERROR ("Error!!! Configuration file needed to start \n")
+ EFF_finalize();
MPI_Finalize();
goto exit;
}
@@ -51,19 +60,91 @@ int main (int argc, char **argv){
MPI_Comm_size(comm, &size);
FFbench_read_config_file (argv[1], comm);
- FFbench_print_args();
- EFF_init (comm, info);
+ if (!rank){
+ fprintf(stdout, "\n\n*****************************************\n");
+ fprintf(stdout, "EFF Benchmark Suite\nBenchmark Settings\n");
+ fprintf(stdout, "*****************************************\n\n");
+ FFbench_print_args();
+ fprintf(stdout, "*****************************************\n\n");
+ }
+
+
if (FFB_SUCCESS != FFbench_create_file_and_dataset (&file_id,
&dset_id,
&fapl_id,
rank,
comm,
info)){
- DEBUG_LINE("Error in File/dataset creation")
+ DEBUG_ERROR("Error in File/dataset creation")
}
+ if (FFB_SUCCESS != FFbench_create_dataspaces(&f_dataspaces,
+ &m_dataspaces,
+ &num_dataspaces,
+ &count,
+ &offset,
+ rank,
+ size)){
+ DEBUG_ERROR("Error in creating datasets for the benchmark\n");
+ }
+
+ event_q = H5EQcreate(fapl_id);
+ assert(event_q);
+
+
+ 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);
+
+ 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);
+ }
+
+
+ if (f_dataspaces)
+ free(f_dataspaces);
+ if (m_dataspaces)
+ free(m_dataspaces);
+ if (count){
+ for (i = 0; i < num_dataspaces; i++)
+ free(count[i]);
+ free(count);
+ }
+
+ if (offset){
+ for (i = 0; i < num_dataspaces; i++)
+ free(offset[i]);
+ free(offset);
+ }
H5Pclose(fapl_id);
diff --git a/benchmark/FFbench/ffbench.c b/benchmark/FFbench/ffbench.c
index d95c28c..2dc11a6 100644
--- a/benchmark/FFbench/ffbench.c
+++ b/benchmark/FFbench/ffbench.c
@@ -188,26 +188,41 @@ void FFbench_print_args(){
hsize_t j;
- DEBUG_PRINT("Filename %s, Dataset: %s, ncoords: %lli, rw: %d, overlap: %d \n",
- input_args->filename,
- input_args->dsetname,
- input_args->n_coords,
- input_args->rw_flag,
- input_args->overlap)
-
- for (j =0; j< input_args->n_coords;
+ fprintf(stdout, "Filename: %s \nDataset Name: %s \nncoords: %lli \n",
+ input_args->filename,
+ input_args->dsetname,
+ input_args->n_coords);
+
+ fprintf (stdout, "Coords: {");
+ for (j =0; j< input_args->n_coords - 1;
j++){
- DEBUG_PRINT("coord[%lli]: %lli\n",j , input_args->coords[j])
+ fprintf(stdout,"%lli, ",input_args->coords[j]);
}
-
+ fprintf (stdout, "%lli}\n",
+ input_args->coords[input_args->n_coords - 1]);
+ if (input_args->rw_flag == WRITE){
+ fprintf (stdout, "Perform %d WRITE operation\n",
+ input_args->num_ops);
+ }
+ else{
+ fprintf (stdout, "Perform %d READ operation\n",
+ input_args->num_ops);
+ }
+ if (input_args->overlap == 0){
+ fprintf (stdout,"Overlap : NO \n");
+ }
+ else
+ fprintf (stdout,"Overlap : YES \n");
}
/*-------------------------------------------------------------------------
- * Function: FFbench_create_file
+ * Function: FFbench_create_file_and_dataset
*
- * Purpose : Function to read the config file for the benchmark
+ * Purpose : 1. Creates a file and a dataset using one process
+ * 2. Closes the file and dataset
+ * 3. Opens the file in all the other processes.
*
* Return: SUCCESS : FFB_SUCCESS
* FAILURE : FFB_FAIL
@@ -217,7 +232,6 @@ void FFbench_print_args(){
*--------------------------------------------------------------------------
*/
-
int FFbench_create_file_and_dataset (hid_t *file_id, hid_t *dset_id,
hid_t *fapl_id,
int rank,
@@ -244,6 +258,8 @@ int FFbench_create_file_and_dataset (hid_t *file_id, hid_t *dset_id,
j++){
dimsf[j] = input_args->coords[j];
}
+
+
dataspace = H5Screate_simple (input_args->n_coords,
dimsf,
NULL);
@@ -269,10 +285,192 @@ int FFbench_create_file_and_dataset (hid_t *file_id, hid_t *dset_id,
*file_id = H5Fopen(input_args->filename, H5F_ACC_RDWR, *fapl_id);
*dset_id = H5Dopen(*file_id,
input_args->dsetname,H5P_DEFAULT);
+
+ exit:
+ if (!rank){
+ if (dimsf)
+ free(dimsf);
+ }
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: FFbench_create_dataspaces
+ *
+ * Purpose : Creates all the required dataspaces for the given
+ * scenario of write/read.
+ *
+ * Return: SUCCESS : FFB_SUCCESS
+ * FAILURE : FFB_FAIL
+ *
+ * Programmer: Vishwanath Venkatesan
+ * August, 2013
+ *--------------------------------------------------------------------------
+ */
+
+int FFbench_create_dataspaces(hid_t **f_dataspaces,
+ hid_t **m_dataspaces,
+ int *_num_dataspaces,
+ hsize_t ***_count,
+ hsize_t ***_offset,
+ int rank,
+ int size){
+
+
+ hid_t *memory_spaces = NULL;
+ hid_t *file_spaces = NULL;
+ int num_dataspaces = 0, i =0;
+ hsize_t coords = 0, j = 0;
+ hsize_t **count = NULL;
+ hsize_t **offset = NULL;
+ hsize_t *dimsf = NULL;
+ int ret_value = FFB_SUCCESS;
+
+ dimsf = (hsize_t *) malloc (input_args->n_coords *
+ sizeof(hsize_t));
+ if (NULL == dimsf){
+ DEBUG_ERROR ("Error in allocation dimsf")
+ ret_value = FFB_FAIL;
+ }
-
+ for (j = 0; j < input_args->n_coords;
+ j++){
+ dimsf[j] = input_args->coords[j];
+ }
+
+ if (!input_args->overlap){
+
+ if ( input_args->n_coords > 1){
+ coords = input_args->coords[1];
+ }
+ else
+ coords = input_args->coords[0];
+ if (((coords %(input_args->num_ops * size)) == 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\n")
+ ret_value = FFB_FAIL;
+ }
+
+ count = (hsize_t **)malloc (num_dataspaces *
+ sizeof(hsize_t *));
+ if (NULL == count){
+ DEBUG_ERROR ("Error Allocating count array\n")
+ ret_value = FFB_FAIL;
+ }
+
+ offset = (hsize_t **) malloc (num_dataspaces *
+ sizeof(hsize_t *));
+ if (NULL == offset){
+ DEBUG_ERROR ("Error while allocating offset \n")
+ 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[1]/(size * input_args->num_ops);
+ for (j = 1; j < input_args->n_coords; j++){
+ count[0][j] = dimsf[j];
+ }
+ offset[0][0] = rank * count[0][0];
+ offset[0][1] = 0;
+ for ( i = 1; i < num_dataspaces; i++){
+ count[i][0] = dimsf[1]/(size * 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] + size * count[i][0];
+
+ }
+
+ 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);
+
+
+ }
+ }
+ else{
+
+ if (size > 1){
+ DEBUG_ERROR("Overlap write measurements cannot happen on more than one node\n");
+ ret_value = FFB_FAIL;
+ }
+
+
+
+ }
+
+
+ if (dimsf)
+ free(dimsf);
exit:
+ *m_dataspaces = memory_spaces;
+ *f_dataspaces = file_spaces;
+ *_num_dataspaces = num_dataspaces;
+ *_count = count;
+ *_offset = offset;
+
+
return ret_value;
}
diff --git a/benchmark/FFbench/ffbench.h b/benchmark/FFbench/ffbench.h
index ffbba6a..daa6f5e 100644
--- a/benchmark/FFbench/ffbench.h
+++ b/benchmark/FFbench/ffbench.h
@@ -1,3 +1,5 @@
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
@@ -59,5 +61,16 @@ int FFbench_create_file_and_dataset (hid_t *file_id, hid_t *dset_id,
MPI_Info info);
+int FFbench_create_dataspaces(hid_t **f_dataspaces,
+ hid_t **m_dataspaces,
+ int *_num_dataspaces,
+ hsize_t ***_count,
+ hsize_t ***_offset,
+ int rank,
+ int size);
+
+
+
+
#endif
diff --git a/benchmark/FFbench/ffbench_common.h b/benchmark/FFbench/ffbench_common.h
index 9fa2558..5fbc66d 100644
--- a/benchmark/FFbench/ffbench_common.h
+++ b/benchmark/FFbench/ffbench_common.h
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#define FFB_SUCCESS 0
#define FFB_FAIL -1
@@ -43,6 +44,7 @@ typedef unsigned long long length_t;
#define DEBUG_LINE(text)
#endif
+#define DEBUG_ERROR(text) fprintf(stderr,text);
#endif /*FFBENCH_COMMON*/
diff --git a/benchmark/FFbench/test_config b/benchmark/FFbench/test_config
index 70aac27..7334cd7 100644
--- a/benchmark/FFbench/test_config
+++ b/benchmark/FFbench/test_config
@@ -12,11 +12,11 @@
# number of read/writes
# Overlap flag
# --------------------------------------
-efffile.h5
+eff_file.h5
D1
2
-16
-16
+12288
+12288
WRITE
-10
+16
0 \ No newline at end of file