| Rev | Line | |
|---|
| [dfed1c] | 1 | #ifdef HAVE_CONFIG_H
|
|---|
| 2 | #include <config.h>
|
|---|
| 3 | #endif
|
|---|
| 4 |
|
|---|
| 5 | #ifdef HAVE_MPI
|
|---|
| 6 | #include <mpi.h>
|
|---|
| [ac6d04] | 7 | #ifdef HAVE_MARMOT
|
|---|
| 8 | #include <enhancempicalls.h>
|
|---|
| 9 | #include <sourceinfompicalls.h>
|
|---|
| 10 | #endif
|
|---|
| [dfed1c] | 11 | #include "comm/mpi/error_handler.hpp"
|
|---|
| 12 | #endif
|
|---|
| 13 |
|
|---|
| 14 | #include <cstdio>
|
|---|
| 15 |
|
|---|
| 16 | #include "comm/comm.hpp"
|
|---|
| 17 | #include "mg.hpp"
|
|---|
| 18 |
|
|---|
| 19 | using namespace VMG;
|
|---|
| 20 |
|
|---|
| 21 | int main(int argc, char* argv[])
|
|---|
| 22 | {
|
|---|
| 23 | #ifdef HAVE_MPI
|
|---|
| 24 | int rank;
|
|---|
| [379700] | 25 |
|
|---|
| [dfed1c] | 26 | MPI_Init(&argc, &argv);
|
|---|
| [379700] | 27 |
|
|---|
| 28 | #ifdef DEBUG
|
|---|
| 29 | MPI_Errhandler mpiErrorHandler;
|
|---|
| [dfed1c] | 30 | MPI_Comm_create_errhandler(VMG::MPI::ConvertToException, &mpiErrorHandler);
|
|---|
| 31 | MPI_Comm_set_errhandler(MPI_COMM_WORLD, mpiErrorHandler);
|
|---|
| [379700] | 32 | #endif
|
|---|
| 33 |
|
|---|
| [dfed1c] | 34 | MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
|---|
| 35 | double start = MPI_Wtime();
|
|---|
| 36 | #endif
|
|---|
| 37 |
|
|---|
| 38 | if (argc < 2) {
|
|---|
| 39 | #ifdef HAVE_MPI
|
|---|
| 40 | if (rank == 0)
|
|---|
| 41 | #endif
|
|---|
| 42 | std::printf("Wrong number of arguments specified.\nUsage: vmg_particles <config_filename>");
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | MG::InitializeFromParticleConfigFile(argv[1]);
|
|---|
| 46 |
|
|---|
| 47 | if (!MG::IsInitialized()) {
|
|---|
| 48 | #ifdef HAVE_MPI
|
|---|
| 49 | std::printf("%d: VMG is not properly initialized. Please check your config file.\n", rank);
|
|---|
| 50 | MPI_Abort(MPI_COMM_WORLD, MPI_ERR_OTHER);
|
|---|
| 51 | #else
|
|---|
| 52 | std::printf("VMG is not properly initialized. Please check your config file.\n", rank);
|
|---|
| 53 | #endif
|
|---|
| 54 | return -1;
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | MG::Solve();
|
|---|
| 58 |
|
|---|
| 59 | #ifdef HAVE_MPI
|
|---|
| 60 | double end = MPI_Wtime();
|
|---|
| 61 | MG::GetComm()->PrintStringOnce("Running time: %e\n", end-start);
|
|---|
| 62 | #endif
|
|---|
| 63 |
|
|---|
| 64 | MG::Destroy();
|
|---|
| 65 |
|
|---|
| 66 | #ifdef HAVE_MPI
|
|---|
| 67 | MPI_Finalize();
|
|---|
| 68 | #endif
|
|---|
| 69 |
|
|---|
| 70 | return 0;
|
|---|
| 71 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.