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

checking ssd performance

parent dbf401f8
......@@ -35,7 +35,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Public HDF5 file */
#include "hdf5.h"
#include "H5Dio_cache.h"
......@@ -1326,12 +1325,22 @@ herr_t H5Ssel_gather_write(hid_t space, hid_t tid, const void *buf, int fd, hsiz
H5Ssel_iter_get_seq_list(iter, maxseq, maxbytes, &nseq, &nbytes, off, len);
hsize_t off_contig=0;
char *p = (char*) buf;
//double t = 0.0;
//double w = 0.0;
//MPI_Barrier(MPI_COMM_WORLD);
//double t1 = MPI_Wtime();
for(int i=0; i<nseq; i++) {
// printf("nseq: %d\n", nseq);
//w += len[i];
int err = pwrite(fd, &p[off[i]], len[i], offset+off_contig);
off_contig += len[i];
}
fsync(fd);
//MPI_Barrier(MPI_COMM_WORLD);
//t += MPI_Wtime() - t1;
//double wt;
//w = w/t/1024/1024;
//MPI_Allreduce(&w, &wt, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
//printf("wt: %f\n", wt);
return 0;
}
......@@ -1358,7 +1367,9 @@ H5VL_pass_through_ext_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_spa
o->H5DWMM->ssd->mspace_per_rank_left = o->H5DWMM->ssd->mspace_per_rank_total;
o->H5DWMM->ssd->mspace_left = o->H5DWMM->ssd->mspace_total;
}
//MPI_Barrier(o->H5DWMM->mpi.comm);
H5Ssel_gather_write(mem_space_id, mem_type_id, buf, o->H5DWMM->mmap.fd, o->H5DWMM->ssd->offset);
//MPI_Barrier(o->H5DWMM->mpi.comm);
o->H5DWMM->io.request_list->offset = o->H5DWMM->ssd->offset;
o->H5DWMM->ssd->offset += (size/PAGESIZE+1)*PAGESIZE;
o->H5DWMM->ssd->mspace_per_rank_left = o->H5DWMM->ssd->mspace_per_rank_total
......
......@@ -137,9 +137,6 @@ int main(int argc, char **argv) {
for(int j=0; j<2*ldims[0]*ldims[1]; j++)
data[j] = i;
tt.stop_clock("Init_array");
hsize_t loc_buf_dim[2] = {d1, d2};
hsize_t data_dim[2] = {2*d1, d2};
// select hyperslab
......
......@@ -34,6 +34,7 @@ int main(int argc, char **argv) {
double vm, rss;
char path[255] = "./";
bool write = false;
bool read = false;
for (int i=1; i<argc; i++) {
if (strcmp(argv[i], "--dim")==0) {
dim = int(atof(argv[i+1])); i=i+1;
......@@ -45,7 +46,10 @@ int main(int argc, char **argv) {
strcpy(path, argv[i+1]); i=i+1;
} else if (strcmp(argv[i], "--write")==0) {
write = true;
} else if (strcmp(argv[i], "--read")==0) {
read = true;
}
}
MPI_Init(&argc, &argv);
int rank, nproc;
......@@ -61,27 +65,27 @@ int main(int argc, char **argv) {
cout << "nproc: " << nproc << endl;
}
if (write) {
char fname[255];
strcpy(fname, path);
strcat(fname, "/cache.dat");
strcat(fname, to_string(rank).c_str());
int fd = open(fname, O_RDWR | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
for(int it =0; it < niter; it++) {
dat[0] = it;
char fname[255];
strcpy(fname, path);
strcat(fname, "/cache.dat");
strcat(fname, to_string(rank).c_str());
strcat(fname, "-");
strcat(fname, to_string(it).c_str());
tt.start_clock("write");
MPI_Barrier(MPI_COMM_WORLD);
int fd = open(fname, O_RDWR | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
for(int i=0; i<nbatch; i++) {
pwrite(fd, dat, sizeof(double)*dim, sizeof(double)*i*dim);
}
for(int i=0; i<nbatch; i++)
pwrite(fd, dat, sizeof(double)*dim, sizeof(double)*i*dim + it*nbatch*dim);
fsync(fd);
MPI_Barrier(MPI_COMM_WORLD);
tt.stop_clock("write");
fsync(fd);
sleep(1);
if (rank==0) cout << "Write rate: " << sizeof(double)*dim*nbatch/tt["write"].t_iter[it]/1024/1024*nproc << endl;
close(fd);
//close(fd);
}
close(fd);
}
if (read)
for(int it =0; it < niter; it++) {
char fname[255];
strcpy(fname, path);
......
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