52 const std::string
test_name =
"FFT.fft_check";
56 const std::string filename_input =
"test_FFT_check.yaml";
62 #ifdef USE_TESTMANAGER_AUTOREGISTER
72 int run_task(unique_ptr<FFT>& fft,
77 double check_precision,
87 Timer time_fft_fw(
"FFT_Forward");
90 fft->fft(res1, src, FFT::FORWARD);
93 Timer time_fft_bw(
"FFT_Backward");
96 fft->fft(res2, res1, FFT::BACKWARD);
106 axpy(res1, -1.0, ref);
112 if (!(diff < check_precision)) ++err;
115 axpy(res2, -1.0, src);
120 if (!(diff < check_precision)) ++err;
122 time_fft_fw.report();
123 time_fft_bw.report();
159 int nex = params_test.
get_int(
"external_dof");
161 string str_vlevel = params_test.
get_string(
"verbose_level");
162 bool do_check = params_test.
is_set(
"expected_result");
163 double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
164 double check_precision = params_test.
is_set(
"check_precision") ? params_test.
get_double(
"check_precision") : 1.0e-8;
180 vout.
general(
vl,
"source data file = %s\n", filename_source.c_str());
181 vout.
general(
vl,
"reference data file = %s\n", filename_reference.c_str());
182 vout.
general(
vl,
"check precision = %8.6e\n", check_precision);
186 unique_ptr<FieldIO> fio;
208 std::ifstream fsrc(filename_source.c_str());
214 fio->read_file(src, filename_source);
219 rng.gauss_lex_global(src);
221 fio->write_file(src, filename_source);
226 std::ifstream fref(filename_reference.c_str());
232 fio->read_file(ref, filename_reference);
236 unique_ptr<FFT> fft(FFT::New(
"auto"));
237 fft->fft(ref, src, FFT::FORWARD);
239 fio->write_file(ref, filename_reference);
248 ((NPEx * NPEy == 1) || (NPEx * NPEz == 1) || (NPEy * NPEz == 1))
252 unique_ptr<FFT> fft(FFT::New(
"FFT_xyz_1dim", params_fft));
254 err += run_task(fft, src, ref, res1, res2, check_precision,
vl);
261 (NPEt == 1) && (NPEx == 1) && (NPEy == 1)
265 unique_ptr<FFT> fft(FFT::New(
"FFT_xyz_3dim", params_fft));
267 err += run_task(fft, src, ref, res1, res2, check_precision,
vl);
273 if (NPEx * NPEy * NPEz == 1)
277 unique_ptr<FFT> fft(FFT::New(
"FFT_3d_local", params_fft));
279 err += run_task(fft, src, ref, res1, res2, check_precision,
vl);
286 if (NPEx * NPEy == 1)
290 unique_ptr<FFT> fft(FFT::New(
"FFT_3d_parallel_1dim", 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");
304 unique_ptr<FFT> fft(FFT::New(
"FFT_3d_parallel_3dim", params_fft));
306 err += run_task(fft, src, ref, res1, res2, check_precision,
vl);
308 vout.
general(
vl,
"FFT_3d_parallel_3dim is not available.\n");
317 unique_ptr<FFT> fft(FFT::New(
"auto", params_fft));
319 err += run_task(fft, src, ref, res1, res2, check_precision,
vl);