Commit fc0addb1 authored by Roland Haas's avatar Roland Haas
Browse files

mpitar: reduce size of buffers

using 512MB for the stream buffer and copy_block_size uses up to 1.5GB
of RAM
parent 6a2da227
......@@ -75,8 +75,11 @@
#define MAX_JOBS_IN_FLIGHT 3
#define MAX_FILES_IN_JOB 100
#define TARGET_JOB_SIZE (1024ul*1024ul*1024ul)
#define COPY_BLOCK_SIZE (1024*1024*512)
#define COPY_BLOCK_SIZE (512ul*1024ul*1024ul)
#define STREAM_BUFFER_SIZE (COPY_BLOCK_SIZE)
// the only file that the master writes is the index file, so the buffer does
// not have to be large
#define MASTER_STREAM_BUFFER_SIZE (10ul*1024ul*1024ul)
std::vector<timer*> timer::all_timers;
......@@ -173,7 +176,7 @@ void master(const char *out_fn, fileentries& entries)
// and truncated the file
// I cannot use r+ since this seems to make fseek reads in data into the buffer
MPI_Barrier(MPI_COMM_WORLD);
async_writer out_writer(out_fh);
async_writer out_writer(out_fh, MASTER_STREAM_BUFFER_SIZE);
char idx_fn[1024];
size_t idx_fn_size = snprintf(idx_fn, sizeof(idx_fn), "%s.idx", out_fn);
......@@ -388,7 +391,7 @@ void worker(const char *out_fn)
timer_open.stop(__LINE__);
static char buffer[STREAM_BUFFER_SIZE];
setbuffer(out_fh, buffer, sizeof(buffer));
async_writer out_writer(out_fh);
async_writer out_writer(out_fh, STREAM_BUFFER_SIZE);
int done = 0;
do {
......
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