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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4657 - (hide annotations)
Thu Feb 6 06:12:20 2014 UTC (5 years, 2 months ago) by jfenwick
File size: 4485 byte(s)
I changed some files.
Updated copyright notices, added GeoComp.



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

  ViewVC Help
Powered by ViewVC 1.1.26