This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
53 lines (42 loc) · 1.6 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#define EIGEN_USE_BLAS
#define EIGEN_USE_LAPACKE
#include <chrono>
#include <iostream>
#include <mpi.h>
#include <string>
#include "npy.hpp"
#include "MpiViSchema01.h"
#include "MpiViSchema02.h"
#include "MpiViSchema03.h"
#include "MpiViUtility.h"
#include "verbose.h"
int main(int argc, char *argv[]) {
// initialisation
MpiViUtility::LogParameters logParameters{
.startDatetime = MpiViUtility::datetime(),
.tStart = std::chrono::system_clock::now(),
};
MpiViUtility::MpiParameters mpiParameters{};
MpiViUtility::ViParameters viParameters{};
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &mpiParameters.worldSize);
MPI_Comm_rank(MPI_COMM_WORLD, &mpiParameters.worldRank);
MpiViUtility::loadConfiguration(viParameters, mpiParameters, logParameters, &argc, argv);
MpiViUtility::syncParameters(viParameters, mpiParameters);
// mpi vi execution
if (mpiParameters.nameSchema == "MpiViSchema01") {
MpiViSchema01 schema;
schema.ValueIteration(viParameters, mpiParameters, logParameters);
} else if (mpiParameters.nameSchema == "MpiViSchema02") {
MpiViSchema02 schema;
schema.ValueIteration(viParameters, mpiParameters, logParameters);
} else if (mpiParameters.nameSchema == "MpiViSchema03") {
MpiViSchema03 schema;
schema.ValueIteration(viParameters, mpiParameters, logParameters);
} else {
throw std::invalid_argument("The specified MPI schema does not exist.");
}
MpiViUtility::saveResults(viParameters, mpiParameters, logParameters);
MPI_Finalize();
return 0;
}