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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2721 - (hide annotations)
Fri Oct 16 05:40:12 2009 UTC (9 years, 6 months ago) by jfenwick
Original Path: trunk/escript/src/EscriptParams.cpp
File size: 3000 byte(s)
minval and maxval are now lazy operations (they weren't before).
Whether or not Lsup, sup and inf resolve their arguments before computing answers is controlled by the escriptParam 'RESOLVE_COLLECTIVE'.
Note: integrate() still forces a resolve.

Added some unit tests for operations which weren't tested before.
Added deepcopy implementations for lazy operations which got missed somehow.
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 1897
19     namespace escript
20     {
21    
22     EscriptParams escriptParams; // externed in header file
23    
24    
25     EscriptParams::EscriptParams()
26     {
27     too_many_lines=80;
28 jfenwick 2146 autolazy=0;
29 jfenwick 2501 too_many_levels=70;
30     too_many_nodes=15000;
31 jfenwick 2721 resolve_collective=0;
32 jfenwick 2273 // These #defs are for performance testing only
33     // in general, I don't want people tweaking the
34     // default value using compiler options
35     // I've provided a python interface for that
36     #ifdef FAUTOLAZYON
37     autolazy=1;
38     #endif
39     #ifdef FAUTOLAZYOFF
40     autolazy=0;
41     #endif
42 jfenwick 2721
43     #ifdef FRESCOLLECTON
44     resolve_collective=1;
45     #endif
46     #ifdef FRESCOLLECTOFF
47     resolve_collective=0;
48     #endif
49    
50 jfenwick 1897 }
51    
52     int
53     EscriptParams::getInt(const char* name, int sentinel) const
54     {
55     if (!strcmp(name,"TOO_MANY_LINES"))
56     {
57     return too_many_lines;
58     }
59 jfenwick 2146 if (!strcmp(name,"AUTOLAZY"))
60     {
61     return autolazy;
62     }
63 jfenwick 2472 if (!strcmp(name,"TOO_MANY_LEVELS"))
64     {
65     return too_many_levels;
66     }
67     if (!strcmp(name,"TOO_MANY_NODES"))
68     {
69     return too_many_nodes;
70     }
71 jfenwick 2721 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
72     {
73     return resolve_collective;
74     }
75 jfenwick 1897 return sentinel;
76     }
77    
78     void
79     EscriptParams::setInt(const char* name, int value)
80     {
81     if (!strcmp(name,"TOO_MANY_LINES"))
82     {
83     too_many_lines=value;
84     }
85 jfenwick 2146 if (!strcmp(name,"AUTOLAZY"))
86     {
87     autolazy=!(value==0); // set to 1 or zero
88     }
89 jfenwick 2472 if (!strcmp(name,"TOO_MANY_LEVELS"))
90     {
91     too_many_levels=value;
92     }
93     if (!strcmp(name,"TOO_MANY_NODES"))
94     {
95     too_many_nodes=value;
96     }
97 jfenwick 2721 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
98     {
99     resolve_collective=value;
100     }
101 jfenwick 1897 }
102    
103     void
104     setEscriptParamInt(const char* name, int value)
105     {
106     escriptParams.setInt(name,value);
107     }
108    
109    
110     int
111     getEscriptParamInt(const char* name, int sentinel)
112     {
113     return escriptParams.getInt(name, sentinel);
114     }
115    
116 jfenwick 2142 boost::python::list
117 jfenwick 2721 EscriptParams::listEscriptParams()
118 jfenwick 2142 {
119     using namespace boost::python;
120     boost::python::list l;
121 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."));
122     l.append(make_tuple("AUTOLAZY", autolazy, "{0,1} Operations involving Expanded Data will create lazy results."));
123     l.append(make_tuple("RESOLVE_COLLECTIVE",resolve_collective ,"(TESTING ONLY) {0.1} Collective operations will resolve their data."));
124     l.append(make_tuple("TOO_MANY_LEVELS", too_many_levels, "(TESTING ONLY) maximum levels allowed in an expression."));
125     l.append(make_tuple("TOO_MANY_NODES", too_many_nodes, "(TESTING ONLY) maximum number of nodes in a expression."));
126 jfenwick 2142 return l;
127     }
128 jfenwick 1897
129 jfenwick 2142
130 jfenwick 2721
131    
132 jfenwick 1897 } // end namespace

  ViewVC Help
Powered by ViewVC 1.1.26