39 const std::string filename_input =
"test_Mult_Wilson.yaml";
40 const std::string filename_output =
"stdout";
42 class Parameters_Test_Mult_Wilson :
public Parameters {
44 Parameters_Test_Mult_Wilson()
46 Register_string(
"gauge_config_status",
"NULL");
47 Register_string(
"gauge_config_type_input",
"NULL");
48 Register_string(
"config_filename_input",
"NULL");
50 Register_int(
"number_of_mult", 0);
52 Register_string(
"verbose_level",
"NULL");
54 Register_double(
"expected_result", 0.0);
62 #ifdef USE_TESTMANAGER_AUTOREGISTER
93 const string str_gconf_status = params_test->
get_string(
"gauge_config_status");
94 const string str_gconf_read = params_test->
get_string(
"gauge_config_type_input");
95 const string readfile = params_test->
get_string(
"config_filename_input");
96 const int Nmult = params_test->
get_int(
"number_of_mult");
97 const string str_vlevel = params_test->
get_string(
"verbose_level");
99 const bool do_check = params_test->
is_set(
"expected_result");
100 const double expected_result = do_check ? params_test->
get_double(
"expected_result") : 0.0;
102 const string str_gmset_type = params_fopr->
get_string(
"gamma_matrix_type");
103 const int Ns = params_fopr->
get_int(
"extent_of_5th_dimension");
108 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
109 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
110 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
112 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
113 vout.
general(vl,
" gmset_type = %s\n", str_gmset_type.c_str());
120 vout.
crucial(vl,
"%s: Input parameters have not been set.\n", test_name.c_str());
129 if (str_gconf_status ==
"Continue") {
131 }
else if (str_gconf_status ==
"Cold_start") {
133 }
else if (str_gconf_status ==
"Hot_start") {
134 int i_seed_noise = 1234567;
138 vout.
crucial(vl,
"%s: unsupported gconf status \"%s\".\n", test_name.c_str(), str_gconf_status.c_str());
168 for (
int i = 0; i < Nmult; ++i) {
181 double result_single = y.
norm();
183 if (
Test::verify(abs(result - result_single), 0.0, epsilon)) {
184 vout.
crucial(
"%s: result(multithread) not equal to result(single thread)\n", test_name.c_str());
185 vout.
crucial(
"%s: result(multithread) = %22.14e\n", test_name.c_str(), result);
186 vout.
crucial(
"%s: result(single thread) = %22.14e\n", test_name.c_str(), result_single);
199 double gflo_mult = fopr->
flop_count() / 1.0e+9;
200 double gflops_mult = gflo_mult * Nmult / (elapse_sec * NPE * Nthread);
202 vout.
general(vl,
"%s: %12.4e GFlops / core\n", test_name.c_str(), gflops_mult);
209 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
Random number generator base on M-series.
void detailed(const char *format,...)
static double epsilon_criterion()
void set(const int jin, const int site, const int jex, double v)
double elapsed_sec() const
void general(const char *format,...)
virtual void set_config(Field *)=0
setting pointer to the gauge configuration.
int get_int(const string &key) const
static Parameters * New(const std::string &realm)
void read_file(Field *U, const string &filename)
void set_random(RandomNumbers *rand)
Wilson-type fermion field.
static bool RegisterTest(const std::string &key, const Test_function func)
bool is_set(const string &) const
double get_double(const string &key) const
virtual double flop_count()
returns the flops per site.
virtual void set_parameters(const Parameters &)=0
static int get_num_threads_available()
returns number of threads (works outside of parallel region).
int non_NULL(const std::string v)
void crucial(const char *format,...)
void Register_Parameters(const string &, Parameters *const)
int verify(const double result, const double expected, double eps)
virtual void mult(Field &, const Field &)=0
multiplies fermion operator to a given field (2nd argument)
virtual void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
const std::string test_name
static void read(const std::string ¶ms_file, Parameters *params)
GaugeConfig class for file I/O of gauge configuration.
string get_string(const string &key) const
Test of Mult with Wilson fermion, prepared for beginners.
static VerboseLevel set_verbose_level(const std::string &str)