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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/escript/src/EscriptParams.cpp revision 2769 by jfenwick, Tue Nov 24 00:36:22 2009 UTC trunk/escriptcore/src/EscriptParams.cpp revision 5997 by caltinay, Mon Feb 29 07:24:47 2016 UTC
# Line 1  Line 1 
1    
2    
3  /*******************************************************  /*****************************************************************************
4  *  *
5  * Copyright (c) 2003-2009 by University of Queensland  * Copyright (c) 2003-2016 by The University of Queensland
6  * Earth Systems Science Computational Center (ESSCC)  * http://www.uq.edu.au
 * http://www.uq.edu.au/esscc  
7  *  *
8  * Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9  * Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10  * http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11  *  *
12  *******************************************************/  * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
13    * Development 2012-2013 by School of Earth Sciences
14    * Development from 2014 by Centre for Geoscience Computing (GeoComp)
15    *
16    *****************************************************************************/
17    
18    #define ESNEEDPYTHON
19    #include "esysUtils/first.h"
20    
21  #include "EscriptParams.h"  #include "EscriptParams.h"
22    #include "EsysException.h"
23    
24  #include <cstring>  #include <cstring>
25    #include <cmath> // to test if we know how to check for nan
26  #include <boost/python/tuple.hpp>  #include <boost/python/tuple.hpp>
 #include <cmath>            // to test if we know how to check for nan  
