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

Function exit

src/Pstream/mpi/UPstream.C:138–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136
137
138void Foam::UPstream::exit(int errnum)
139{
140 if (debug)
141 {
142 Pout<< "UPstream::exit." << endl;
143 }
144
145 #ifndef SGIMPI
146 int size;
147 char* buff;
148 MPI_Buffer_detach(&buff, &size);
149 delete[] buff;
150 #endif
151
152 if (PstreamGlobals::outstandingRequests_.size())
153 {
154 label n = PstreamGlobals::outstandingRequests_.size();
155 PstreamGlobals::outstandingRequests_.clear();
156
157 WarningInFunction
158 << "There are still " << n << " outstanding MPI_Requests." << endl
159 << "This means that your code exited before doing a"
160 << " UPstream::waitRequests()." << endl
161 << "This should not happen for a normal code exit."
162 << endl;
163 }
164
165 // Clean mpi communicators
166 forAll(myProcNo_, communicator)
167 {
168 if (myProcNo_[communicator] != -1)
169 {
170 freePstreamCommunicator(communicator);
171 }
172 }
173
174 if (errnum == 0)
175 {
176 MPI_Finalize();
177 ::exit(errnum);
178 }
179 else
180 {
181 MPI_Abort(MPI_COMM_WORLD, errnum);
182 }
183}
184
185
186void Foam::UPstream::abort()

Callers 15

mainFunction · 0.50
usageFunction · 0.50
mainFunction · 0.50
usageFunction · 0.50
mainFunction · 0.50
usageFunction · 0.50
mainFunction · 0.50
readFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50

Calls 4

freePstreamCommunicatorFunction · 0.70
forAllFunction · 0.50
sizeMethod · 0.45
clearMethod · 0.45

Tested by 15

mainFunction · 0.40
usageFunction · 0.40
mainFunction · 0.40
usageFunction · 0.40
mainFunction · 0.40
usageFunction · 0.40
mainFunction · 0.40
readFunction · 0.40
mainFunction · 0.40
mainFunction · 0.40
mainFunction · 0.40
mainFunction · 0.40