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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2721 - (show annotations)
Fri Oct 16 05:40:12 2009 UTC (10 years, 8 months ago) by jfenwick
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
2
3 /*******************************************************
4 *
5 * Copyright (c) 2003-2009 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
19 namespace escript
20 {
21
22 EscriptParams escriptParams; // externed in header file
23
24
25 EscriptParams::EscriptParams()
26 {
27 too_many_lines=80;
28 autolazy=0;
29 too_many_levels=70;
30 too_many_nodes=15000;
31 resolve_collective=0;
32 // 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
43 #ifdef FRESCOLLECTON
44 resolve_collective=1;
45 #endif
46 #ifdef FRESCOLLECTOFF
47 resolve_collective=0;
48 #endif
49
50 }
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 if (!strcmp(name,"AUTOLAZY"))
60 {
61 return autolazy;
62 }
63 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 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
72 {
73 return resolve_collective;
74 }
75 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 if (!strcmp(name,"AUTOLAZY"))
86 {
87 autolazy=!(value==0); // set to 1 or zero
88 }
89 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 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
98 {
99 resolve_collective=value;
100 }
101 }
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 boost::python::list
117 EscriptParams::listEscriptParams()
118 {
119 using namespace boost::python;
120 boost::python::list l;
121 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 return l;
127 }
128
129
130
131
132 } // end namespace

  ViewVC Help
Powered by ViewVC 1.1.26