Commit fc935935 authored by Huihuo Zheng's avatar Huihuo Zheng
Browse files

hellp

parent 1a8195a2
......@@ -1233,12 +1233,12 @@ void *H5Dwrite_pthread_func_vol(void *arg) {
pthread_mutex_unlock(&wmm->io.request_lock);
while (loop) {
if (working) {
sleep(1);
thread_data_t *data = wmm->io.current_request;
data->buf = mmap(NULL, data->size, PROT_READ, MAP_SHARED, wmm->mmap.fd, data->offset);
msync(data->buf, data->size, MS_SYNC);
H5VL_pass_through_ext_t *o = (H5VL_pass_through_ext_t *)data->dataset_obj;
void **req;
sleep(5);
#ifdef THETA
wmm->mmap.tmp_buf = malloc(data->size);
memcpy(wmm->mmap.tmp_buf, data->buf, data->size);
......@@ -1276,6 +1276,11 @@ void *H5Dwrite_pthread_func_vol(void *arg) {
pthread_cond_wait(&wmm->io.io_cond, &wmm->io.request_lock);
pthread_mutex_unlock(&wmm->io.request_lock);
}
pthread_mutex_lock(&wmm->io.request_lock);
loop = (wmm->io.num_request>=0);
working = (wmm->io.num_request>0);
done = (wmm->io.num_request==0);
pthread_mutex_unlock(&wmm->io.request_lock);
}
return NULL;
......@@ -1471,6 +1476,7 @@ H5VL_pass_through_ext_dataset_close(void *dset, hid_t dxpl_id, void **req)
#endif
if (o->write_cache) {
if (o->H5DWMM->mpi.rank==0) printf("check dataset_close\n");
pthread_mutex_lock(&o->H5DWMM->io.request_lock);
while(o->num_request_dataset>0) {
pthread_cond_signal(&o->H5DWMM->io.io_cond);
......@@ -1480,7 +1486,7 @@ H5VL_pass_through_ext_dataset_close(void *dset, hid_t dxpl_id, void **req)
}
ret_value = H5VLdataset_close(o->under_object, o->under_vol_id, dxpl_id, req);
if (o->H5DWMM->mpi.rank==0) printf("dataset_closed\n");
/* Check for async request */
if(req && *req)
*req = H5VL_pass_through_ext_new_obj(*req, o->under_vol_id);
......@@ -2077,23 +2083,32 @@ H5VL_pass_through_ext_file_close(void *file, hid_t dxpl_id, void **req)
if (o->write_cache) {
if (o->H5DWMM->mpi.rank==0) printf("file_close\n");
pthread_mutex_lock(&o->H5DWMM->io.request_lock);
while(o->H5DWMM->io.num_request>0) {
bool loop = (o->H5DWMM->io.num_request>0);
pthread_mutex_unlock(&o->H5DWMM->io.request_lock);
if (o->H5DWMM->mpi.rank==0) printf("o->H5DWMM->io.num_request: %d\n", o->H5DWMM->io.num_request);
while(loop) {
printf("upload\n");
pthread_mutex_lock(&o->H5DWMM->io.request_lock);
pthread_cond_signal(&o->H5DWMM->io.io_cond);
pthread_cond_wait(&o->H5DWMM->io.master_cond, &o->H5DWMM->io.request_lock);
loop = (o->H5DWMM->io.num_request==0);
pthread_mutex_unlock(&o->H5DWMM->io.request_lock);
}
pthread_mutex_unlock(&o->H5DWMM->io.request_lock);
pthread_mutex_lock(&o->H5DWMM->io.request_lock);
o->H5DWMM->io.num_request=-1;
pthread_cond_signal(&o->H5DWMM->io.io_cond);
pthread_mutex_unlock(&o->H5DWMM->io.request_lock);
if (o->H5DWMM->mpi.rank==0) printf("o->H5DWMM->io.num_request: %d\n", o->H5DWMM->io.num_request);
if (o->H5DWMM->mpi.rank==0) printf("joining\n");
pthread_join(o->H5DWMM->io.pthread, NULL);
if (o->H5DWMM->mpi.rank==0) printf("joined\n");
close(o->H5DWMM->mmap.fd);
remove(o->H5DWMM->mmap.fname);
o->H5DWMM->ssd->mspace_left = o->H5DWMM->ssd->mspace_total;
}
ret_value = H5VLfile_close(o->under_object, o->under_vol_id, dxpl_id, req);
if (o->H5DWMM->mpi.rank==0) printf("file_closed\n");
/* Check for async request */
if(req && *req)
*req = H5VL_pass_through_ext_new_obj(*req, o->under_vol_id);
......
......@@ -7,7 +7,7 @@ LIBS=-L$(HDF5_DIR)/lib -lhdf5 -lz
#DEBUG=-DENABLE_EXT_PASSTHRU_LOGGING
CFLAGS=$(INCLUDES) $(LIBS)
TARGET=libh5passthrough_vol.dylib
TARGET=libh5passthrough_vol.so
CXX=mpicxx -DTHETA
all: makeso test_write_cache
......
......@@ -77,7 +77,6 @@ int main(int argc, char **argv) {
MPI_Info info = MPI_INFO_NULL;
int rank, nproc, provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
MPI_Comm_size(comm, &nproc);
MPI_Comm_rank(comm, &rank);
if (rank==0) cout << "provided: " << provided << endl;
......
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