Commit 005e1ee2 authored by Huihuo Zheng's avatar Huihuo Zheng
Browse files

memory

parent fdb3708b
......@@ -317,7 +317,11 @@ herr_t H5DMMF_remap() {
if (strcmp("MEMORY", getenv("SSD_CACHE_PATH"))!=0) {
munmap(H5DMM.buf, ss);
close(H5DMM.fd);
#ifdef __APPLE__
H5DMM.fd = open(H5DMM.filename, O_RDWR);
#else
H5DMM.fd = open(H5DMM.filename, O_RDWR | O_DIRECT);
#endif
H5DMM.buf = mmap(NULL, ss, PROT_READ, MAP_SHARED, H5DMM.fd, 0);
msync(H5DMM.buf, ss, MS_SYNC);
// MPI_Win_create(H5DMM.buf, ss, H5DMM.disp, MPI_INFO_NULL, MPI_COMM_WORLD, &H5DMM.win);
......
......@@ -13,7 +13,7 @@ test_mmap: test_mmap.o
test_mmap_mem: test_mmap_mem.o ../utils/profiling.o
$(CXX) $(CFLAGS) -o $@ $< ../utils/profiling.o
read_dataset_cache: read_dataset_cache.o H5Dio_cache.o ../utils/debug.o ../utils/profiling.o
$(CXX) $(CFLAGS) -o $@ read_dataset_cache.o H5Dio_cache.o ../utils/debug.o $(HDF5_LIB) -lpthread
$(CXX) $(CFLAGS) -o $@ read_dataset_cache.o H5Dio_cache.o ../utils/debug.o ../utils/profiling.o $(HDF5_LIB) -lpthread
prepare_dataset: prepare_dataset.o
$(CXX) $(CFLAGS) -o $@ $< $(HDF5_LIB)
clean:
......
......@@ -39,6 +39,7 @@
// Memory map
#include <sys/mman.h>
#include "H5Dio_cache.h"
#include "profiling.h"
using namespace std;
int msleep(long miliseconds)
......@@ -206,7 +207,12 @@ int main(int argc, char **argv) {
} else {
H5Dread(dset, H5T_NATIVE_FLOAT, mspace, fspace, dxf_id, dat);
}
tt.stop_clock("H5Dread");
double vm, rss;
process_mem_usage(vm, rss);
if (io_node()==rank)
cout << "VM: " << vm << "; RSS:" << rss << endl;
msleep(int(compute*1000));
}
if (io_node()==rank)
......@@ -223,6 +229,11 @@ int main(int argc, char **argv) {
H5DMMF_remap();
tt.stop_clock("REMAP");
}
double vm, rss;
process_mem_usage(vm, rss);
if (io_node()==rank)
cout << "VM: " << vm << "; RSS:" << rss << endl;
if (shuffle) ::shuffle(id.begin(), id.end(), g);
parallel_dist(num_images, nproc, (rank+e*rank_shift)%nproc, ns_loc, fs_loc);
double t1 = 0.0;
......@@ -252,6 +263,11 @@ int main(int argc, char **argv) {
}
cout << endl;
}
double vm, rss;
process_mem_usage(vm, rss);
if (io_node()==rank)
cout << "VM: " << vm << "; RSS:" << rss << endl;
}
if (io_node()==rank)
printf("Epoch: %d --- time: %6.2f (sec) --- throughput: %6.2f (imgs/sec) --- rate: %6.2f (MB/sec)\n",
......
......@@ -39,7 +39,7 @@ int main(int argc, char **argv) {
bool remap = false;
int sz = 224;
int i=0;
Timing tt;
// Input
while (i<argc) {
if (strcmp(argv[i], "--filename")==0) {
......@@ -73,6 +73,7 @@ int main(int argc, char **argv) {
strcat(local_storage, fname);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
Timing tt(rank==0);
strcat(local_storage, to_string(rank).c_str());
unsigned long size = dim*sizeof(float)*num_batches*batch_size;
if (write) {
......
......@@ -13,11 +13,8 @@ void process_mem_usage(double &vm_usage, double &resident_set) {
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
if (KERN_SUCCESS != task_info(mach_task_self(),
TASK_BASIC_INFO, (task_info_t)&t_info,
&t_info_count)) {
return -1;
}
task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&t_info,
&t_info_count);
vm_usage = t_info.virtual_size / 1024 / 1024;
resident_set = t_info.resident_size / 1024 / 1024;
}
......
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