48 const std::string
test_name =
"FFT.fft_check";
52 const std::string filename_input =
"test_FFT_check.yaml";
58 #ifdef USE_TESTMANAGER_AUTOREGISTER
73 double check_precision,
83 Timer time_fft_fw(
"FFT_Forward");
86 fft->fft(res1, src, FFT::FORWARD);
89 Timer time_fft_bw(
"FFT_Backward");
92 fft->fft(res2, res1, FFT::BACKWARD);
102 axpy(res1, -1.0, ref);
106 vout.
general(vl,
"diff (result - ref) = %24.20e\n", diff);
108 if (!(diff < check_precision)) ++err;
111 axpy(res2, -1.0, src);
114 vout.
general(vl,
"diff (reverse - src) = %24.20e\n", diff);
116 if (!(diff < check_precision)) ++err;
118 time_fft_fw.report();
119 time_fft_bw.report();
155 int nex = params_test.
get_int(
"external_dof");
157 string str_vlevel = params_test.
get_string(
"verbose_level");
158 bool do_check = params_test.
is_set(
"expected_result");
159 double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
160 double check_precision = params_test.
is_set(
"check_precision") ? params_test.
get_double(
"check_precision") : 1.0e-8;
176 vout.
general(vl,
"source data file = %s\n", filename_source.c_str());
177 vout.
general(vl,
"reference data file = %s\n", filename_reference.c_str());
178 vout.
general(vl,
"check precision = %8.6e\n", check_precision);
204 std::ifstream fsrc(filename_source.c_str());
215 rng.gauss_lex_global(src);
222 std::ifstream fref(filename_reference.c_str());
224 vout.
general(vl,
"%s: reference file exists.\n",
test_name.c_str(), filename_reference.c_str());
228 fio->
read_file(&ref, filename_reference);
233 fft->fft(ref, src, FFT::FORWARD);
244 ((NPEx * NPEy == 1) || (NPEx * NPEz == 1) || (NPEy * NPEz == 1))
249 fft->set_parameters(params_fft);
251 err += run_task(fft, src, ref, res1, res2, check_precision, vl);
253 vout.
general(vl,
"FFT_xyz_1dim is not available.\n");
258 (NPEt == 1) && (NPEx == 1) && (NPEy == 1)
263 fft->set_parameters(params_fft);
265 err += run_task(fft, src, ref, res1, res2, check_precision, vl);
267 vout.
general(vl,
"FFT_xyz_3dim is not available.\n");
271 if (NPEx * NPEy * NPEz == 1)
276 fft->set_parameters(params_fft);
278 err += run_task(fft, src, ref, res1, res2, check_precision, vl);
280 vout.
general(vl,
"FFT_3d_local is not available.\n");
285 if (NPEx * NPEy == 1)
290 fft->set_parameters(params_fft);
292 err += run_task(fft, src, ref, res1, res2, check_precision, vl);
294 vout.
general(vl,
"FFT_3d_parallel_1dim is not available.\n");
305 fft->set_parameters(params_fft);
307 err += run_task(fft, src, ref, res1, res2, check_precision, vl);
309 vout.
general(vl,
"FFT_3d_parallel_3dim is not available.\n");
319 fft->set_parameters(params_fft);
321 err += run_task(fft, src, ref, res1, res2, check_precision, vl);
330 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
void detailed(const char *format,...)
void set(const int jin, const int site, const int jex, double v)
void general(const char *format,...)
const std::string test_name
Container of Field-type object.
void reset(pointer p=pointer())
int get_int(const string &key) const
Wilson-type fermion field.
Parameters lookup(const string &key) const
static bool RegisterTest(const std::string &key, const Test_function func)
FieldIO_Binary_Parallel class for file I/O of Field data in binary format using MPI parallel I/O...
double get_double(const string &key) const
std::string generate_filename(const char *fmt,...)
bool is_set(const string &key) const
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
static void read(const std::string ¶ms_file, Parameters ¶ms)
int verify(const double result, const double expected, double eps)
FieldIO_Binary class for file I/O of Field data in binary format.
static int size()
size of small world.
virtual void read_file(Field *v, std::string)=0
read data from file.
virtual void write_file(Field *v, std::string)=0
write data to file.
string get_string(const string &key) const
static VerboseLevel set_verbose_level(const std::string &str)