| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2026 Oak Ridge National Laboratory and Contributors |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: Apache-2.0 |
| 5 |
*/ |
| 6 |
|
| 7 |
#ifndef SETTINGS_H_ |
| 8 |
#define SETTINGS_H_ |
| 9 |
|
| 10 |
#include <string> |
| 11 |
|
| 12 |
class Settings |
| 13 |
{ |
| 14 |
|
| 15 |
public: |
| 16 |
// user arguments |
| 17 |
std::string configfile; |
| 18 |
std::string outputfile; |
| 19 |
unsigned int npx; // Number of processes in X (slow) dimension |
| 20 |
unsigned int npy; // Number of processes in Y (fast) dimension |
| 21 |
unsigned int ndx; // Local array size in X dimension per process |
| 22 |
unsigned int ndy; // Local array size in y dimension per process |
| 23 |
unsigned int steps; // Number of output steps |
| 24 |
unsigned int iterations; // Number of computing iterations between steps |
| 25 |
|
| 26 |
// calculated values from those arguments and number of processes |
| 27 |
unsigned int gndx; // Global array size in slow dimension |
| 28 |
unsigned int gndy; // Global array size in fast dimension |
| 29 |
// X dim positions: rank 0, npx, 2npx... are in the same X position |
| 30 |
// Y dim positions: npx number of consecutive processes belong to one row |
| 31 |
// (npx |
| 32 |
// columns) |
| 33 |
unsigned int posx; // Position of this process in X dimension |
| 34 |
unsigned int posy; // Position of this process in Y dimension |
| 35 |
unsigned int offsx; // Offset of local array in X dimension on this process |
| 36 |
unsigned int offsy; // Offset of local array in Y dimension on this process |
| 37 |
|
| 38 |
int rank; // MPI rank |
| 39 |
unsigned int nproc; // number of processors |
| 40 |
|
| 41 |
// neighbors by their MPI ranks, -1 if there is no such neighbor |
| 42 |
int rank_left; |
| 43 |
int rank_right; |
| 44 |
int rank_up; |
| 45 |
int rank_down; |
| 46 |
|
| 47 |
/** true: std::async Write, false (default): sync */ |
| 48 |
bool async = false; |
| 49 |
|
| 50 |
Settings(int argc, char *argv[], int rank, int nproc); |
| 51 |
}; |
| 52 |
|
| 53 |
#endif /* SETTINGS_H_ */ |