12#include "gadgetconfig.h"
22#include "../data/allvars.h"
23#include "../data/dtypes.h"
24#include "../data/mymalloc.h"
25#include "../domain/domain.h"
27#include "../io/test_io_bandwidth.h"
28#include "../lightcone/lightcone.h"
29#include "../logs/timer.h"
30#include "../main/simulation.h"
31#include "../mpi_utils/mpi_utils.h"
32#include "../ngbtree/ngbtree.h"
33#include "../system/system.h"
34#include "../time_integration/timestep.h"
61void test_io_bandwidth::write_test_data(
void)
78 "TEST: done. MaxFilesWithConcurrentIO=%6d load/save took %g sec, total size %g MB, corresponds to effective I/O rate of %g "
81 byte_count_all / (1024.0 * 1024.0) /
Logs.
timediff(t0, t1));
90void test_io_bandwidth::polling(
int modus)
93 if(files_completed <
NTask)
103 int source = status.MPI_SOURCE;
109 if(files_started <
NTask)
118void test_io_bandwidth::work_files(
int modus)
121 if(!(seq = (seq_data *)malloc(
NTask *
sizeof(seq_data))))
129 MPI_Gather(&seq_loc,
sizeof(seq_data), MPI_BYTE, seq,
sizeof(seq_data), MPI_BYTE, 0,
Communicator);
133 std::sort(seq, seq +
NTask);
145 contents_restart_file(modus);
148 if(files_started <
NTask)
154 while(files_completed <
NTask)
165 contents_restart_file(modus);
172void test_io_bandwidth::contents_restart_file(
int modus)
179 if(!(fd = fopen(buf,
"r")))
181 Terminate(
"TEST: File '%s' not found.\n", buf);
186 if(!(fd = fopen(buf,
"w")))
188 Terminate(
"TEST: File '%s' cannot be opened.\n", buf);
194 size_t len =
BUF_IN_MB * 1024LL * 1024LL;
196 char *p = (
char *)
Mem.mymalloc(
"p", len);
198 byten(p, len, modus);
205void test_io_bandwidth::byten(
void *x,
size_t n,
int modus)
218 byten_doit(p, n, modus);
223void test_io_bandwidth::byten_doit(
void *x,
size_t n,
int modus)
global_data_all_processes All
size_t my_fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
A wrapper for the fread() function.
void reset_io_byte_count(void)
long long get_io_byte_count(void)
size_t my_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
A wrapper for the fwrite() function.
double timediff(double t0, double t1)
void mpi_printf(const char *fmt,...)
void measure_io_bandwidth(void)
#define MAXLEN_PATH_EXTRA
void sumup_longs(int n, long long *src, long long *res, MPI_Comm comm)
int MaxFilesWithConcurrentIO
char OutputDir[MAXLEN_PATH]