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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2795 - (hide annotations)
Wed Dec 2 02:39:23 2009 UTC (11 years, 4 months ago) by jfenwick
File size: 3977 byte(s)
Removed node limit on lazy expressions.
The parameter LAZY_STR_FMT {0,1,2}  controls how lazy expressions are printed.
0 gives default output
1 gives a tree form.
2 just prints depth
1 jfenwick 1897
2    
3     /*******************************************************
4     *
5 jfenwick 2548 * Copyright (c) 2003-2009 by University of Queensland
6 jfenwick 1897 * 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 jfenwick 2142 #include "EscriptParams.h"
16 jfenwick 1897 #include <cstring>
17 jfenwick 2142 #include <boost/python/tuple.hpp>
18 jfenwick 2769 #include <cmath> // to test if we know how to check for nan
19 jfenwick 1897
20     namespace escript
21     {
22    
23     EscriptParams escriptParams; // externed in header file
24    
25    
26     EscriptParams::EscriptParams()
27     {
28     too_many_lines=80;
29 jfenwick 2146 autolazy=0;
30 jfenwick 2501 too_many_levels=70;
31 jfenwick 2795 // too_many_nodes=15000;
32 jfenwick 2721 resolve_collective=0;
33 jfenwick 2795 lazy_str_fmt=0;
34     lazy_verbose=0;
35 jfenwick 2742
36     #ifdef USE_LAPACK
37     lapack_support=1;
38     #else
39     lapack_support=0;
40     #endif
41 jfenwick 2273 // 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 jfenwick 2721
52     #ifdef FRESCOLLECTON
53     resolve_collective=1;
54     #endif
55     #ifdef FRESCOLLECTOFF
56     resolve_collective=0;
57     #endif
58    
59 jfenwick 1897 }
60    
61     int
62     EscriptParams::getInt(const char* name, int sentinel) const
63     {
64     if (!strcmp(name,"TOO_MANY_LINES"))
65     {
66     return too_many_lines;
67     }
68 jfenwick 2146 if (!strcmp(name,"AUTOLAZY"))
69     {
70     return autolazy;
71     }
72 jfenwick 2472 if (!strcmp(name,"TOO_MANY_LEVELS"))
73     {
74     return too_many_levels;
75     }
76 jfenwick 2795 // if (!strcmp(name,"TOO_MANY_NODES"))
77     // {
78     // return too_many_nodes;
79     // }
80 jfenwick 2721 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
81     {
82     return resolve_collective;
83     }
84 jfenwick 2795 if (!strcmp(name,"LAZY_STR_FMT"))
85 jfenwick 2737 {
86 jfenwick 2795 return lazy_str_fmt;
87 jfenwick 2737 }
88 jfenwick 2742 if (!strcmp(name,"LAPACK_SUPPORT"))
89     {
90     return lapack_support;
91     }
92 jfenwick 2769 if (!strcmp(name, "NAN_CHECK"))
93     {
94 jfenwick 2773 #ifdef isnan
95 jfenwick 2769 return 1;
96     #else
97     return 0;
98     #endif
99     }
100 jfenwick 2795 if (!strcmp(name,"LAZY_VERBOSE"))
101     {
102     return lazy_verbose;
103     }
104 jfenwick 1897 return sentinel;
105     }
106    
107     void
108     EscriptParams::setInt(const char* name, int value)
109     {
110     if (!strcmp(name,"TOO_MANY_LINES"))
111     {
112     too_many_lines=value;
113     }
114 jfenwick 2146 if (!strcmp(name,"AUTOLAZY"))
115     {
116     autolazy=!(value==0); // set to 1 or zero
117     }
118 jfenwick 2472 if (!strcmp(name,"TOO_MANY_LEVELS"))
119     {
120     too_many_levels=value;
121     }
122 jfenwick 2795 // if (!strcmp(name,"TOO_MANY_NODES"))
123     // {
124     // too_many_nodes=value;
125     // }
126 jfenwick 2721 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
127     {
128     resolve_collective=value;
129     }
130 jfenwick 2795 if (!strcmp(name,"LAZY_STR_FMT"))
131 jfenwick 2737 {
132 jfenwick 2795 lazy_str_fmt=value;
133 jfenwick 2737 }
134 jfenwick 2795 if (!strcmp(name,"LAZY_VERBOSE"))
135     {
136     lazy_verbose=value;
137     }
138 jfenwick 2742 // Note: there is no way to modifiy the LAPACK_SUPPORT variable atm
139 jfenwick 1897 }
140    
141     void
142     setEscriptParamInt(const char* name, int value)
143     {
144     escriptParams.setInt(name,value);
145     }
146    
147    
148     int
149     getEscriptParamInt(const char* name, int sentinel)
150     {
151     return escriptParams.getInt(name, sentinel);
152     }
153    
154 jfenwick 2142 boost::python::list
155 jfenwick 2721 EscriptParams::listEscriptParams()
156 jfenwick 2142 {
157     using namespace boost::python;
158     boost::python::list l;
159 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."));
160     l.append(make_tuple("AUTOLAZY", autolazy, "{0,1} Operations involving Expanded Data will create lazy results."));
161     l.append(make_tuple("RESOLVE_COLLECTIVE",resolve_collective ,"(TESTING ONLY) {0.1} Collective operations will resolve their data."));
162     l.append(make_tuple("TOO_MANY_LEVELS", too_many_levels, "(TESTING ONLY) maximum levels allowed in an expression."));
163 jfenwick 2795 // l.append(make_tuple("TOO_MANY_NODES", too_many_nodes, "(TESTING ONLY) maximum number of nodes in a expression."));
164     l.append(make_tuple("LAZY_STR_FMT", lazy_str_fmt, "{0,1,2}(TESTING ONLY) change output format for lazy expressions."));
165     l.append(make_tuple("LAZY_VERBOSE", lazy_verbose, "{0,1} Print a warning when expressions are resolved because they are too large."));
166 jfenwick 2142 return l;
167     }
168 jfenwick 1897
169 jfenwick 2142
170 jfenwick 2721
171    
172 jfenwick 1897 } // end namespace

  ViewVC Help
Powered by ViewVC 1.1.26