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

changed cache_vol repo location to HPC-IO

parent 89911fa2
[submodule "cache_vol"]
path = cache_vol
url = https://hzheng@bitbucket.hdfgroup.org/scm/hdf5vol/cache.git
url = https://github.com/hpc-io/vol-cache
Subproject commit 6f645a2a48851f59fc7194a011e3a37e16ca72cd
Subproject commit ec76e94e062b5b38a1bfe1b1d6ac955dfa3185bc
......@@ -10,17 +10,16 @@ HDF5_LIB=-L$(HDF5_ROOT)/lib -lhdf5
%.o: %.c
$(CXX) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
test_mmap_mem: test_mmap_mem.o ../utils/profiling.o
$(CXX) $(CFLAGS) -o $@ $< ../utils/profiling.o
test_hdf5: test_hdf5.o ../utils/profiling.o ../utils/debug.o
$(CXX) $(CFLAGS) -o $@ $< ../utils/profiling.o ../utils/debug.o $(HDF5_LIB)
$(CXX) $(CFLAGS) -o $@ $< ../utils/debug.o $(HDF5_LIB)
test: test_cache test_mmap_mem
test_cache: test_cache.o ../utils/profiling.o
$(CXX) $(CFLAGS) -o $@ $< ../utils/profiling.o
test_mmap_mem: test_mmap_mem.o ../utils/profiling.o
$(CXX) $(CFLAGS) -o $@ $< ../utils/profiling.o
clean:
rm -rf *.o read_dataset_cache prepare_dataset test_mmap test_cache test_mmap_mem test_hdf5 *btr
......@@ -4,7 +4,6 @@
#include "stdio.h"
#include "stdlib.h"
#include "mpi.h"
#include "profiling.h"
#include <assert.h>
#include "string.h"
#include "timing.h"
......@@ -25,7 +24,6 @@ void int2char(int a, char str[255]) {
void clear_cache(char *rank) {
char *a = new char [CACHE_BLOCK_SIZE];
double vm, rss;
process_mem_usage(vm, rss);
//printf(" VM: %5.2f MB; RSS: %5.2f MB \n", vm, rss);
if ((not allocated) and getenv("MEMORY_PER_RANK")) {
size_t dim = size_t(atof(getenv("MEMORY_PER_RANK")))*1024*1024*1024/8;
......
......@@ -91,15 +91,21 @@ int main(int argc, char **argv) {
Timing tt(rank==0);
strcat(local_storage, to_string(rank).c_str());
unsigned long size = dim*sizeof(float)*num_batches*batch_size;
tt.start_clock("pwrite");
if (write) {
int fh = open(local_storage, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
char *a = new char [batch_size*sizeof(float)*dim];
for (int i=0; i<num_batches; i++) {
pwrite(fh, a, batch_size*sizeof(float)*dim, i*batch_size*sizeof(float)*dim);
}
printf("Finished write initial\n");
fsync(fh);
close(fh);
}
tt.stop_clock("pwrite");
double w = dim*sizeof(float)*num_batches*batch_size/tt["pwrite"].t_iter[0]/1024/1024;
if (rank==0) cout << "pwrite rate: " << w << "MB/s" << endl;
double vm, rss;
process_mem_usage(vm, rss);
if (rank==0) cout << "VM: " << vm << "; RSS: " << rss << endl;
......@@ -114,14 +120,20 @@ int main(int argc, char **argv) {
/* generate secret number between 1 and 10: */
int iSecret = rand() % 1024576 + 1;
int fd = open(local_storage, O_RDWR);
void *buf = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
msync(buf, size, MS_SYNC);
void *buf;
tt.start_clock("mmap");
if (getenv("MAP_NORESERVE"))
buf = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NORESERVE, fd, 0);
else
buf = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
tt.stop_clock("mmap");
process_mem_usage(vm, rss);
if (rank==0) cout << "MSYNC -- VM: " << vm << "; RSS: " << rss << endl;
float *p = (float *)buf;
float *dat = new float [dim*batch_size];
for(int i=0; i<dim*batch_size; i++) dat[i] = iSecret;
if (write)
for (int e = 0; e < epochs; e++) {
......@@ -141,8 +153,8 @@ int main(int argc, char **argv) {
process_mem_usage(vm, rss);
if (rank==0) cout << "WRITE MSYNC -- VM: " << vm << "; RSS: " << rss << endl;
}
}
msync(buf, size, MS_SYNC);
tt.stop_clock("write");
double w = dim*sizeof(float)*num_batches*batch_size/tt["write"].t_iter[e]/1024/1024;
if (rank==0) cout << "Epoch " << e << ": " << " rate: " << w << "MB/s" << endl;
......@@ -175,7 +187,6 @@ int main(int argc, char **argv) {
}
process_mem_usage(vm, rss);
if (rank==0) cout << "READ MSYNC -- VM: " << vm << "; RSS: " << rss << endl;
}
} else {
for (int b = 0; b < num_batches; b++) {
......
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