diff --git a/ode/unit_test/Test_ODE_RK.hpp b/ode/unit_test/Test_ODE_RK.hpp index 4e38b1d30a..1e851108f3 100644 --- a/ode/unit_test/Test_ODE_RK.hpp +++ b/ode/unit_test/Test_ODE_RK.hpp @@ -144,28 +144,32 @@ void test_method(const std::string label, ode_type& my_ode, EXPECT_EQ(solver_type::order(), order); EXPECT_EQ(solver_type::num_stages(), num_stages); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) std::cout << "\n" << label << std::endl; std::cout << " order: " << solver_type::order() << std::endl; std::cout << " number of stages: " << solver_type::num_stages() << std::endl; +#else + (void)label; #endif for (int stageIdx = 0; stageIdx < solver_type::num_stages(); ++stageIdx) { EXPECT_NEAR_KK(ks(0, stageIdx), kstack_h(0, stageIdx), 1e-8); EXPECT_NEAR_KK(ks(1, stageIdx), kstack_h(1, stageIdx), 1e-8); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) std::cout << " k" << stageIdx << "={" << kstack_h(0, stageIdx) << ", " << kstack_h(1, stageIdx) << "}" << std::endl; #endif } EXPECT_NEAR_KK(sol(0), y_new_h(0), 1e-8); EXPECT_NEAR_KK(sol(1), y_new_h(1), 1e-8); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) std::cout << " y={" << y_new_h(0) << ", " << y_new_h(1) << "}" << std::endl; std::cout << " error={" << Kokkos::abs(y_new_h(0) - y_ref_h(0)) / Kokkos::abs(y_ref_h(0)) << ", " << Kokkos::abs(y_new_h(1) - y_ref_h(1)) / Kokkos::abs(y_ref_h(1)) << "}" << std::endl; +#else + (void)y_ref_h; #endif } // test_method @@ -209,7 +213,7 @@ void test_RK() { Kokkos::parallel_for(my_policy, wrapper); Kokkos::deep_copy(y_ref_h, y_ref); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) std::cout << "\nAnalytical solution" << std::endl; std::cout << " y={" << y_ref_h(0) << ", " << y_ref_h(1) << "}" << std::endl; @@ -336,7 +340,7 @@ void test_rate(ode_type& my_ode, const scalar_type& tstart, Kokkos::deep_copy(y_new_h, y_new); error(idx) = Kokkos::abs(y_new_h(0) - y_ref_h(0)) / Kokkos::abs(y_ref_h(0)); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) scalar_type dt = (tend - tstart) / num_steps(idx); std::cout << "dt=" << dt << ", error=" << error(idx) << ", solution: {" << y_new_h(0) << ", " << y_new_h(1) << "}" << std::endl; @@ -391,7 +395,7 @@ void test_convergence_rate() { Kokkos::parallel_for(my_policy, wrapper); Kokkos::deep_copy(y_ref_h, y_ref); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) std::cout << "\nAnalytical solution" << std::endl; std::cout << " y={" << y_ref_h(0) << ", " << y_ref_h(1) << "}" << std::endl; @@ -409,7 +413,7 @@ void test_convergence_rate() { double actual_ratio = error(idx + 1) / error(idx); EXPECT_NEAR_KK_REL(actual_ratio, expected_ratio, 0.15); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) double rel_ratio_diff = Kokkos::abs(actual_ratio - expected_ratio) / Kokkos::abs(expected_ratio); std::cout << "error ratio: " << actual_ratio @@ -429,7 +433,7 @@ void test_convergence_rate() { double actual_ratio = error(idx + 1) / error(idx); EXPECT_NEAR_KK_REL(actual_ratio, expected_ratio, 0.05); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) double rel_ratio_diff = Kokkos::abs(actual_ratio - expected_ratio) / Kokkos::abs(expected_ratio); std::cout << "error ratio: " << actual_ratio @@ -449,7 +453,7 @@ void test_convergence_rate() { double actual_ratio = error(idx + 1) / error(idx); EXPECT_NEAR_KK_REL(actual_ratio, expected_ratio, 0.05); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) double rel_ratio_diff = Kokkos::abs(actual_ratio - expected_ratio) / Kokkos::abs(expected_ratio); std::cout << "error ratio: " << actual_ratio diff --git a/ode/unit_test/Test_ODE_RK_chem.hpp b/ode/unit_test/Test_ODE_RK_chem.hpp index 8bc9cac6dc..00315cb4ac 100644 --- a/ode/unit_test/Test_ODE_RK_chem.hpp +++ b/ode/unit_test/Test_ODE_RK_chem.hpp @@ -100,7 +100,6 @@ void test_chem() { chem_model_1 chem_model; const int neqs = chem_model.neqs; const int num_steps = 15000; - const double dt = 0.1; KokkosODE::Experimental::ODE_params params(num_steps); vec_type tmp("tmp vector", neqs); @@ -123,7 +122,8 @@ void test_chem() { auto y_new_h = Kokkos::create_mirror(y_new); Kokkos::deep_copy(y_new_h, y_new); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) + const double dt = (chem_model.tend - chem_model.tstart) / params.num_steps; std::cout << "\nChem model 1" << std::endl; std::cout << " t0=" << chem_model.tstart << ", tn=" << chem_model.tend << std::endl; @@ -141,7 +141,6 @@ void test_chem() { chem_model_2 chem_model; const int neqs = chem_model.neqs; const int num_steps = 1500; - const double dt = 1; KokkosODE::Experimental::ODE_params params(num_steps); vec_type tmp("tmp vector", neqs); @@ -169,7 +168,8 @@ void test_chem() { auto y_new_h = Kokkos::create_mirror(y_new); Kokkos::deep_copy(y_new_h, y_new); -#if (KOKKOSKERNELS_DEBUG_LEVEL > 0) +#if defined(HAVE_KOKKOSKERNELS_DEBUG) + const double dt = (chem_model.tend - chem_model.tstart) / params.num_steps; std::cout << "\nChem model 2" << std::endl; std::cout << " t0=" << chem_model.tstart << ", tn=" << chem_model.tend << std::endl;