27    
28  namespace escript  namespace escript
29  {  {
30    
31  EscriptParams escriptParams;        // externed in header file  EscriptParams escriptParams;                // externed in header file
32    
33    
34  EscriptParams::EscriptParams()  EscriptParams::EscriptParams()
# Line 28  EscriptParams::EscriptParams() Line 36  EscriptParams::EscriptParams()
36     too_many_lines=80;     too_many_lines=80;
37     autolazy=0;     autolazy=0;
38     too_many_levels=70;     too_many_levels=70;
39     too_many_nodes=15000;     lazy_str_fmt=0;
40     resolve_collective=0;     lazy_verbose=0;
41     print_lazy_tree=0;  #ifdef USE_NETCDF
42       has_netcdf=1;
43    #else  
44       has_netcdf=0;
45    #endif  
46  #ifdef USE_LAPACK  #ifdef USE_LAPACK
47     lapack_support=1;     lapack_support=1;
48  #else  #else
49     lapack_support=0;     lapack_support=0;
50  #endif  #endif
51              // These #defs are for performance testing only  
52              // in general, I don't want people tweaking the      gmsh = gmsh_mpi = 0;
53              // default value using compiler options  #if defined(GMSH) || defined(GMSH_MPI)
54              // I've provided a python interface for that      gmsh = 1;
55    #endif
56        //only mark gmsh as mpi if escript built with mpi, otherwise comm_spawns
57        //might just fail terribly
58    #if defined(GMSH_MPI) && defined(ESYS_MPI)
59        gmsh_mpi = 1;
60    #endif
61    
62    #ifdef ESYS_MPI
63        amg_disabled=true;
64    #else
65        amg_disabled=false;
66    #endif
67    
68        temp_direct_solver=false;   // This variable is to be removed once proper
69                                    // SolverOptions support is in place
70    #ifdef MKL
71        temp_direct_solver=true;
72    #endif
73    #ifdef USE_UMFPACK
74        temp_direct_solver=true;
75    #endif
76    #ifdef PASTIX
77        temp_direct_solver=true;
78    #endif
79    
80                            // These #defs are for performance testing only
81                            // in general, I don't want people tweaking the
82                            // default value using compiler options
83                            // I've provided a python interface for that
84  #ifdef FAUTOLAZYON  #ifdef FAUTOLAZYON
85     autolazy=1;     autolazy=1;
86  #endif  #endif
# Line 54  EscriptParams::EscriptParams() Line 94  EscriptParams::EscriptParams()
94  #ifdef FRESCOLLECTOFF  #ifdef FRESCOLLECTOFF
95     resolve_collective=0;     resolve_collective=0;
96  #endif  #endif
   
97  }  }
98    
99  int  int
# Line 62  EscriptParams::getInt(const char* name, Line 101  EscriptParams::getInt(const char* name,
101  {  {
102     if (!strcmp(name,"TOO_MANY_LINES"))     if (!strcmp(name,"TOO_MANY_LINES"))
103     {     {
104      return too_many_lines;          return too_many_lines;
105     }     }
106     if (!strcmp(name,"AUTOLAZY"))     if (!strcmp(name,"AUTOLAZY"))
107     {     {
108      return autolazy;          return autolazy;
109     }     }
110     if (!strcmp(name,"TOO_MANY_LEVELS"))     if (!strcmp(name,"TOO_MANY_LEVELS"))
111     {     {
112      return too_many_levels;          return too_many_levels;
    }  
    if (!strcmp(name,"TOO_MANY_NODES"))  
    {  
     return too_many_nodes;  
113     }     }
114     if (!strcmp(name,"RESOLVE_COLLECTIVE"))     if (!strcmp(name,"RESOLVE_COLLECTIVE"))
115     {     {
116      return resolve_collective;          return resolve_collective;
117     }     }
118     if (!strcmp(name,"PRINT_LAZY_TREE"))     if (!strcmp(name,"LAZY_STR_FMT"))
119     {     {
120      return print_lazy_tree;          return lazy_str_fmt;
121     }     }
122     if (!strcmp(name,"LAPACK_SUPPORT"))     if (!strcmp(name,"LAPACK_SUPPORT"))
123     {     {
124      return lapack_support;          return lapack_support;
125     }     }
126     if (!strcmp(name, "NAN_CHECK"))     if (!strcmp(name, "NAN_CHECK"))
127     {     {
128  #ifdef FP_NAN    #ifdef isnan        
129      return 1;          return 1;
130  #else  #else
131      return 0;          return 0;
132  #endif  #endif
133     }     }
134     return sentinel;     if (!strcmp(name,"LAZY_VERBOSE"))
 }  
     
 void  
 EscriptParams::setInt(const char* name, int value)  
 {  
    if (!strcmp(name,"TOO_MANY_LINES"))  
135     {     {
136      too_many_lines=value;          return lazy_verbose;
137     }     }
138     if (!strcmp(name,"AUTOLAZY"))     if (!strcmp(name, "DISABLE_AMG"))
139     {     {
140      autolazy=!(value==0);   // set to 1 or zero          return amg_disabled;
141     }     }
142     if (!strcmp(name,"TOO_MANY_LEVELS"))     if (!strcmp(name, "MPIBUILD"))
143     {     {
144      too_many_levels=value;  #ifdef ESYS_MPI          
145     }          return 1;
146     if (!strcmp(name,"TOO_MANY_NODES"))  #else
147     {          return 0;
148      too_many_nodes=value;  #endif
    }  
    if (!strcmp(name,"RESOLVE_COLLECTIVE"))  
    {  
     resolve_collective=value;  
149     }     }
150     if (!strcmp(name,"PRINT_LAZY_TREE"))     if (!strcmp(name, "PASO_DIRECT"))
151     {     {
152      print_lazy_tree=value;          // This is not in the constructor because escriptparams could be constructed
153     }          // before main (and hence no opportunity to call INIT)
154     // Note: there is no way to modifiy the LAPACK_SUPPORT variable atm          #ifdef ESYS_MPI
155                int size;
156                if (MPI_Comm_size(MPI_COMM_WORLD, &size)!=MPI_SUCCESS)        // This would break in a subworld
157                {
158                    temp_direct_solver=false;        
159                }
160                if (size>1)
161                {
162                    temp_direct_solver=false;
163                }
164            #endif  
165            return temp_direct_solver;
166       }
167        if (!strcmp(name, "NETCDF_BUILD"))
168        {
169           return has_netcdf;
170        }
171        if (!strcmp(name, "GMSH_SUPPORT"))
172            return gmsh;
173        if (!strcmp(name, "GMSH_MPI"))
174            return gmsh_mpi;
175       return sentinel;
176    }
177      
178    void
179    EscriptParams::setInt(const char* name, int value)
180    {
181       // Note: there is no way to modify the LAPACK_SUPPORT variable ATM
182        if (!strcmp(name,"TOO_MANY_LINES"))
183            too_many_lines=value;
184        else if (!strcmp(name,"AUTOLAZY"))
185            autolazy=!(value==0);        // set to 1 or zero
186        else if (!strcmp(name,"TOO_MANY_LEVELS"))
187            too_many_levels=value;
188        else if (!strcmp(name,"RESOLVE_COLLECTIVE"))
189            resolve_collective=value;
190        else if (!strcmp(name,"LAZY_STR_FMT"))
191            lazy_str_fmt=value;
192        else if (!strcmp(name,"LAZY_VERBOSE"))
193            lazy_verbose=value;
194        else
195           throw EsysException("Invalid parameter name");
196  }  }
197    
198  void  void
# Line 151  EscriptParams::listEscriptParams() Line 217  EscriptParams::listEscriptParams()
217     l.append(make_tuple("AUTOLAZY", autolazy, "{0,1} Operations involving Expanded Data will create lazy results."));     l.append(make_tuple("AUTOLAZY", autolazy, "{0,1} Operations involving Expanded Data will create lazy results."));
218     l.append(make_tuple("RESOLVE_COLLECTIVE",resolve_collective ,"(TESTING ONLY) {0.1} Collective operations will resolve their data."));     l.append(make_tuple("RESOLVE_COLLECTIVE",resolve_collective ,"(TESTING ONLY) {0.1} Collective operations will resolve their data."));
219     l.append(make_tuple("TOO_MANY_LEVELS", too_many_levels, "(TESTING ONLY) maximum levels allowed in an expression."));     l.append(make_tuple("TOO_MANY_LEVELS", too_many_levels, "(TESTING ONLY) maximum levels allowed in an expression."));
220     l.append(make_tuple("TOO_MANY_NODES", too_many_nodes, "(TESTING ONLY) maximum number of nodes in a expression."));     l.append(make_tuple("LAZY_STR_FMT", lazy_str_fmt, "{0,1,2}(TESTING ONLY) change output format for lazy expressions."));
221       l.append(make_tuple("LAZY_VERBOSE", lazy_verbose, "{0,1} Print a warning when expressions are resolved because they are too large."));
222       l.append(make_tuple("DISABLE_AMG", amg_disabled, "{0,1} AMG is disabled."));
223       l.append(make_tuple("NETCDF_BUILD", has_netcdf, "{0,1} Was this build made with netcdf libraries?"));
224       l.append(make_tuple("GMSH_SUPPORT", gmsh, "{0,1} Non-python GMSH support is available."));
225       l.append(make_tuple("GMSH_MPI", gmsh_mpi, "{0,1} Both GMSH and escript have MPI capabilities."));
226     return l;     return l;
227  }  }
228    
229    } // end namespace
230    
   
   
 }   // end namespace  

Legend:
Removed from v.2769  
changed lines
  Added in v.5997

  ViewVC Help
Powered by ViewVC 1.1.26