NGen
Loading...
Searching...
No Matches
parallel_utils.h
1#ifndef NGEN_PARALLEL_UTILS_H
2#define NGEN_PARALLEL_UTILS_H
3
4#include <NGenConfig.h>
5#if NGEN_WITH_MPI
6
7#ifndef MPI_HF_SUB_CODE_GOOD
8#define MPI_HF_SUB_CODE_GOOD 0
9#endif
10
11#ifndef MPI_HF_SUB_CODE_BAD
12#define MPI_HF_SUB_CODE_BAD 1
13#endif
14
15#ifndef NGEN_MPI_DATA_TAG
16#define NGEN_MPI_DATA_TAG 100
17#endif
18
19#ifndef NGEN_MPI_PROTOCOL_TAG
20#define NGEN_MPI_PROTOCOL_TAG 101
21#endif
22
23#include <mpi.h>
24#include <string>
25#include <vector>
26
27namespace parallel {
28
47 bool mpiSyncStatusAnd(bool status, MPI_Comm comm, const std::string &taskDesc);
48
57 bool mpiSyncStatusAnd(bool status, MPI_Comm comm);
58
76 bool is_hydrofabric_subdivided(const std::string &catchmentDataFile, MPI_Comm comm, bool printMsg);
77
92 void get_hosts_array(MPI_Comm comm, int *host_array);
93
104 bool mpi_send_text_file(const char *fileName, MPI_Comm comm, const int destRank);
105
118 bool mpi_recv_text_file(const char *fileName, MPI_Comm comm, const int srcRank);
119
168 bool distribute_subdivided_hydrofabric_files(const std::string &baseCatchmentFile, const std::string &baseNexusFile,
169 const int sendingRank, MPI_Comm comm,
170 const int *hostIdForRank, bool syncReturnStatus, bool blockAll);
171
185 bool subdivide_hydrofabric(MPI_Comm comm, const std::string &catchmentDataFile,
186 const std::string &nexusDataFile, const std::string &partitionConfigFile);
187
195 std::vector<std::string> gather_strings(const std::vector<std::string>& local_strings, MPI_Comm comm);
196
204 std::vector<std::string> broadcast_strings(const std::vector<std::string>& strings, MPI_Comm comm);
205}
206
207#endif // NGEN_WITH_MPI
208
209#endif //NGEN_PARALLEL_UTILS_H