Skip to content

Commit 8e2b959

Browse files
author
Michael McLeod
committed
Remove debug and add conditional compiling
1 parent 5d64ef4 commit 8e2b959

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

cpp/tests/algo_factory.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ TEST_CASE("fb_factory") {
186186
CHECK(mse <= average_intensity * 1e-3);
187187
}
188188

189+
#ifdef PURIFY_HD5
189190
TEST_CASE("fb_factory_stochastic") {
190191
const std::string &test_dir = "expected/fb/";
191192
const std::string &input_data_path = data_filename(test_dir + "input_data.vis");
@@ -278,7 +279,7 @@ TEST_CASE("fb_factory_stochastic") {
278279

279280
auto const diagnostic = fb();
280281
const Image<t_complex> image = Image<t_complex>::Map(diagnostic.x.data(), imsizey, imsizex);
281-
pfitsio::write2d(image.real(), result_path);
282+
//pfitsio::write2d(image.real(), result_path);
282283
//pfitsio::write2d(residual_image.real(), expected_residual_path);
283284

284285
auto soln_flat = Vector<t_complex>::Map(solution.data(), solution.size());
@@ -291,6 +292,7 @@ TEST_CASE("fb_factory_stochastic") {
291292
SOPT_HIGH_LOG("MSE = {}", mse);
292293
CHECK(mse <= average_intensity * 1e-3);
293294
}
295+
#endif
294296

295297
#ifdef PURIFY_ONNXRT
296298
TEST_CASE("tf_fb_factory") {

cpp/tests/mpi_algo_factory.cc

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,14 @@ TEST_CASE("Serial vs. Serial with MPI Forward Backward") {
372372
CHECK(mse <= average_intensity * 1e-3);
373373
}
374374

375+
#ifdef PURIFY_H5
375376
TEST_CASE("MPI_fb_factory_hdf5") {
376377
auto const world = sopt::mpi::Communicator::World();
377378
const size_t N = 13107;
378379

379380
const std::string &test_dir = "expected/fb/";
380381
const std::string &input_data_path = data_filename(test_dir + "input_data.h5");
381-
const std::string &result_path = data_filename(test_dir + "mpi_fb_result.fits");
382+
const std::string &result_path = data_filename(test_dir + "mpi_fb_result_hdf5.fits");
382383
H5::H5Handler h5file(input_data_path, world);
383384

384385
auto uv_data = H5::stochread_visibility(h5file, 6000, false);
@@ -414,11 +415,10 @@ TEST_CASE("MPI_fb_factory_hdf5") {
414415

415416
auto const diagnostic = (*fb)();
416417
const Image<t_complex> image = Image<t_complex>::Map(diagnostic.x.data(), imsizey, imsizex);
417-
if (world.is_root())
418-
{
419-
pfitsio::write2d(image.real(), result_path);
420-
//pfitsio::write2d(residual_image.real(), expected_residual_path);
421-
}
418+
//if (world.is_root())
419+
//{
420+
// pfitsio::write2d(image.real(), result_path);
421+
//}
422422

423423
const std::string &expected_solution_path = data_filename(test_dir + "solution.fits");
424424
const std::string &expected_residual_path = data_filename(test_dir + "residual.fits");
@@ -436,7 +436,6 @@ TEST_CASE("MPI_fb_factory_hdf5") {
436436
CHECK(mse <= average_intensity * 1e-3);
437437
}
438438

439-
#ifdef PURIFY_H5
440439
TEST_CASE("fb_factory_stochastic") {
441440
const std::string &test_dir = "expected/fb/";
442441
const std::string &input_data_path = data_filename(test_dir + "input_data.h5");
@@ -494,17 +493,10 @@ TEST_CASE("fb_factory_stochastic") {
494493

495494
auto const diagnostic = fb();
496495
const Image<t_complex> image = Image<t_complex>::Map(diagnostic.x.data(), imsizey, imsizex);
497-
SOPT_HIGH_LOG("God help me.");
498-
if (comm.is_root())
499-
{
500-
SOPT_HIGH_LOG("Root write file");
501-
pfitsio::write2d(image.real(), result_path);
502-
//pfitsio::write2d(residual_image.real(), expected_residual_path);
503-
}
504-
else
505-
{
506-
SOPT_HIGH_LOG("Worker has nowt to do.");
507-
}
496+
//if (comm.is_root())
497+
//{
498+
// //pfitsio::write2d(image.real(), result_path);
499+
//}
508500

509501
auto soln_flat = Vector<t_complex>::Map(solution.data(), solution.size());
510502
double average_intensity = soln_flat.real().sum() / soln_flat.size();

0 commit comments

Comments
 (0)