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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26