Commit 0603c6f2 authored by Huihuo Zheng's avatar Huihuo Zheng
Browse files

fixed mutex issue

parent 26798857
......@@ -1325,6 +1325,7 @@ H5VL_pass_through_ext_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_spa
#endif
if (o->write_cache) {
hsize_t size = get_buf_size(mem_space_id, mem_type_id);
H5TSmutex_release();
if (o->H5DWMM->ssd->mspace_per_rank_left < size) {
pthread_mutex_lock(&o->H5DWMM->io.request_lock);
while(o->H5DWMM->io.num_request>0) {
......@@ -1369,6 +1370,9 @@ H5VL_pass_through_ext_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_spa
pthread_mutex_unlock(&o->H5DWMM->io.request_lock);
//
ret_value=SUCCEED;
hbool_t acq=false;
while(!acq)
H5TSmutex_acquire(&acq);
} else {
ret_value = H5VLdataset_write(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req);
if(req && *req)
......@@ -1811,7 +1815,7 @@ H5VL_pass_through_ext_file_create(const char *name, unsigned flags, hid_t fcpl_i
file->H5DWMM->io.request_list = (thread_data_t*) malloc(sizeof(thread_data_t));
file->H5DWMM->ssd->mspace_per_rank_total = file->H5DWMM->ssd->mspace_total / file->H5DWMM->mpi.ppn;
file->H5DWMM->ssd->mspace_per_rank_left = file->H5DWMM->ssd->mspace_per_rank_total;
if (debug_level()>1 && io_node()==file->H5DWMM->mpi.rank==0) {
if (debug_level()>1 && io_node()==file->H5DWMM->mpi.rank) {
printf("**Using node local storage as a cache\n");
printf("**path: %s\n", file->H5DWMM->ssd->path);
}
......@@ -2108,7 +2112,9 @@ H5VL_pass_through_ext_file_close(void *file, hid_t dxpl_id, void **req)
#ifdef ENABLE_EXT_PASSTHRU_LOGGING
printf("------- EXT PASS THROUGH VOL FILE Close\n");
#endif
if (o->write_cache) {
H5TSmutex_release();
pthread_mutex_lock(&o->H5DWMM->io.request_lock);
bool empty = (o->H5DWMM->io.num_request>0);
pthread_mutex_unlock(&o->H5DWMM->io.request_lock);
......@@ -2127,6 +2133,8 @@ H5VL_pass_through_ext_file_close(void *file, hid_t dxpl_id, void **req)
close(o->H5DWMM->mmap.fd);
remove(o->H5DWMM->mmap.fname);
o->H5DWMM->ssd->mspace_left = o->H5DWMM->ssd->mspace_total;
hbool_t acq;
H5TSmutex_acquire(&acq);
}
ret_value = H5VLfile_close(o->under_object, o->under_vol_id, dxpl_id, req);
......
......@@ -149,13 +149,15 @@ int main(int argc, char **argv) {
msleep(int(sleep*1000));
tt.stop_clock("compute");
}
tt.start_clock("H5close");
tt.start_clock("H5Dclose");
H5Dclose(dset_id);
tt.stop_clock("H5Dclose");
tt.start_clock("H5Fclose");
H5Fclose(file_id);
tt.stop_clock("H5Fclose");
H5Pclose(dxf_id);
H5Pclose(plist_id);
H5Sclose(memspace);
tt.stop_clock("H5close");
bool master = (rank==0);
delete [] data;
Timer T = tt["H5Dwrite"];
......
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