forked from parflow/parflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathamps_finalize.c
More file actions
78 lines (73 loc) · 2.43 KB
/
Copy pathamps_finalize.c
File metadata and controls
78 lines (73 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*BHEADER**********************************************************************
*
* Copyright (c) 1995-2024, Lawrence Livermore National Security,
* LLC. Produced at the Lawrence Livermore National Laboratory. Written
* by the Parflow Team (see the CONTRIBUTORS file)
* <parflow@lists.llnl.gov> CODE-OCEC-08-103. All rights reserved.
*
* This file is part of Parflow. For details, see
* http://www.llnl.gov/casc/parflow
*
* Please read the COPYRIGHT file or Our Notice and the LICENSE file
* for the GNU Lesser General Public License.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (as published
* by the Free Software Foundation) version 2.1 dated February 1999.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms
* and conditions of the GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
**********************************************************************EHEADER*/
#include "amps.h"
extern int amps_mpi_initialized;
/*===========================================================================*/
/**
*
* Every {\em AMPS} program must call this function to exit from the
* message passing environment. This must be the last call to an
* {\em AMPS} routine. \Ref{amps_Finalize} might synchronize the
* of the node programs; this might be necessary to correctly free up
* memory resources and communication structures.
*
* {\large Example:}
* \begin{verbatim}
* int main( int argc, char *argv)
* {
* amps_Init(argc, argv);
*
* amps_Printf("Hello World");
*
* amps_Finalize();
* }
* \end{verbatim}
*
* {\large Notes:}
*
*
* There is currently no way to forcibly kill another node. Exiting do
* to an error condition is problematic.
*
* @memo Exit AMPS environment
* @return Error code
*/
int amps_Finalize()
{
if (amps_mpi_initialized)
{
MPI_Comm_free(&s_CommNode);
MPI_Comm_free(&s_CommWrite);
MPI_Comm_free(&s_CommWorld);
/* MPI_Finalize(); */
}
#if defined(PARFLOW_HAVE_CUDA) || defined(PARFLOW_HAVE_KOKKOS)
amps_gpu_finalize();
#endif
return 0;
}