MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / init

Function init

src/Pstream/mpi/UPstream.C:62–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60
61
62bool Foam::UPstream::init(int& argc, char**& argv)
63{
64 //MPI_Init(&argc, &argv);
65 int provided_thread_support;
66 MPI_Init_thread
67 (
68 &argc,
69 &argv,
70 MPI_THREAD_MULTIPLE,
71 &provided_thread_support
72 );
73
74 int numprocs;
75 MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
76 int myRank;
77 MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
78
79 if (debug)
80 {
81 Pout<< "UPstream::init : initialised with numProcs:" << numprocs
82 << " myRank:" << myRank << endl;
83 }
84
85 if (numprocs <= 1)
86 {
87 FatalErrorInFunction
88 << "bool IPstream::init(int& argc, char**& argv) : "
89 "attempt to run parallel on 1 processor"
90 << Foam::abort(FatalError);
91 }
92
93
94 // Initialise parallel structure
95 setParRun(numprocs);
96
97 if (Pstream::master() && provided_thread_support != MPI_THREAD_MULTIPLE)
98 {
99 WarningInFunction
100 << "mpi does not seem to have thread support."
101 << " There might be issues with e.g. threaded IO"
102 << endl;
103 }
104
105
106 #ifndef SGIMPI
107 string bufferSizeName = getEnv("MPI_BUFFER_SIZE");
108
109 if (bufferSizeName.size())
110 {
111 int bufferSize = atoi(bufferSizeName.c_str());
112
113 if (bufferSize)
114 {
115 MPI_Buffer_attach(new char[bufferSize], bufferSize);
116 }
117 }
118 else
119 {

Callers 4

runParMethod · 0.50
gzstream.CFile · 0.50
gzstreambaseMethod · 0.50
heThermo.CFile · 0.50

Calls 3

setParRunFunction · 0.85
abortFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected