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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2737 - (show annotations)
Tue Nov 3 00:44:00 2009 UTC (11 years, 3 months ago) by jfenwick
File size: 3171 byte(s)
icc will now record compiler options in libraries.
escriptParams now has a pretty printer option for lazy expressions.
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 print_lazy_tree=0;
33 // These #defs are for performance testing only
34 // in general, I don't want people tweaking the
35 // default value using compiler options
36 // I've provided a python interface for that
37 #ifdef FAUTOLAZYON
38 autolazy=1;
39 #endif
40 #ifdef FAUTOLAZYOFF
41 autolazy=0;
42 #endif
43
44 #ifdef FRESCOLLECTON
45 resolve_collective=1;
46 #endif
47 #ifdef FRESCOLLECTOFF
48 resolve_collective=0;
49 #endif
50
51 }
52
53 int
54 EscriptParams::getInt(const char* name, int sentinel) const
55 {
56 if (!strcmp(name,"TOO_MANY_LINES"))
57 {
58 return too_many_lines;
59 }
60 if (!strcmp(name,"AUTOLAZY"))
61 {
62 return autolazy;
63 }
64 if (!strcmp(name,"TOO_MANY_LEVELS"))
65 {
66 return too_many_levels;
67 }
68 if (!strcmp(name,"TOO_MANY_NODES"))
69 {
70 return too_many_nodes;
71 }
72 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
73 {
74 return resolve_collective;
75 }
76 if (!strcmp(name,"PRINT_LAZY_TREE"))
77 {
78 return print_lazy_tree;
79 }
80 return sentinel;
81 }
82
83 void
84 EscriptParams::setInt(const char* name, int value)
85 {
86 if (!strcmp(name,"TOO_MANY_LINES"))
87 {
88 too_many_lines=value;
89 }
90 if (!strcmp(name,"AUTOLAZY"))
91 {
92 autolazy=!(value==0); // set to 1 or zero
93 }
94 if (!strcmp(name,"TOO_MANY_LEVELS"))
95 {
96 too_many_levels=value;
97 }
98 if (!strcmp(name,"TOO_MANY_NODES"))
99 {
100 too_many_nodes=value;
101 }
102 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
103 {
104 resolve_collective=value;
105 }
106 if (!strcmp(name,"PRINT_LAZY_TREE"))
107 {
108 print_lazy_tree=value;
109 }
110 }
111
112 void
113 setEscriptParamInt(const char* name, int value)
114 {
115 escriptParams.setInt(name,value);
116 }
117
118
119 int
120 getEscriptParamInt(const char* name, int sentinel)
121 {
122 return escriptParams.getInt(name, sentinel);
123 }
124
125 boost::python::list
126 EscriptParams::listEscriptParams()
127 {
128 using namespace boost::python;
129 boost::python::list l;
130 l.append(make_tuple("TOO_MANY_LINES", too_many_lines, "Maximum number of lines to output when printing data before printing a summary instead."));
131 l.append(make_tuple("AUTOLAZY", autolazy, "{0,1} Operations involving Expanded Data will create lazy results."));
132 l.append(make_tuple("RESOLVE_COLLECTIVE",resolve_collective ,"(TESTING ONLY) {0.1} Collective operations will resolve their data."));
133 l.append(make_tuple("TOO_MANY_LEVELS", too_many_levels, "(TESTING ONLY) maximum levels allowed in an expression."));
134 l.append(make_tuple("TOO_MANY_NODES", too_many_nodes, "(TESTING ONLY) maximum number of nodes in a expression."));
135 return l;
136 }
137
138
139
140
141 } // end namespace

  ViewVC Help
Powered by ViewVC 1.1.26