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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5228 - (hide annotations)
Mon Oct 27 23:31:46 2014 UTC (4 years, 5 months ago) by caltinay
File size: 5236 byte(s)
updated UMFPACK def in places...

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 jfenwick 4713
24     #include "esysUtils/Esys_MPI.h"
25    
26 jfenwick 1897 namespace escript
27     {
28    
29     EscriptParams escriptParams; // externed in header file
30    
31    
32     EscriptParams::EscriptParams()
33     {
34     too_many_lines=80;
35 jfenwick 2146 autolazy=0;
36 jfenwick 2501 too_many_levels=70;
37 jfenwick 2795 // too_many_nodes=15000;
38 jfenwick 2721 resolve_collective=0;
39 jfenwick 2795 lazy_str_fmt=0;
40     lazy_verbose=0;
41 jfenwick 2742
42     #ifdef USE_LAPACK
43     lapack_support=1;
44     #else
45     lapack_support=0;
46     #endif
47 jfenwick 2273 // These #defs are for performance testing only
48     // in general, I don't want people tweaking the
49     // default value using compiler options
50     // I've provided a python interface for that
51     #ifdef FAUTOLAZYON
52     autolazy=1;
53     #endif
54     #ifdef FAUTOLAZYOFF
55     autolazy=0;
56     #endif
57 jfenwick 2721
58     #ifdef FRESCOLLECTON
59     resolve_collective=1;
60     #endif
61     #ifdef FRESCOLLECTOFF
62     resolve_collective=0;
63     #endif
64    
65 jfenwick 3906
66     #ifdef ESYS_MPI
67     amg_disabled=true;
68     #else
69     amg_disabled=false;
70     #endif
71    
72 jfenwick 4713 temp_direct_solver=false; // This variable is to be removed once proper
73     // SolverOptions support is in place
74     #ifdef MKL
75     temp_direct_solver=true;
76     #endif
77 caltinay 5228 #ifdef USE_UMFPACK
78     temp_direct_solver=true;
79 jfenwick 4713 #endif
80     #ifdef PASTIX
81     temp_direct_solver=true;
82     #endif
83 jfenwick 3906
84 jfenwick 1897 }
85    
86     int
87     EscriptParams::getInt(const char* name, int sentinel) const
88     {
89     if (!strcmp(name,"TOO_MANY_LINES"))
90     {
91     return too_many_lines;
92     }
93 jfenwick 2146 if (!strcmp(name,"AUTOLAZY"))
94     {
95     return autolazy;
96     }
97 jfenwick 2472 if (!strcmp(name,"TOO_MANY_LEVELS"))
98     {
99     return too_many_levels;
100     }
101 jfenwick 2795 // if (!strcmp(name,"TOO_MANY_NODES"))
102     // {
103     // return too_many_nodes;
104     // }
105 jfenwick 2721 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
106     {
107     return resolve_collective;
108     }
109 jfenwick 2795 if (!strcmp(name,"LAZY_STR_FMT"))
110 jfenwick 2737 {
111 jfenwick 2795 return lazy_str_fmt;
112 jfenwick 2737 }
113 jfenwick 2742 if (!strcmp(name,"LAPACK_SUPPORT"))
114     {
115     return lapack_support;
116     }
117 jfenwick 2769 if (!strcmp(name, "NAN_CHECK"))
118     {
119 jfenwick 2773 #ifdef isnan
120 jfenwick 2769 return 1;
121     #else
122     return 0;
123     #endif
124     }
125 jfenwick 2795 if (!strcmp(name,"LAZY_VERBOSE"))
126     {
127     return lazy_verbose;
128     }
129 jfenwick 3906 if (!strcmp(name, "DISABLE_AMG"))
130     {
131     return amg_disabled;
132     }
133 jfenwick 3940 if (!strcmp(name, "MPIBUILD"))
134     {
135     #ifdef ESYS_MPI
136     return 1;
137     #else
138     return 0;
139     #endif
140     }
141 jfenwick 4713 if (!strcmp(name, "PASO_DIRECT"))
142     {
143     // This is not in the constructor because escriptparams could be constructed
144     // before main (and hence no opportunity to call INIT)
145     #ifdef ESYS_MPI
146     int size;
147     if (MPI_Comm_size(MPI_COMM_WORLD, &size)!=MPI_SUCCESS) // This would break in a subworld
148     {
149     temp_direct_solver=false;
150     }
151     if (size>1)
152     {
153     temp_direct_solver=false;
154     }
155     #endif
156     return temp_direct_solver;
157     }
158 jfenwick 1897 return sentinel;
159     }
160    
161     void
162     EscriptParams::setInt(const char* name, int value)
163     {
164     if (!strcmp(name,"TOO_MANY_LINES"))
165     {
166     too_many_lines=value;
167     }
168 jfenwick 2146 if (!strcmp(name,"AUTOLAZY"))
169     {
170     autolazy=!(value==0); // set to 1 or zero
171     }
172 jfenwick 2472 if (!strcmp(name,"TOO_MANY_LEVELS"))
173     {
174     too_many_levels=value;
175     }
176 jfenwick 2795 // if (!strcmp(name,"TOO_MANY_NODES"))
177     // {
178     // too_many_nodes=value;
179     // }
180 jfenwick 2721 if (!strcmp(name,"RESOLVE_COLLECTIVE"))
181     {
182     resolve_collective=value;
183     }
184 jfenwick 2795 if (!strcmp(name,"LAZY_STR_FMT"))
185 jfenwick 2737 {
186 jfenwick 2795 lazy_str_fmt=value;
187 jfenwick 2737 }
188 jfenwick 2795 if (!strcmp(name,"LAZY_VERBOSE"))
189     {
190     lazy_verbose=value;
191     }
192 caltinay 4286 // Note: there is no way to modify the LAPACK_SUPPORT variable ATM
193 jfenwick 1897 }
194    
195     void
196     setEscriptParamInt(const char* name, int value)
197     {
198     escriptParams.setInt(name,value);
199     }
200    
201    
202     int
203     getEscriptParamInt(const char* name, int sentinel)
204     {
205     return escriptParams.getInt(name, sentinel);
206     }
207    
208 jfenwick 2142 boost::python::list
209 jfenwick 2721 EscriptParams::listEscriptParams()
210 jfenwick 2142 {
211     using namespace boost::python;
212     boost::python::list l;
213 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."));
214     l.append(make_tuple("AUTOLAZY", autolazy, "{0,1} Operations involving Expanded Data will create lazy results."));
215     l.append(make_tuple("RESOLVE_COLLECTIVE",resolve_collective ,"(TESTING ONLY) {0.1} Collective operations will resolve their data."));
216     l.append(make_tuple("TOO_MANY_LEVELS", too_many_levels, "(TESTING ONLY) maximum levels allowed in an expression."));
217 jfenwick 2795 // l.append(make_tuple("TOO_MANY_NODES", too_many_nodes, "(TESTING ONLY) maximum number of nodes in a expression."));
218     l.append(make_tuple("LAZY_STR_FMT", lazy_str_fmt, "{0,1,2}(TESTING ONLY) change output format for lazy expressions."));
219     l.append(make_tuple("LAZY_VERBOSE", lazy_verbose, "{0,1} Print a warning when expressions are resolved because they are too large."));
220 jfenwick 3906 l.append(make_tuple("DISABLE_AMG", amg_disabled, "{0,1} AMG is disabled."));
221 jfenwick 2142 return l;
222     }
223 jfenwick 1897
224 jfenwick 2142
225 jfenwick 2721
226    
227 jfenwick 1897 } // end namespace

  ViewVC Help
Powered by ViewVC 1.1.26