Yet Another eXchange Tool  0.9.0
xt_init.c
Go to the documentation of this file.
1 
12 /*
13  * Keywords:
14  * Maintainer: Jörg Behrens <behrens@dkrz.de>
15  * Moritz Hanke <hanke@dkrz.de>
16  * Thomas Jahns <jahns@dkrz.de>
17  * URL: https://doc.redmine.dkrz.de/yaxt/html/
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions are
21  * met:
22  *
23  * Redistributions of source code must retain the above copyright notice,
24  * this list of conditions and the following disclaimer.
25  *
26  * Redistributions in binary form must reproduce the above copyright
27  * notice, this list of conditions and the following disclaimer in the
28  * documentation and/or other materials provided with the distribution.
29  *
30  * Neither the name of the DKRZ GmbH nor the names of its contributors
31  * may be used to endorse or promote products derived from this software
32  * without specific prior written permission.
33  *
34  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
35  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
36  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
37  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
38  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
39  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45  */
46 #ifdef HAVE_CONFIG_H
47 #include <config.h>
48 #endif
49 
50 #include <stdlib.h>
51 #include "core/core.h"
52 #include "xt_config_internal.h"
53 #include "xt_idxlist_internal.h"
54 #include "xt_idxstripes_internal.h"
55 #include "xt_idxsection_internal.h"
56 #include "xt_idxempty_internal.h"
57 #include "xt_exchanger.h"
58 #include "xt_mpi_internal.h"
59 #include "instr.h"
60 
61 INSTR_DEF(instr,"YAXT_lifetime")
62 
63 static enum {
68 
69 void
70 xt_initialize(MPI_Comm default_comm)
71 {
72  Xt_default_comm = default_comm;
73  xt_mpi_init();
79 #ifdef INSTR_WITH_SCT
80  sct_init(32, "YAXT", Xt_default_comm);
81  setenv("SCT_PROC_CHOICE", "SCT_REDUCE_ALL", 0);
82  setenv("SCT_CALLSTATS", "0", 0);
83  INSTR_START(instr);
84 #endif
86 }
87 
88 void
90 {
92  {
97 #ifdef INSTR_WITH_SCT
98  INSTR_STOP(instr);
99  INSTR_REPORT(SCT_GETENV, SCT_GETENV, SCT_GETENV);
100  INSTR_FINALIZE();
101 #endif
103  }
104 }
105 
106 int
108 {
109  return xt_lib_state > xt_lib_pre_init;
110 }
111 
112 int
114 {
115  return xt_lib_state == xt_lib_finalized;
116 }
117 
118 /*
119  * Local Variables:
120  * c-basic-offset: 2
121  * coding: utf-8
122  * indent-tabs-mode: nil
123  * show-trailing-whitespace: t
124  * require-trailing-newline: t
125  * End:
126  */
int MPI_Comm
Definition: core.h:64
#define INSTR_STOP(T)
Definition: instr.h:69
#define INSTR_DEF(T, S)
Definition: instr.h:66
#define INSTR_START(T)
Definition: instr.h:68
#define INSTR_FINALIZE()
Definition: instr.h:70
void xt_config_defaults_init(void)
Definition: xt_config.c:140
implementation of configuration object
exchanging of data based on information provided by redist's
void xt_idxempty_finalize(void)
Definition: xt_idxempty.c:161
void xt_idxempty_init(void)
Definition: xt_idxempty.c:155
Provide non-public declarations common to all index lists.
void xt_idxlist_intersection_init(void)
void xt_idxsection_initialize(void)
void xt_idxsection_finalize(void)
void xt_idxstripes_initialize(void)
void xt_idxstripes_finalize(void)
int xt_finalized(void)
Definition: xt_init.c:113
void xt_initialize(MPI_Comm default_comm)
Definition: xt_init.c:70
int xt_initialized(void)
Definition: xt_init.c:107
static enum @8 xt_lib_state
void xt_finalize(void)
Definition: xt_init.c:89
@ xt_lib_finalized
Definition: xt_init.c:66
@ xt_lib_initialized
Definition: xt_init.c:65
@ xt_lib_pre_init
Definition: xt_init.c:64
void xt_mpi_init(void)
Definition: xt_mpi.c:739
void xt_mpi_finalize(void)
Definition: xt_mpi.c:753