ODT
Loading...
Searching...
No Matches
processor.cc
Go to the documentation of this file.
1
6#include "processor.h"
7#include <iostream>
8
9using namespace std;
10
12
14
16
19
20#ifdef DOMPI
21
22 //----------- set MPI Stuff (if on)
23
24 if((++nInst)==1) { // Only ever call MPI_* once
25 int fake_argc = 0;
26 char** fake_argv;
27 MPI_Init(&fake_argc, &fake_argv);
28 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
29 MPI_Comm_size(MPI_COMM_WORLD, &nproc);
30 }
31 if(nInst > 1)
32 cout << endl << "****** WARNING, more than one processor class object" << endl;
33
34 if(myid==0)
35 cout << "\n# MPI IS ON" << "; Nprocs = " << nproc << endl;
36 MPI_Barrier(MPI_COMM_WORLD);
37
38
39#else
40 myid = 0;
41 nproc = 1;
42
43#endif
44
45}
46
47
49
52
53#ifdef DOMPI
54
55 if((--nInst)==0) // Only ever finalize mpi once
56 MPI_Finalize();
57
58#endif
59}
60
62
63
64
65
66
static int nInst
number of these class objects (should be 1);
Definition processor.h:28
int myid
Process ID.
Definition processor.h:32
int nproc
Number of Processes.
Definition processor.h:33
Header file for class processor.