Commit 400350a9 authored by Huihuo Zheng's avatar Huihuo Zheng
Browse files

changed function API

parent 30624b91
......@@ -27,7 +27,7 @@ struct H5Dio_mmap {
hid_t datatype; //
bool batch_contig;
vector<int> batch_list;
MPI_Datatype buf_type;
MPI_Datatype buf_type; // we construct a datatype construct
MPI_Win win;
pthread_t pthread;
pthread_cond_t master_cond;
......
......@@ -211,11 +211,10 @@ hid_t H5Fcreate_cache( const char *name, unsigned flags, hid_t fcpl_id, hid_t fa
herr_t
H5Dwrite_cache(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, const void *buf) {
// H5Fwait();
hsize_t size = get_buf_size(mem_space_id, mem_type_id);
if (H5SSD.mspace_per_rank_left < size) {
H5Fwait();
H5PthreadWait();
H5SSD.offset=0;
H5SSD.mspace_per_rank_left = H5SSD.mspace_per_rank_total;
}
......@@ -248,7 +247,7 @@ H5Dwrite_cache(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
/*
Wait for the pthread to finish all the I/O request
*/
void H5Fwait() {
void H5PthreadWait() {
pthread_mutex_lock(&H5SSD.request_lock);
while(H5SSD.num_request>0) {
pthread_cond_signal(&H5SSD.io_cond);
......@@ -260,7 +259,7 @@ void H5Fwait() {
/*
Terminate the pthread through joining
*/
void H5TerminatePthread() {
void H5PthreadTerminate() {
pthread_mutex_lock(&H5SSD.request_lock);
H5SSD.num_request=-1;
pthread_cond_signal(&H5SSD.io_cond);
......@@ -273,8 +272,8 @@ void H5TerminatePthread() {
and terminate the pthread, remove the files on the SSD.
*/
herr_t H5Fclose_cache( hid_t file_id ) {
H5Fwait();
H5TerminatePthread();
H5PthreadWait();
H5PthreadTerminate();
close(H5SSD.fd);
remove(H5SSD.fname);
H5SSD.mspace_left = H5SSD.mspace_total;
......@@ -285,7 +284,7 @@ herr_t H5Fclose_cache( hid_t file_id ) {
Wait for pthread to finish the work and close the property
*/
herr_t H5Pclose_cache(hid_t dxf_id) {
H5Fwait();
H5PthreadWait();
return H5Pclose(dxf_id);
}
......@@ -293,7 +292,7 @@ herr_t H5Pclose_cache(hid_t dxf_id) {
Wait for pthread to finish the work and close the dataset
*/
herr_t H5Dclose_cache(hid_t dset_id) {
H5Fwait();
H5PthreadWait();
return H5Dclose(dset_id);
}
......@@ -302,6 +301,6 @@ herr_t H5Dclose_cache(hid_t dset_id) {
Wait for the pthread to finish the work and close the memory space
*/
herr_t H5Sclose_cache(hid_t filespace) {
H5Fwait();
H5PthreadWait();
return H5Sclose(filespace);
}
......@@ -12,7 +12,7 @@ herr_t H5Dwrite_cache(hid_t dset_id, hid_t mem_type_id,
herr_t H5Dclose_cache( hid_t id);
herr_t H5Pclose_cache( hid_t id);
herr_t H5Sclose_cache( hid_t id);
void H5Fwait();
void H5PthreadWait();
void test_mmap_buf();
......
......@@ -4,8 +4,8 @@ include make.inc
all: parallel_hdf5
parallel_hdf5: H5SSD.o parallel_hdf5.o
$(CXX) $(CFLAGS) -I./ -o parallel_hdf5.x parallel_hdf5.o H5SSD.o $(LIBS)
parallel_hdf5: H5SSD.o parallel_hdf5.o ../utils/debug.o
$(CXX) $(CFLAGS) -I./ -o parallel_hdf5.x parallel_hdf5.o H5SSD.o ../utils/debug.o $(LIBS)
parallel_hdf5.o : parallel_hdf5.cpp
$(CXX) $(CFLAGS) -o parallel_hdf5.o -c parallel_hdf5.cpp
H5SSD.o : H5SSD.c
......
......@@ -19,6 +19,7 @@
#include <sys/statvfs.h>
#include <stdlib.h>
#include "stat.h"
#include "debug.h"
int msleep(long miliseconds)
{
struct timespec req, rem;
......@@ -45,7 +46,7 @@ int main(int argc, char **argv) {
if (strcmp(ssd_cache, "yes")==0) {
cache=true;
}
Timing tt;
// Assuming that the dataset is a two dimensional array of 8x5 dimension;
int d1 = 2048;
int d2 = 2048;
......@@ -77,6 +78,7 @@ int main(int argc, char **argv) {
MPI_Init(&argc, &argv);
MPI_Comm_size(comm, &nproc);
MPI_Comm_rank(comm, &rank);
Timing tt(rank==io_node());
//printf(" MPI: I am rank %d of %d \n", rank, nproc);
// find local array dimension and offset;
hsize_t gdims[2] = {d1*nproc, d2};
......@@ -179,7 +181,6 @@ int main(int argc, char **argv) {
stat(&tt["H5Dwrite"].t_iter[0], niter, avg, std, 'i');
if (rank==0) printf(" Write rate: %f +/- %f MB/s\n", size*avg/niter/1024/1024, size/niter*std/1024/1024);
tt.PrintTiming(master);
MPI_Finalize();
return 0;
}
......@@ -23,8 +23,8 @@ if hostname.find("theta")!=-1:
parser.add_argument("--num_nodes", default=int(os.environ['COBALT_JOBSIZE']), type=int)
parser.add_argument("--ppn", default=32, type=int)
else:
# root="/Users/zhenghh/Documents/Research/ExaHDF5/io_benchmarks/ssd_cache/hdf5/"
root="/gpfs/mira-home/hzheng/io_benchmarks/node_local_storage/hdf5/"
root="/Users/zhenghh/Documents/Research/ExaHDF5/io_benchmarks/ssd_cache/hdf5/"
# root="/gpfs/mira-home/hzheng/io_benchmarks/node_local_storage/hdf5/"
parser.add_argument("--num_nodes", default=1, type=int)
parser.add_argument("--SSD", default="SSD")
parser.add_argument("--ppn", default=2, type=int)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment