Commit 4932b595 authored by Huihuo Zheng's avatar Huihuo Zheng
Browse files

local commit

parent af627952
......@@ -24,4 +24,4 @@ prepare_dataset: prepare_dataset.o
$(CXX) $(CFLAGS) -o $@ $< $(HDF5_LIB)
clean:
rm -rf *.o test_read_cache test_write_cache mpi_profile.*
rm -rf *.o test_read_cache test_write_cache mpi_profile.* parallel_file.*
......@@ -51,7 +51,7 @@ int main(int argc, char **argv) {
int d1 = 2048;
int d2 = 2048;
int niter = 10;
char scratch[255] = "/tmp/";
char scratch[255] = "./";
double sleep=0.0;
for(int i=1; i<argc; i++) {
if (strcmp(argv[i], "--dim")==0) {
......@@ -75,8 +75,8 @@ int main(int argc, char **argv) {
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
int rank, nproc, provided;
//MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
MPI_Init(&argc, &argv);
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
//MPI_Init(&argc, &argv);
MPI_Comm_size(comm, &nproc);
MPI_Comm_rank(comm, &rank);
......@@ -96,16 +96,13 @@ int main(int argc, char **argv) {
}
hsize_t offset[2] = {0, 0};
// setup file access property list for mpio
cout << "H5Pcreate" << endl;
hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(plist_id, comm, info);
cout << "H5Pcreate done" << endl;
char f[255];
strcpy(f, scratch);
strcat(f, "/parallel_file.h5");
tt.start_clock("H5Fcreate");
cout << "cccccc" << endl;
hid_t file_id;
if (cache)
file_id = H5Fcreate_cache(f, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id);
......
......@@ -1331,6 +1331,7 @@ herr_t H5Ssel_gather_write(hid_t space, hid_t tid, const void *buf, int fd, hsiz
int err = pwrite(fd, &p[off[i]], len[i], offset+off_contig);
off_contig += len[i];
}
fsync(fd);
return 0;
}
......
......@@ -6,14 +6,14 @@ CXX=mpicxx
HDF5_DIR=$(HDF5_ROOT)
INCLUDES=-I$(HDF5_DIR)/include -I../utils/
INCLUDES=-I$(HDF5_DIR)/include -I../utils/ -fPIC -DTHETA
LIBS=-L$(HDF5_DIR)/lib -lhdf5 -lz
#DEBUG=-DENABLE_EXT_PASSTHRU_LOGGING
CFLAGS=$(INCLUDES) $(DEBUG)
##TARGET=libh5passthrough_vol.dylib
TARGET=libh5passthrough_vol.dylib
TARGET=libh5passthrough_vol.so
#TARGET=libh5passthrough_vol.dylib
all: makeso test_write_cache
......
......@@ -143,16 +143,17 @@ int main(int argc, char **argv) {
hsize_t loc_buf_dim[2] = {d1, d2};
hsize_t data_dim[2] = {2*d1, d2};
// select hyperslab
tt.start_clock("Select");
hid_t filespace = H5Screate_simple(2, ggdims, NULL);
hsize_t loc_buf_select[2] = {d1/2, d2};
hid_t memspace = H5Screate_simple(2, data_dim, NULL);
offset[0]= i*gdims[0] + rank*ldims[0];
H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, loc_buf_dim, count);
offset[0]=0;
H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset, NULL, loc_buf_select, count);
offset[0]=d1;
H5Sselect_hyperslab(memspace, H5S_SELECT_OR, offset, NULL, loc_buf_select, count);
tt.stop_clock("Select");
if (rank==0 and i==0) printf(" Selected buffer size (Bytes): %llu (memspace) - %llu (filespace) \n", get_buf_size(memspace, H5T_NATIVE_INT), get_buf_size(filespace, H5T_NATIVE_INT));
tt.start_clock("H5Dwrite");
hid_t status = H5Dwrite(dset_id, H5T_NATIVE_INT, memspace, filespace, dxf_id, data); // write memory to file
......
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