GADGET-4
test_io_bandwidth.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * \copyright This file is part of the GADGET4 N-body/SPH code developed
3  * \copyright by Volker Springel. Copyright (C) 2014-2020 by Volker Springel
4  * \copyright (vspringel@mpa-garching.mpg.de) and all contributing authors.
5  *******************************************************************************/
6 
12 #ifndef TEST_IO_BANDWIDTH_H
13 #define TEST_IO_BANDWIDTH_H
14 
15 #include <mpi.h>
16 
17 #define MODUS_WRITE 0
18 #define MODUS_READ 1
19 
20 #define BUF_IN_MB 10
21 
22 #define BLKSIZE (1024 * 1024)
23 
24 #include "../io/io_streamcount.h"
25 
26 class test_io_bandwidth : public io_streamcount, public virtual setcomm
27 {
28  public:
29  test_io_bandwidth(MPI_Comm comm) : setcomm(comm) {}
30 
31  void measure_io_bandwidth(void);
32 
33  private:
34  FILE *fd;
35 
36  struct seq_data
37  {
38  int thistask;
39  int rankinnode;
40  int thisnode;
41 
42  bool operator<(const seq_data &other) const
43  {
44  if(rankinnode < other.rankinnode)
45  return true;
46  if(rankinnode > other.rankinnode)
47  return false;
48  if(thisnode < other.thisnode)
49  return true;
50  if(thisnode > other.thisnode)
51  return false;
52  return thistask < other.thistask;
53  }
54  };
55  seq_data *seq;
56 
57  int files_started;
58  int files_completed;
59 
60  void work_files(int modus);
61  void contents_restart_file(int modus);
62  void polling(int modus);
63  void write_test_data(void);
64  void byten(void *x, size_t n, int modus);
65  void byten_doit(void *x, size_t n, int modus);
66 };
67 
68 #endif
test_io_bandwidth(MPI_Comm comm)
void measure_io_bandwidth(void)
bool operator<(const location &left, const location &right)
Definition: dtypes.h:172