20 #ifndef _libint2_src_bin_libint_defaultparams_h_ 21 #define _libint2_src_bin_libint_defaultparams_h_ 28 #include <smart_ptr.h> 38 std::string default_task_name_;
47 unsigned int max_am(std::string t =
"",
unsigned int c = 0)
const;
49 unsigned int max_am_opt(std::string t =
"")
const;
51 unsigned int num_bf(std::string t =
"")
const;
54 return max_vector_length_;
58 return vectorize_by_line_;
62 return unroll_threshold_;
70 return source_directory_;
78 return single_evaltype_;
82 return use_C_linking_;
94 return accumulate_targets_;
102 return contracted_targets_;
106 return default_task_name_;
110 void max_am(
const std::string& t,
unsigned int a,
unsigned int c=0);
112 void max_am_opt(
const std::string& t,
unsigned int a);
114 void num_bf(
const std::string& t,
unsigned int a);
117 max_vector_length_ = a;
121 vectorize_by_line_ = flag;
129 unroll_threshold_ = a;
133 source_directory_ = a;
141 single_evaltype_ = se;
157 accumulate_targets_ = a;
165 contracted_targets_ = c;
169 default_task_name_ = s;
173 void print(std::ostream& os)
const;
178 static const unsigned int max_am = 1;
180 static const unsigned int max_am_opt = 1;
182 static const unsigned int num_bf = 4;
202 static const bool profile =
false;
210 static const std::string task_name;
213 struct TaskParameters {
215 std::vector<unsigned int>
max_am;
224 std::map<std::string,TaskParameters> task_params_;
226 void task_exists(
const std::string& t)
const;
228 void add_task(
const std::string& t);
231 unsigned int max_vector_length_;
233 bool vectorize_by_line_;
237 unsigned int align_size_;
239 unsigned int unroll_threshold_;
241 std::string source_directory_;
243 std::string api_prefix_;
245 bool single_evaltype_;
253 bool accumulate_targets_;
255 std::string realtype_;
257 bool contracted_targets_;
275 return max_stack_size_.size() - 1;
279 return max_stack_size_.at(am);
286 if (am + 1 > max_vector_stack_size_.size())
289 return max_vector_stack_size_[am];
295 if (am + 1 > max_hrr_hsrank_.size())
298 return max_hrr_hsrank_[am];
304 if (am + 1 > max_hrr_lsrank_.size())
307 return max_hrr_lsrank_[am];
312 if (max_ntarget_ < ntarget)
313 max_ntarget_ = ntarget;
318 extend_max_size(max_stack_size_, am, size);
323 extend_max_size(max_vector_stack_size_, am, size);
328 extend_max_size(max_hrr_hsrank_, am, rank);
333 extend_max_size(max_hrr_lsrank_, am, rank);
337 unsigned int max_ntarget_;
338 std::vector<unsigned int> max_stack_size_;
339 std::vector<unsigned int> max_vector_stack_size_;
340 std::vector<unsigned int> max_hrr_hsrank_;
341 std::vector<unsigned int> max_hrr_lsrank_;
343 static void extend_max_size(std::vector<unsigned int>& max_size,
unsigned int am,
unsigned int size) {
344 const int max_am = (int)max_size.size() - 1u;
345 if (max_am < (
int)am) {
346 max_size.resize(am + 1);
347 for(
int l = std::max(max_am+1,1); l<=(int)am; ++l)
348 max_size[l] = max_size[l-1];
350 if (max_size[am] < size)
360 static const unsigned int num_am_letters = 10;
362 static const char am_letters[num_am_letters+1];
void max_hrr_lsrank(unsigned int am, unsigned int rank)
if max_hrr_lsrank_ < rank then set max_hrr_lsrank_=rank
Definition: default_params.h:332
void source_directory(const std::string &a)
set generated source directory
Definition: default_params.h:132
void max_stack_size(unsigned int am, unsigned int size)
if max_stack_size_ < size then set max_stack_size_=size
Definition: default_params.h:317
void max_vector_stack_size(unsigned int am, unsigned int size)
if max_vector_stack_size_ < size then set max_vector_stack_size_=size
Definition: default_params.h:322
void vectorize_by_line(bool flag)
set vectorize_by_line flag
Definition: default_params.h:120
const std::string & default_task_name() const
default task name
Definition: default_params.h:105
Static parameters.
Definition: default_params.h:356
std::string label_to_funcname(const std::string &label)
Converts a label, e.g. name of the target node, to the name of the function to compute it...
Definition: default_params.cc:215
unsigned int align_size() const
returns alignment size (in units of sizeof(LIBINT_FLOAT))
Definition: default_params.h:65
void unroll_threshold(unsigned int a)
set unroll threshold
Definition: default_params.h:128
bool condense_expr(unsigned int unroll_threshold, bool vectorize)
need to condense expressions? Makes sense if vectorizing the code or the compiler somehow prefers lon...
Definition: default_params.cc:228
void single_evaltype(bool se)
generate a single evaluator type (i.e. not specific to each task)?
Definition: default_params.h:140
bool profile() const
whether profiling instrumentation is enabled
Definition: default_params.h:89
void contracted_targets(bool c)
support contracted targets?
Definition: default_params.h:164
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:23
void max_hrr_hsrank(unsigned int am, unsigned int rank)
if max_hrr_hsrank_ < rank then set max_hrr_hsrank_=rank
Definition: default_params.h:327
unsigned int max_vector_length() const
returns max vector length
Definition: default_params.h:53
void realtype(const std::string &realtype)
which floating-point type to use
Definition: default_params.h:160
This class maintains various parameters for each task type which can only be determined during the so...
Definition: default_params.h:264
unsigned int unroll_threshold() const
returns unroll threshold
Definition: default_params.h:61
void print(std::ostream &os) const
print params out
Definition: default_params.cc:55
const std::string & source_directory() const
returns directory path for the generated source
Definition: default_params.h:69
unsigned int max_ntarget() const
returns the max number of targets
Definition: default_params.h:270
void accumulate_targets(bool a)
accumulate targets?
Definition: default_params.h:156
const std::string & api_prefix() const
the API prefix
Definition: default_params.h:73
const std::string & realtype() const
name of the floating-point type
Definition: default_params.h:97
void max_vector_length(unsigned int a)
set max vector length
Definition: default_params.h:116
void default_task_name(const std::string &s)
default task name
Definition: default_params.h:168
unsigned int max_am() const
returns the max quantum number of targets
Definition: default_params.h:274
CompilationParameters()
Use default parameters.
Definition: default_params.cc:33
unsigned int max_hrr_hsrank(unsigned int am) const
returns max rank of high-significance functions in a HRR call.
Definition: default_params.h:294
bool single_evaltype() const
generate single evaluator type (i.e. not specific to each task)?
Definition: default_params.h:77
unsigned int max_am(std::string t="", unsigned int c=0) const
returns max AM for task t and center c
Definition: default_params.cc:99
void use_C_linking(bool a)
set whether to use C style linking
Definition: default_params.h:144
bool accumulate_targets() const
whether target integrals are accumulated
Definition: default_params.h:93
void profile(bool a)
set to instrument profiling
Definition: default_params.h:152
bool contracted_targets() const
whether contracted targets are supported
Definition: default_params.h:101
unsigned int max_vector_stack_size(unsigned int am) const
returns max vector stack size.
Definition: default_params.h:285
bool count_flops() const
whether FLOP counting is enabled
Definition: default_params.h:85
void align_size(unsigned int a)
set alignment size (in units of sizeof(LIBINT_FLOAT))
Definition: default_params.h:124
unsigned int max_hrr_lsrank(unsigned int am) const
returns max rank of low-significance functions in a HRR call.
Definition: default_params.h:303
unsigned int num_bf(std::string t="") const
returns number of basis functions in integrals for task t
Definition: default_params.cc:127
void api_prefix(const std::string &a)
API prefix.
Definition: default_params.h:136
bool use_C_linking() const
returns whether to use C-style linking
Definition: default_params.h:81
void count_flops(bool a)
set whether to count FLOPs
Definition: default_params.h:148
These are the parameters received by the compiler.
Definition: default_params.h:37
bool vectorize_by_line() const
returns whether to vectorize line-by-line
Definition: default_params.h:57
unsigned int max_am_opt(std::string t="") const
returns max AM for which to produce optimal code for task t
Definition: default_params.cc:113
void max_ntarget(unsigned int ntarget)
if max_ntarget_ < ntarget then set max_ntarget_=ntarget
Definition: default_params.h:311
unsigned int max_stack_size(unsigned int am) const
returns max stack size needed for quantum numbers up to am
Definition: default_params.h:278