/* This is the test program for studying the cache effect in POSIX I/O. Normally, when we write data to the files. The system will keep a copy of the data in the cache. So when we are reading the same data from the files, it actually read from the cache instead of from the file system. In order to avoid the cache effect, one can write more than one files, so by the time reading the first file, the first file is already been pushed out of the cache. The other way to avoid the cache effect is to separate out the read from the write. In the benchmark, we do write first, and then do read in an independent run. The benchmarks script allow us to do this. Huihuo Zheng - huihuo.zheng@anl.gov */ #include #include #include #include #include "stdio.h" #include "string.h" #include "stdlib.h" #include "profiling.h" #include "timing.h" #include "mpi.h" using namespace std; int main(int argc, char **argv) { int dim = 1024576; int nbatch = 1024; int niter = 10; double dat[dim]; double vm, rss; char path[255] = "./"; bool write = false; for (int i=1; i