/[escript]/trunk/escriptcore/src/EscriptParams.cpp
ViewVC logotype

Contents of /trunk/escriptcore/src/EscriptParams.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3940 - (show annotations)
Thu Jul 26 05:54:58 2012 UTC (6 years, 8 months ago) by jfenwick
Original Path: trunk/escript/src/EscriptParams.cpp
File size: 4299 byte(s)
Disabling tests which do not allow MPI
Previously we allowed these if there was only one rank

1
2
3 /*******************************************************
4 *
5 * Copyright (c) 2003-2012 by University of Queensland
6 * Earth Systems Science Computational Center (ESSCC)
7 * http://www.uq.edu.au/esscc
8 *
9 * Primary Business: Queensland, Australia
10 * Licensed under the Open Software License version 3.0
11 * http://www.opensource.org/licenses/osl-3.0.php
12 *
13 *******************************************************/
14
15 #include "EscriptParams.h"
16 #include <cstring>
17 #include <boost/python/tuple.hpp>
18 #include <cmath> // to test if we know how to check for nan
19
20 namespace escript
21 {
22
23 EscriptParams escriptParams; // externed in header file
24
25
26 EscriptParams::EscriptParams()
27 {
28 too_many_lines=80;
29 autolazy=0;
30 too_many_levels=70;
31 // too_many_nodes=15000;
32 resolve_collective=0;
33 lazy_str_fmt=0;
34 lazy_verbose=0;
35
36 #ifdef USE_LAPACK
37 lapack_support=1;
38 #else
39 lapack_support=0;
40 #endif
41 // These #defs are for performance testing only
42 // in general, I don't want people tweaking the
43 // default value using compiler options
44 // I've provided a python interface for that
45 #ifdef FAUTOLAZYON
46 autolazy=1;
47 #endif
48 #ifdef FAUTOLAZYOFF
49 autolazy=0;
50 #endif
51
52 #ifdef FRESCOLLECTON
53 resolve_collective=1;
54 #endif
55 #ifdef FRESCOLLECTOFF
56 resolve_collective=0;
57 #endif
58
59
60 #ifdef ESYS_MPI
61 amg_disabled=true;
62 #else
63 amg_disabled=false;
64 #endif
65
66
67
68 }
69
70 int
71 EscriptParams::getInt(const char* name, int sentinel) const
72 {
73 if (!strcmp(name,"TOO_MANY_LINES"))
74 {
75 return too_many_lines;
76 }
77 if (!strcmp(name,"AUTOLAZY"))
78 {
79 return autolazy;
80 }
81 if (!strcmp(name,"TOO_MANY_LEVELS"))
82 {
83 return too_many_levels;
84 }
85 // if (!strcmp(name,"TOO_MANY_NODES"))
86 // {
87 // return too_many_nodes;
88 // }
89 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
90 {
91 return resolve_collective;
92 }
93 if (!strcmp(name,"LAZY_STR_FMT"))
94 {
95 return lazy_str_fmt;
96 }
97 if (!strcmp(name,"LAPACK_SUPPORT"))
98 {
99 return lapack_support;
100 }
101 if (!strcmp(name, "NAN_CHECK"))
102 {
103 #ifdef isnan
104 return 1;
105 #else
106 return 0;
107 #endif
108 }
109 if (!strcmp(name,"LAZY_VERBOSE"))
110 {
111 return lazy_verbose;
112 }
113 if (!strcmp(name, "DISABLE_AMG"))
114 {
115 return amg_disabled;
116 }
117 if (!strcmp(name, "MPIBUILD"))
118 {
119 #ifdef ESYS_MPI
120 return 1;
121 #else
122 return 0;
123 #endif
124 }
125 return sentinel;
126 }
127
128 void
129 EscriptParams::setInt(const char* name, int value)
130 {
131 if (!strcmp(name,"TOO_MANY_LINES"))
132 {
133 too_many_lines=value;
134 }
135 if (!strcmp(name,"AUTOLAZY"))
136 {
137 autolazy=!(value==0); // set to 1 or zero
138 }
139 if (!strcmp(name,"TOO_MANY_LEVELS"))
140 {
141 too_many_levels=value;
142 }
143 // if (!strcmp(name,"TOO_MANY_NODES"))
144 // {
145 // too_many_nodes=value;
146 // }
147 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
148 {
149 resolve_collective=value;
150 }
151 if (!strcmp(name,"LAZY_STR_FMT"))
152 {
153 lazy_str_fmt=value;
154 }
155 if (!strcmp(name,"LAZY_VERBOSE"))
156 {
157 lazy_verbose=value;
158 }
159 // Note: there is no way to modifiy the LAPACK_SUPPORT variable atm
160 }
161
162 void
163 setEscriptParamInt(const char* name, int value)
164 {
165 escriptParams.setInt(name,value);
166 }
167
168
169 int
170 getEscriptParamInt(const char* name, int sentinel)
171 {
172 return escriptParams.getInt(name, sentinel);
173 }
174
175 boost::python::list
176 EscriptParams::listEscriptParams()
177 {
178 using namespace boost::python;
179 boost::python::list l;
180 l.append(make_tuple("TOO_MANY_LINES", too_many_lines, "Maximum number of lines to output when printing data before printing a summary instead."));
181 l.append(make_tuple("AUTOLAZY", autolazy, "{0,1} Operations involving Expanded Data will create lazy results."));
182 l.append(make_tuple("RESOLVE_COLLECTIVE",resolve_collective ,"(TESTING ONLY) {0.1} Collective operations will resolve their data."));
183 l.append(make_tuple("TOO_MANY_LEVELS", too_many_levels, "(TESTING ONLY) maximum levels allowed in an expression."));
184 // l.append(make_tuple("TOO_MANY_NODES", too_many_nodes, "(TESTING ONLY) maximum number of nodes in a expression."));
185 l.append(make_tuple("LAZY_STR_FMT", lazy_str_fmt, "{0,1,2}(TESTING ONLY) change output format for lazy expressions."));
186 l.append(make_tuple("LAZY_VERBOSE", lazy_verbose, "{0,1} Print a warning when expressions are resolved because they are too large."));
187 l.append(make_tuple("DISABLE_AMG", amg_disabled, "{0,1} AMG is disabled."));
188 return l;
189 }
190
191
192
193
194 } // end namespace

  ViewVC Help
Powered by ViewVC 1.1.26