source: vmg_particles/vmg_particles.cpp@ b51c3b

Last change on this file since b51c3b was ac6d04, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Merge recent changes of the vmg library into ScaFaCos.

Includes a fix for the communication problems on Jugene.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1666 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[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
19using namespace VMG;
20
21int main(int argc, char* argv[])
22{
23#ifdef HAVE_MPI
24 int rank;
25 MPI_Errhandler mpiErrorHandler;
26 MPI_Init(&argc, &argv);
27 MPI_Comm_create_errhandler(VMG::MPI::ConvertToException, &mpiErrorHandler);
28 MPI_Comm_set_errhandler(MPI_COMM_WORLD, mpiErrorHandler);
29 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
30 double start = MPI_Wtime();
31#endif
32
33 if (argc < 2) {
34#ifdef HAVE_MPI
35 if (rank == 0)
36#endif
37 std::printf("Wrong number of arguments specified.\nUsage: vmg_particles <config_filename>");
38 }
39
40 MG::InitializeFromParticleConfigFile(argv[1]);
41
42 if (!MG::IsInitialized()) {
43#ifdef HAVE_MPI
44 std::printf("%d: VMG is not properly initialized. Please check your config file.\n", rank);
45 MPI_Abort(MPI_COMM_WORLD, MPI_ERR_OTHER);
46#else
47 std::printf("VMG is not properly initialized. Please check your config file.\n", rank);
48#endif
49 return -1;
50 }
51
52 MG::Solve();
53
54#ifdef HAVE_MPI
55 double end = MPI_Wtime();
56 MG::GetComm()->PrintStringOnce("Running time: %e\n", end-start);
57#endif
58
59 MG::Destroy();
60
61#ifdef HAVE_MPI
62 MPI_Finalize();
63#endif
64
65 return 0;
66}
Note: See TracBrowser for help on using the repository browser.