From f7016ef6c42ee0b9c32f06849cdc25394cb4b309 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 29 Mar 2024 07:18:48 -0700 Subject: [PATCH] chore(deps): update dependency catch2 to v3 (#2205) * chore(deps): update dependency catch2 to v3 * replace catch2/catch.hpp with catch_all.hpp * clara namespace revision and delete TU * add iostream include * fixing new catch fails * cleanup non-algo, tests are running * resolve serialization INFO/SECTION issue * consolidate copy_convert to resolve "No tests ran" * final INFO/SECTION resolutions * fixes for kmeans/backend tests * kmeans_init addition * follow-up from merge * accidental merge conflict override --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: ethanglaser --- WORKSPACE | 6 +- .../dal/algo/covariance/test/fixture.hpp | 48 ++++---- cpp/oneapi/dal/algo/dbscan/test/fixture.hpp | 6 +- cpp/oneapi/dal/algo/dbscan/test/spmd.cpp | 8 +- .../dal/algo/decision_forest/test/fixture.hpp | 22 ++-- .../decision_forest/test/serialization.cpp | 2 +- .../dal/algo/jaccard/test/jaccard_test.cpp | 2 +- .../backend/gpu/test/cluster_updater_dpc.cpp | 2 + .../gpu/test/empty_cluster_handling_dpc.cpp | 2 + cpp/oneapi/dal/algo/kmeans/test/fixture.hpp | 48 ++++---- cpp/oneapi/dal/algo/kmeans/test/spmd.cpp | 10 +- .../algo/kmeans/test/spmd_backend_fixture.hpp | 46 ++++---- .../kmeans/test/spmd_backend_template.hpp | 10 +- .../dal/algo/kmeans_init/test/fixture.hpp | 2 +- cpp/oneapi/dal/algo/knn/test/fixture.hpp | 8 +- .../dal/algo/knn/test/serialization.cpp | 8 +- cpp/oneapi/dal/algo/knn/test/spmd.cpp | 4 +- .../dal/algo/linear_kernel/test/batch.cpp | 8 +- .../dal/algo/louvain/test/louvain_test.cpp | 2 + cpp/oneapi/dal/algo/pca/test/batch.cpp | 8 +- cpp/oneapi/dal/algo/pca/test/fixture.hpp | 36 +++--- .../dal/algo/pca/test/serialization.cpp | 2 +- .../dal/algo/polynomial_kernel/test/batch.cpp | 8 +- cpp/oneapi/dal/algo/rbf_kernel/test/batch.cpp | 8 +- .../dal/algo/sigmoid_kernel/test/batch.cpp | 8 +- cpp/oneapi/dal/algo/svm/test/batch.cpp | 32 +++--- .../dal/algo/svm/test/serialization.cpp | 4 +- .../placement/test/argwhere_dpc.cpp | 1 + .../selection/test/kselect_by_rows_dpc.cpp | 6 +- .../backend/primitives/stat/test/cov_dpc.cpp | 12 +- .../dal/backend/primitives/test/fill_dpc.cpp | 7 +- .../dal/graph/test/service_functions_test.cpp | 2 +- cpp/oneapi/dal/table/BUILD | 3 +- ...{copy_convert_gpu.cpp => copy_convert.cpp} | 76 ++++++++++++- .../table/backend/test/copy_convert_cpp.cpp | 103 ------------------ .../backend/test/copy_convert_fixture.hpp | 1 + ...ert_perf_dpc.cpp => copy_convert_perf.cpp} | 70 +++++++++++- .../backend/test/copy_convert_perf_cpp.cpp | 102 ----------------- cpp/oneapi/dal/table/test/heterogen.cpp | 2 + cpp/oneapi/dal/table/test/row_accessor.cpp | 2 + cpp/oneapi/dal/test/array.cpp | 2 + cpp/oneapi/dal/test/communicator.cpp | 1 + cpp/oneapi/dal/test/engine/catch.hpp | 2 +- cpp/oneapi/dal/test/engine/catch_main.cpp | 4 +- .../test/engine/metrics/classification.hpp | 2 +- .../dal/test/engine/metrics/clustering.hpp | 6 +- .../dal/test/engine/metrics/regression.hpp | 2 +- cpp/oneapi/dal/test/engine/serialization.hpp | 14 +-- cpp/oneapi/dal/test/serialization.cpp | 83 +++++++------- 49 files changed, 397 insertions(+), 456 deletions(-) rename cpp/oneapi/dal/table/backend/test/{copy_convert_gpu.cpp => copy_convert.cpp} (62%) delete mode 100644 cpp/oneapi/dal/table/backend/test/copy_convert_cpp.cpp rename cpp/oneapi/dal/table/backend/test/{copy_convert_perf_dpc.cpp => copy_convert_perf.cpp} (61%) delete mode 100644 cpp/oneapi/dal/table/backend/test/copy_convert_perf_cpp.cpp diff --git a/WORKSPACE b/WORKSPACE index 888ba44e002..51c878a29aa 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -108,9 +108,9 @@ onedal_repo( http_archive( name = "catch2", - url = "https://github.com/catchorg/Catch2/archive/v2.13.10.tar.gz", - sha256 = "d54a712b7b1d7708bc7a819a8e6e47b2fde9536f487b89ccbca295072a7d9943", - strip_prefix = "Catch2-2.13.10", + url = "https://github.com/catchorg/Catch2/archive/v3.5.0.tar.gz", + sha256 = "f6d4f8d78a9b59ec72a81d49f58d18eb317372ac07f8d9432710a079e69fd66a", + strip_prefix = "Catch2-3.5.0", ) http_archive( diff --git a/cpp/oneapi/dal/algo/covariance/test/fixture.hpp b/cpp/oneapi/dal/algo/covariance/test/fixture.hpp index f79e481db55..f8a95f42838 100644 --- a/cpp/oneapi/dal/algo/covariance/test/fixture.hpp +++ b/cpp/oneapi/dal/algo/covariance/test/fixture.hpp @@ -78,7 +78,7 @@ class covariance_test : public te::crtp_algo_fixture { void general_checks(const te::dataframe& input, const te::table_id& input_table_id) { const table data = input.get_table(this->get_policy(), input_table_id); - INFO("create descriptor cov cor means") + INFO("create descriptor cov cor means"); auto cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cov_matrix | covariance::result_options::cor_matrix | @@ -87,7 +87,7 @@ class covariance_test : public te::crtp_algo_fixture { auto compute_result = this->compute(cov_desc, data); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cov") + INFO("create descriptor cov"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cov_matrix); @@ -95,7 +95,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->compute(cov_desc, data); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cov biased") + INFO("create descriptor cov biased"); cov_desc = covariance::descriptor() .set_result_options(covariance::result_options::cov_matrix) .set_bias(true); @@ -103,7 +103,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->compute(cov_desc, data); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cor") + INFO("create descriptor cor"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cor_matrix); @@ -111,7 +111,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->compute(cov_desc, data); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor means") + INFO("create descriptor means"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::means); @@ -119,7 +119,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->compute(cov_desc, data); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cov cor") + INFO("create descriptor cov cor"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cov_matrix | covariance::result_options::cor_matrix); @@ -127,7 +127,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->compute(cov_desc, data); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cov means") + INFO("create descriptor cov means"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cov_matrix | covariance::result_options::means); @@ -135,7 +135,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->compute(cov_desc, data); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cor means") + INFO("create descriptor cor means"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cor_matrix | covariance::result_options::means); @@ -148,7 +148,7 @@ class covariance_test : public te::crtp_algo_fixture { const te::table_id& input_table_id, const std::int64_t nBlocks) { const table data = input.get_table(this->get_policy(), input_table_id); - INFO("create descriptor cov cor means") + INFO("create descriptor cov cor means"); auto cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cov_matrix | covariance::result_options::cor_matrix | @@ -162,7 +162,7 @@ class covariance_test : public te::crtp_algo_fixture { auto compute_result = this->finalize_compute(cov_desc, partial_result); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cov") + INFO("create descriptor cov"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cov_matrix); @@ -175,7 +175,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->finalize_compute(cov_desc, partial_result); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cor") + INFO("create descriptor cor"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cor_matrix); @@ -188,7 +188,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->finalize_compute(cov_desc, partial_result); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor means") + INFO("create descriptor means"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::means); @@ -201,7 +201,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->finalize_compute(cov_desc, partial_result); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cov cor") + INFO("create descriptor cov cor"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cov_matrix | covariance::result_options::cor_matrix); @@ -214,7 +214,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->finalize_compute(cov_desc, partial_result); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cov means") + INFO("create descriptor cov means"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cov_matrix | covariance::result_options::means); @@ -227,7 +227,7 @@ class covariance_test : public te::crtp_algo_fixture { compute_result = this->finalize_compute(cov_desc, partial_result); check_compute_result(cov_desc, data, compute_result); - INFO("create descriptor cor means") + INFO("create descriptor cor means"); cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cor_matrix | covariance::result_options::means); @@ -246,32 +246,32 @@ class covariance_test : public te::crtp_algo_fixture { const covariance::compute_result<>& result) { if (result.get_result_options().test(result_options::cov_matrix)) { const auto cov_matrix = result.get_cov_matrix(); - INFO("check if cov matrix table shape is expected") + INFO("check if cov matrix table shape is expected"); REQUIRE(cov_matrix.get_row_count() == data.get_column_count()); REQUIRE(cov_matrix.get_column_count() == data.get_column_count()); - INFO("check if there is no NaN in cov matrix table") + INFO("check if there is no NaN in cov matrix table"); REQUIRE(te::has_no_nans(cov_matrix)); - INFO("check if cov matrix values are expected") + INFO("check if cov matrix values are expected"); check_cov_matrix_values(desc, data, cov_matrix); } if (result.get_result_options().test(result_options::cor_matrix)) { const auto cor_matrix = result.get_cor_matrix(); - INFO("check if cor matrix table shape is expected") + INFO("check if cor matrix table shape is expected"); REQUIRE(cor_matrix.get_row_count() == data.get_column_count()); REQUIRE(cor_matrix.get_column_count() == data.get_column_count()); - INFO("check if there is no NaN in cor matrix table") + INFO("check if there is no NaN in cor matrix table"); REQUIRE(te::has_no_nans(cor_matrix)); - INFO("check if cor matrix values are expected") + INFO("check if cor matrix values are expected"); check_cor_matrix_values(desc, data, cor_matrix); } if (result.get_result_options().test(result_options::means)) { const auto means = result.get_means(); - INFO("check if means table shape is expected") + INFO("check if means table shape is expected"); REQUIRE(means.get_row_count() == 1); REQUIRE(means.get_column_count() == data.get_column_count()); - INFO("check if there is no NaN in means table") + INFO("check if there is no NaN in means table"); REQUIRE(te::has_no_nans(means)); - INFO("check if means values are expected") + INFO("check if means values are expected"); check_means_values(data, means); } } diff --git a/cpp/oneapi/dal/algo/dbscan/test/fixture.hpp b/cpp/oneapi/dal/algo/dbscan/test/fixture.hpp index 6b58731cb88..b2e374bc4f8 100644 --- a/cpp/oneapi/dal/algo/dbscan/test/fixture.hpp +++ b/cpp/oneapi/dal/algo/dbscan/test/fixture.hpp @@ -94,7 +94,7 @@ class dbscan_test : public te::crtp_algo_fixture { const table &ref_responses) { CAPTURE(epsilon, min_observations); - INFO("create descriptor") + INFO("create descriptor"); const auto dbscan_desc = get_descriptor(epsilon, min_observations); INFO("run compute"); @@ -119,7 +119,7 @@ class dbscan_test : public te::crtp_algo_fixture { std::int64_t min_observations, float_t ref_dbi, float_t dbi_ref_tol = 1.0e-4) { - INFO("create descriptor") + INFO("create descriptor"); const auto dbscan_desc = get_descriptor(epsilon, min_observations); INFO("run compute"); @@ -151,7 +151,7 @@ class dbscan_test : public te::crtp_algo_fixture { std::int64_t min_observations) { CAPTURE(epsilon, min_observations); - INFO("create descriptor") + INFO("create descriptor"); const auto dbscan_desc = get_descriptor(epsilon, min_observations).set_result_options(compute_mode); diff --git a/cpp/oneapi/dal/algo/dbscan/test/spmd.cpp b/cpp/oneapi/dal/algo/dbscan/test/spmd.cpp index d2f64bb2dff..2a530d0b0b5 100644 --- a/cpp/oneapi/dal/algo/dbscan/test/spmd.cpp +++ b/cpp/oneapi/dal/algo/dbscan/test/spmd.cpp @@ -107,11 +107,11 @@ class dbscan_spmd_test : public dbscan_test const auto compute_result_batch = oneapi::dal::test::engine::compute(this->get_policy(), dbscan_desc, data); - INFO("check references") + INFO("check references"); this->check_if_close(joined_result.get_core_flags(), compute_result_batch.get_core_flags(), "Cores"); - INFO("check references") + INFO("check references"); this->check_if_close(joined_result.get_responses(), compute_result_batch.get_responses(), "responses"); @@ -133,7 +133,7 @@ class dbscan_spmd_test : public dbscan_test auto joined_result = this->merge_compute_result(compute_results); - INFO("check references") + INFO("check references"); base_t::check_responses_against_ref(joined_result.get_responses(), ref_responses); } void run_spmd_dbi_checks(const table &data, @@ -141,7 +141,7 @@ class dbscan_spmd_test : public dbscan_test std::int64_t min_observations, float_t ref_dbi, float_t dbi_ref_tol = 1.0e-4) { - INFO("create descriptor") + INFO("create descriptor"); const auto dbscan_desc = dbscan::descriptor(epsilon, min_observations) .set_mem_save_mode(true) diff --git a/cpp/oneapi/dal/algo/decision_forest/test/fixture.hpp b/cpp/oneapi/dal/algo/decision_forest/test/fixture.hpp index 4d2ccf17936..f1ac29d0e51 100644 --- a/cpp/oneapi/dal/algo/decision_forest/test/fixture.hpp +++ b/cpp/oneapi/dal/algo/decision_forest/test/fixture.hpp @@ -252,7 +252,7 @@ class df_test : public te::crtp_algo_fixture { const auto infer_result = this->infer(desc, model, x_test); check_infer_shapes(desc, data, infer_result); - INFO("check if infer accuracy is expected") + INFO("check if infer accuracy is expected"); for (auto ch : checker_list) { CAPTURE(desc.get_features_per_node()); CAPTURE(desc.get_max_tree_depth()); @@ -287,14 +287,14 @@ class df_test : public te::crtp_algo_fixture { const df::train_result& result) { constexpr bool is_cls = std::is_same_v; - INFO("check if model shape is expected") + INFO("check if model shape is expected"); REQUIRE(result.get_model().get_tree_count() == desc.get_tree_count()); if constexpr (is_cls) { REQUIRE(result.get_model().get_class_count() == desc.get_class_count()); } if (check_mask_flag(desc.get_error_metric_mode(), error_metric_mode::out_of_bag_error)) { - INFO("check if oob error shape is expected") + INFO("check if oob error shape is expected"); REQUIRE(result.get_oob_err().has_data()); REQUIRE(result.get_oob_err().get_row_count() == 1); REQUIRE(result.get_oob_err().get_column_count() == 1); @@ -302,14 +302,14 @@ class df_test : public te::crtp_algo_fixture { if (check_mask_flag(desc.get_error_metric_mode(), error_metric_mode::out_of_bag_error_per_observation)) { - INFO("check if oob error per observation shape is expected") + INFO("check if oob error per observation shape is expected"); REQUIRE(result.get_oob_err_per_observation().has_data()); REQUIRE(result.get_oob_err_per_observation().get_row_count() == data.get_row_count()); REQUIRE(result.get_oob_err_per_observation().get_column_count() == 1); } if (variable_importance_mode::none != desc.get_variable_importance_mode()) { - INFO("check if variable improtance shape is expected") + INFO("check if variable improtance shape is expected"); REQUIRE(result.get_var_importance().has_data()); REQUIRE(result.get_var_importance().get_row_count() == 1); REQUIRE(result.get_var_importance().get_column_count() == data.get_column_count() - 1); @@ -322,21 +322,21 @@ class df_test : public te::crtp_algo_fixture { constexpr bool is_cls = std::is_same_v; if constexpr (is_cls) { if (check_mask_flag(desc.get_infer_mode(), infer_mode::class_responses)) { - INFO("check if infer responses shape is expected") + INFO("check if infer responses shape is expected"); REQUIRE(result.get_responses().has_data()); REQUIRE(result.get_responses().get_row_count() == data.get_row_count()); REQUIRE(result.get_responses().get_column_count() == 1); } if (check_mask_flag(desc.get_infer_mode(), infer_mode::class_probabilities)) { - INFO("check if infer probabilities shape is expected") + INFO("check if infer probabilities shape is expected"); REQUIRE(result.get_probabilities().has_data()); REQUIRE(result.get_probabilities().get_row_count() == data.get_row_count()); REQUIRE(result.get_probabilities().get_column_count() == desc.get_class_count()); } } else { - INFO("check if infer responses shape is expected") + INFO("check if infer responses shape is expected"); REQUIRE(result.get_responses().has_data()); REQUIRE(result.get_responses().get_row_count() == data.get_row_count()); REQUIRE(result.get_responses().get_column_count() == 1); @@ -349,7 +349,7 @@ class df_test : public te::crtp_algo_fixture { const te::table_id& data_table_id, double accuracy_threshold) { if (variable_importance_mode::none != desc.get_variable_importance_mode()) { - INFO("check if match of variable importance vs required one is expected") + INFO("check if match of variable importance vs required one is expected"); const auto required_var_imp = var_imp_data.get_table(data_table_id); std::int64_t row_ind = 0; switch (desc.get_variable_importance_mode()) { @@ -377,7 +377,7 @@ class df_test : public te::crtp_algo_fixture { double required_oob_error, double accuracy_threshold) { if (check_mask_flag(desc.get_error_metric_mode(), error_metric_mode::out_of_bag_error)) { - INFO("check if match of oob error vs required one is expected") + INFO("check if match of oob error vs required one is expected"); const auto oob_err_val = dal::row_accessor(train_result.get_oob_err()).pull(); if (required_oob_error > 0.0) { @@ -393,7 +393,7 @@ class df_test : public te::crtp_algo_fixture { double accuracy_threshold) { if (check_mask_flag(desc.get_error_metric_mode(), error_metric_mode::out_of_bag_error_per_observation)) { - INFO("check if match of oob error vs cumulative oob error per observation is expected") + INFO("check if match of oob error vs cumulative oob error per observation is expected"); const auto oob_err_val = dal::row_accessor(train_result.get_oob_err()).pull(); const auto oob_err_per_obs_arr = diff --git a/cpp/oneapi/dal/algo/decision_forest/test/serialization.cpp b/cpp/oneapi/dal/algo/decision_forest/test/serialization.cpp index 34639fc2bfc..7e1d176db01 100644 --- a/cpp/oneapi/dal/algo/decision_forest/test/serialization.cpp +++ b/cpp/oneapi/dal/algo/decision_forest/test/serialization.cpp @@ -178,7 +178,7 @@ class df_serialization_test : public te::float_algo_fixture& actual, const infer_result& reference) { - INFO("compare responses") { + SECTION("compare responses") { te::check_if_tables_equal(actual.get_responses(), reference.get_responses()); } } diff --git a/cpp/oneapi/dal/algo/jaccard/test/jaccard_test.cpp b/cpp/oneapi/dal/algo/jaccard/test/jaccard_test.cpp index d1042741b00..0f805757c84 100644 --- a/cpp/oneapi/dal/algo/jaccard/test/jaccard_test.cpp +++ b/cpp/oneapi/dal/algo/jaccard/test/jaccard_test.cpp @@ -211,7 +211,7 @@ class jaccard_test { const auto jaccard_coeffs_data = coeffs.get_data(); int correct_coeff_count = 0; for (std::int64_t i = 0; i < nonzero_coeff_count; i++) { - if (Approx(jaccard_coeffs_data[i]) == correct_jaccard_coeffs[i]) + if (Catch::Approx(jaccard_coeffs_data[i]) == correct_jaccard_coeffs[i]) correct_coeff_count++; } REQUIRE(correct_coeff_count == nonzero_coeff_count); diff --git a/cpp/oneapi/dal/algo/kmeans/backend/gpu/test/cluster_updater_dpc.cpp b/cpp/oneapi/dal/algo/kmeans/backend/gpu/test/cluster_updater_dpc.cpp index eda2ce38e76..06aa7856de7 100644 --- a/cpp/oneapi/dal/algo/kmeans/backend/gpu/test/cluster_updater_dpc.cpp +++ b/cpp/oneapi/dal/algo/kmeans/backend/gpu/test/cluster_updater_dpc.cpp @@ -14,6 +14,8 @@ * limitations under the License. *******************************************************************************/ +#include + #include "oneapi/dal/table/homogen.hpp" #include "oneapi/dal/table/row_accessor.hpp" #include "oneapi/dal/test/engine/fixtures.hpp" diff --git a/cpp/oneapi/dal/algo/kmeans/backend/gpu/test/empty_cluster_handling_dpc.cpp b/cpp/oneapi/dal/algo/kmeans/backend/gpu/test/empty_cluster_handling_dpc.cpp index 026fe813a35..646629196a0 100644 --- a/cpp/oneapi/dal/algo/kmeans/backend/gpu/test/empty_cluster_handling_dpc.cpp +++ b/cpp/oneapi/dal/algo/kmeans/backend/gpu/test/empty_cluster_handling_dpc.cpp @@ -14,6 +14,8 @@ * limitations under the License. *******************************************************************************/ +#include + #include "oneapi/dal/table/homogen.hpp" #include "oneapi/dal/table/row_accessor.hpp" #include "oneapi/dal/test/engine/fixtures.hpp" diff --git a/cpp/oneapi/dal/algo/kmeans/test/fixture.hpp b/cpp/oneapi/dal/algo/kmeans/test/fixture.hpp index 1fdf3cc00e1..e4b5125d618 100644 --- a/cpp/oneapi/dal/algo/kmeans/test/fixture.hpp +++ b/cpp/oneapi/dal/algo/kmeans/test/fixture.hpp @@ -80,7 +80,7 @@ class kmeans_test : public te::crtp_algo_fixture { bool test_convergence = false) { CAPTURE(cluster_count); - INFO("create descriptor") + INFO("create descriptor"); const auto kmeans_desc = get_descriptor(cluster_count, max_iteration_count, accuracy_threshold); @@ -109,7 +109,7 @@ class kmeans_test : public te::crtp_algo_fixture { bool test_convergence = false) { CAPTURE(cluster_count); - INFO("create descriptor") + INFO("create descriptor"); const auto kmeans_desc = get_descriptor(cluster_count, max_iteration_count, accuracy_threshold); @@ -148,7 +148,7 @@ class kmeans_test : public te::crtp_algo_fixture { const std::int64_t max_iteration_count = 100; const float_t accuracy_threshold = 0.0; - INFO("create descriptor") + INFO("create descriptor"); const auto kmeans_desc = get_descriptor(cluster_count, max_iteration_count, accuracy_threshold); @@ -163,7 +163,7 @@ class kmeans_test : public te::crtp_algo_fixture { expected_centroids.get_column_count(), match_map); - INFO("check if centroids close to gold") { + SECTION("check if centroids close to gold") { const double rel_tol = 1e-7; check_centroid_match_with_rel_tol(match_map, rel_tol, expected_centroids, centroids); } @@ -172,11 +172,11 @@ class kmeans_test : public te::crtp_algo_fixture { const auto infer_result = this->infer(kmeans_desc, model, data); const auto responses = infer_result.get_responses(); - INFO("check if responses are expected") { + SECTION("check if responses are expected") { check_response_match(match_map, expected_responses, responses); } - INFO("check if objective function value is expected") { + SECTION("check if objective function value is expected") { const double objective = train_result.get_objective_function_value(); const double expected_objective = gold_dataset::get_expected_objective(); CAPTURE(objective, expected_objective); @@ -365,7 +365,7 @@ class kmeans_test : public te::crtp_algo_fixture { float_t dbi_ref_tol = 1.0e-4) { CAPTURE(cluster_count); - INFO("create descriptor") + INFO("create descriptor"); const auto kmeans_desc = get_descriptor(cluster_count, max_iteration_count, accuracy_threshold); @@ -402,7 +402,7 @@ class kmeans_test : public te::crtp_algo_fixture { float_t dbi_ref_tol = 1.0e-4) { CAPTURE(cluster_count); - INFO("create descriptor") + INFO("create descriptor"); const auto kmeans_desc = get_descriptor(cluster_count, max_iteration_count, accuracy_threshold); @@ -453,7 +453,7 @@ class kmeans_test : public te::crtp_algo_fixture { float_t dbi_ref_tol = 1.0e-4) { CAPTURE(cluster_count); - INFO("create descriptor") + INFO("create descriptor"); const auto kmeans_desc = get_descriptor(cluster_count, max_iteration_count, accuracy_threshold); @@ -484,7 +484,7 @@ class kmeans_test : public te::crtp_algo_fixture { float_t accuracy_threshold) { CAPTURE(cluster_count); - INFO("create descriptor") + INFO("create descriptor"); const auto kmeans_desc = get_descriptor(cluster_count, max_iteration_count, accuracy_threshold); @@ -500,7 +500,7 @@ class kmeans_test : public te::crtp_algo_fixture { float_t ref_objective_function = -1.0) { CAPTURE(model.get_cluster_count()); - INFO("create descriptor") + INFO("create descriptor"); const auto kmeans_desc = get_descriptor(model.get_cluster_count()); INFO("run inference"); @@ -561,7 +561,7 @@ class kmeans_test : public te::crtp_algo_fixture { check_nans(result); - INFO("check if non-negative objective function value is expected") + INFO("check if non-negative objective function value is expected"); REQUIRE(objective_function >= 0.0); float_t rel_tol = 1.0e-5; @@ -592,11 +592,11 @@ class kmeans_test : public te::crtp_algo_fixture { } void check_centroid_match_with_rel_tol(float_t rel_tol, const table& left, const table& right) { - INFO("check if centroid shape is expected") + INFO("check if centroid shape is expected"); REQUIRE(left.get_row_count() == right.get_row_count()); REQUIRE(left.get_column_count() == right.get_column_count()); - INFO("check if centroid match is expected") + INFO("check if centroid match is expected"); const auto left_rows = row_accessor(left).pull(); const auto right_rows = row_accessor(right).pull(); const float_t alpha = std::numeric_limits::min(); @@ -617,11 +617,11 @@ class kmeans_test : public te::crtp_algo_fixture { float_t rel_tol, const table& left, const table& right) { - INFO("check if centroid shape is expected") + INFO("check if centroid shape is expected"); REQUIRE(left.get_row_count() == right.get_row_count()); REQUIRE(left.get_column_count() == right.get_column_count()); - INFO("check if centroid match is expected") + INFO("check if centroid match is expected"); const auto left_rows = row_accessor(left).pull(); const auto right_rows = row_accessor(right).pull(); const float_t alpha = std::numeric_limits::min(); @@ -687,11 +687,11 @@ class kmeans_test : public te::crtp_algo_fixture { } void check_response_match(const table& left, const table& right) { - INFO("check if response shape is expected") + INFO("check if response shape is expected"); REQUIRE(left.get_row_count() == right.get_row_count()); REQUIRE(left.get_column_count() == right.get_column_count()); REQUIRE(left.get_column_count() == 1); - INFO("check if response match is expected") + INFO("check if response match is expected"); const auto left_rows = row_accessor(left).pull({ 0, -1 }); const auto right_rows = row_accessor(right).pull({ 0, -1 }); for (std::int64_t i = 0; i < left_rows.get_count(); i++) { @@ -707,12 +707,12 @@ class kmeans_test : public te::crtp_algo_fixture { void check_response_match(const array& match_map, const table& left, const table& right) { - INFO("check if response shape is expected") + INFO("check if response shape is expected"); REQUIRE(left.get_row_count() == right.get_row_count()); REQUIRE(left.get_column_count() == right.get_column_count()); REQUIRE(left.get_column_count() == 1); - INFO("check if response match is expected") + INFO("check if response match is expected"); const auto left_rows = row_accessor(left).pull({ 0, -1 }); const auto right_rows = row_accessor(right).pull({ 0, -1 }); for (std::int64_t i = 0; i < left_rows.get_count(); i++) { @@ -728,20 +728,20 @@ class kmeans_test : public te::crtp_algo_fixture { void check_nans(const train_result_t& result) { const auto [centroids, responses, iteration_count] = unpack_result(result); - INFO("check if there is no NaN in centroids") + INFO("check if there is no NaN in centroids"); REQUIRE(te::has_no_nans(centroids)); - INFO("check if there is no NaN in responses") + INFO("check if there is no NaN in responses"); REQUIRE(te::has_no_nans(responses)); } void check_nans(const infer_result_t& result) { const auto [responses, objective_function] = unpack_result(result); - INFO("check if there is no NaN in objective function values") + INFO("check if there is no NaN in objective function values"); REQUIRE(te::has_no_nans(homogen_table::wrap(&objective_function, 1, 1))); - INFO("check if there is no NaN in responses") + INFO("check if there is no NaN in responses"); REQUIRE(te::has_no_nans(responses)); } diff --git a/cpp/oneapi/dal/algo/kmeans/test/spmd.cpp b/cpp/oneapi/dal/algo/kmeans/test/spmd.cpp index 2c7e3d34063..df15e3238cb 100644 --- a/cpp/oneapi/dal/algo/kmeans/test/spmd.cpp +++ b/cpp/oneapi/dal/algo/kmeans/test/spmd.cpp @@ -88,7 +88,7 @@ class kmeans_spmd_test : public kmeans_test const std::int64_t max_iteration_count = 100; const float_t accuracy_threshold = 0.0; - INFO("create descriptor") + INFO("create descriptor"); const auto kmeans_desc = this->get_descriptor(cluster_count, max_iteration_count, accuracy_threshold); @@ -96,7 +96,7 @@ class kmeans_spmd_test : public kmeans_test const auto train_results = this->train_via_spmd_threads(rank_count_, kmeans_desc, data, initial_centroids); - INFO("check if all results bitwise equal on all ranks") { + SECTION("check if all results bitwise equal on all ranks") { ONEDAL_ASSERT(train_results.size() > 0); const auto front_centroids = train_results.front().get_model().get_centroids(); const auto front_iteration_count = train_results.front().get_iteration_count(); @@ -106,16 +106,16 @@ class kmeans_spmd_test : public kmeans_test // We do not check responses as they are expected // to be different on each ranks - INFO("check centroids") { + SECTION("check centroids") { const auto centroids = result.get_model().get_centroids(); te::check_if_tables_equal(centroids, front_centroids); } - INFO("check iterations") { + SECTION("check iterations") { REQUIRE(result.get_iteration_count() == front_iteration_count); } - INFO("check objective function") { + SECTION("check objective function") { REQUIRE(result.get_objective_function_value() == front_objective); } } diff --git a/cpp/oneapi/dal/algo/kmeans/test/spmd_backend_fixture.hpp b/cpp/oneapi/dal/algo/kmeans/test/spmd_backend_fixture.hpp index 4cb493281d8..0e188777556 100644 --- a/cpp/oneapi/dal/algo/kmeans/test/spmd_backend_fixture.hpp +++ b/cpp/oneapi/dal/algo/kmeans/test/spmd_backend_fixture.hpp @@ -82,7 +82,7 @@ class kmeans_spmd_backend_fixture : public te::crtp_spmd_backend_algo_fixtureinfer(kmeans_desc, model, data); const auto responses = infer_result.get_responses(); - INFO("check if responses are expected") { + SECTION("check if responses are expected") { check_response_match(match_map, expected_responses, responses); } - INFO("check if objective function value is expected") { + SECTION("check if objective function value is expected") { const double objective = train_result.get_objective_function_value(); const double expected_objective = gold_dataset::get_expected_objective(); CAPTURE(objective, expected_objective); @@ -322,7 +322,7 @@ class kmeans_spmd_backend_fixture : public te::crtp_spmd_backend_algo_fixture= 0.0); float_t rel_tol = 1.0e-5; @@ -499,11 +499,11 @@ class kmeans_spmd_backend_fixture : public te::crtp_spmd_backend_algo_fixture(left).pull(); const auto right_rows = row_accessor(right).pull(); const float_t alpha = std::numeric_limits::min(); @@ -524,11 +524,11 @@ class kmeans_spmd_backend_fixture : public te::crtp_spmd_backend_algo_fixture(left).pull(); const auto right_rows = row_accessor(right).pull(); const float_t alpha = std::numeric_limits::min(); @@ -594,11 +594,11 @@ class kmeans_spmd_backend_fixture : public te::crtp_spmd_backend_algo_fixture(left).pull({ 0, -1 }); const auto right_rows = row_accessor(right).pull({ 0, -1 }); for (std::int64_t i = 0; i < left_rows.get_count(); i++) { @@ -614,12 +614,12 @@ class kmeans_spmd_backend_fixture : public te::crtp_spmd_backend_algo_fixture& match_map, const table& left, const table& right) { - INFO("check if response shape is expected") + INFO("check if response shape is expected"); REQUIRE(left.get_row_count() == right.get_row_count()); REQUIRE(left.get_column_count() == right.get_column_count()); REQUIRE(left.get_column_count() == 1); - INFO("check if response match is expected") + INFO("check if response match is expected"); const auto left_rows = row_accessor(left).pull({ 0, -1 }); const auto right_rows = row_accessor(right).pull({ 0, -1 }); for (std::int64_t i = 0; i < left_rows.get_count(); i++) { @@ -635,20 +635,20 @@ class kmeans_spmd_backend_fixture : public te::crtp_spmd_backend_algo_fixtureget_descriptor(cluster_count, max_iteration_count, accuracy_threshold); INFO("run training"); const auto result = this->train_in_parallel(kmeans_desc, data, initial_centroids); - INFO("check if all results bitwise equal on all ranks") { - INFO("check centroids") { + SECTION("check if all results bitwise equal on all ranks") { + SECTION("check centroids") { auto comm = this->get_comm(); const auto centroids = result.get_model().get_centroids(); const std::int64_t cluster_count = centroids.get_row_count(); @@ -160,7 +160,7 @@ class kmeans_spmd_backend_test } } - INFO("check iterations") { + SECTION("check iterations") { auto comm = this->get_comm(); std::int64_t min_value = result.get_iteration_count(); comm.allreduce(min_value, dal::preview::spmd::reduce_op::min); @@ -169,7 +169,7 @@ class kmeans_spmd_backend_test REQUIRE(min_value == max_value); } - INFO("check objective function") { + SECTION("check objective function") { auto comm = this->get_comm(); float_t min_value = result.get_objective_function_value(); comm.allreduce(min_value, dal::preview::spmd::reduce_op::min); diff --git a/cpp/oneapi/dal/algo/kmeans_init/test/fixture.hpp b/cpp/oneapi/dal/algo/kmeans_init/test/fixture.hpp index 6ae42f01a4b..c3a628c57ae 100644 --- a/cpp/oneapi/dal/algo/kmeans_init/test/fixture.hpp +++ b/cpp/oneapi/dal/algo/kmeans_init/test/fixture.hpp @@ -46,7 +46,7 @@ class kmeans_init_test : public te::crtp_algo_fixture { void dense_checks(std::int64_t cluster_count, const table& data) { CAPTURE(cluster_count); - INFO("create descriptor") + INFO("create descriptor"); const auto desc = get_descriptor(cluster_count); INFO("compute"); diff --git a/cpp/oneapi/dal/algo/knn/test/fixture.hpp b/cpp/oneapi/dal/algo/knn/test/fixture.hpp index 7fa0c36db30..9f5f60ac6e3 100644 --- a/cpp/oneapi/dal/algo/knn/test/fixture.hpp +++ b/cpp/oneapi/dal/algo/knn/test/fixture.hpp @@ -96,7 +96,7 @@ class knn_test : public te::crtp_algo_fixture { const Distance distance = Distance{}, const voting_t voting = default_voting, const float_t tolerance = float_t(1.e-5)) { - INFO("check if data shape is expected") + INFO("check if data shape is expected"); REQUIRE(train_data.get_column_count() == infer_data.get_column_count()); REQUIRE(train_responses.get_column_count() == 1); REQUIRE(infer_responses.get_column_count() == 1); @@ -124,7 +124,7 @@ class knn_test : public te::crtp_algo_fixture { const std::int64_t n_neighbors, const Distance distance = Distance{}, const voting_t voting = default_voting) { - INFO("check if data shape is expected") + INFO("check if data shape is expected"); REQUIRE(train_data.get_column_count() == infer_data.get_column_count()); REQUIRE(train_responses.get_column_count() == 1); REQUIRE(infer_responses.get_column_count() == 1); @@ -155,7 +155,7 @@ class knn_test : public te::crtp_algo_fixture { const auto gtruth = naive_knn_search(train_data, infer_data); - INFO("check if data shape is expected") + INFO("check if data shape is expected"); REQUIRE(train_data.get_column_count() == infer_data.get_column_count()); REQUIRE(infer_data.get_row_count() == responses.get_row_count()); REQUIRE(responses.get_column_count() == 1); @@ -239,7 +239,7 @@ class knn_test : public te::crtp_algo_fixture { void check_nans(const knn::infer_result& result) { const auto [responses] = unpack_result(result); - INFO("check if there is no NaN in responses") + INFO("check if there is no NaN in responses"); REQUIRE(te::has_no_nans(responses)); } diff --git a/cpp/oneapi/dal/algo/knn/test/serialization.cpp b/cpp/oneapi/dal/algo/knn/test/serialization.cpp index 5fc99e4fc37..1451f62e7b8 100644 --- a/cpp/oneapi/dal/algo/knn/test/serialization.cpp +++ b/cpp/oneapi/dal/algo/knn/test/serialization.cpp @@ -172,23 +172,23 @@ class knn_serialization_test : public te::float_algo_fixture& actual, const infer_result& reference) { if constexpr (is_classification) { - INFO("compare responses") { + SECTION("compare responses") { te::check_if_tables_equal(actual.get_responses(), reference.get_responses()); } } if constexpr (is_regression) { - INFO("compare responses") { + SECTION("compare responses") { check_if_tables_close(actual.get_responses(), reference.get_responses()); } } if constexpr (is_search) { - INFO("compare indices") { + SECTION("compare indices") { te::check_if_tables_equal(actual.get_indices(), reference.get_indices()); } - INFO("compare distances") { + SECTION("compare distances") { te::check_if_tables_equal(actual.get_distances(), reference.get_distances()); } diff --git a/cpp/oneapi/dal/algo/knn/test/spmd.cpp b/cpp/oneapi/dal/algo/knn/test/spmd.cpp index e6e6344993a..59097eb2ebe 100644 --- a/cpp/oneapi/dal/algo/knn/test/spmd.cpp +++ b/cpp/oneapi/dal/algo/knn/test/spmd.cpp @@ -131,7 +131,7 @@ class knn_spmd_test : public knn_test> { const Distance distance = Distance{}, const voting_t voting = default_voting, const float_t tolerance = float_t(1.e-5)) { - INFO("check if data shape is expected") + INFO("check if data shape is expected"); REQUIRE(train_data.get_column_count() == infer_data.get_column_count()); REQUIRE(train_responses.get_column_count() == 1); REQUIRE(infer_responses.get_column_count() == 1); @@ -158,7 +158,7 @@ class knn_spmd_test : public knn_test> { const std::int64_t n_neighbors, const Distance distance = Distance{}, const voting_t voting = default_voting) { - INFO("check if data shape is expected") + INFO("check if data shape is expected"); REQUIRE(train_data.get_column_count() == infer_data.get_column_count()); REQUIRE(train_responses.get_column_count() == 1); REQUIRE(infer_responses.get_column_count() == 1); diff --git a/cpp/oneapi/dal/algo/linear_kernel/test/batch.cpp b/cpp/oneapi/dal/algo/linear_kernel/test/batch.cpp index bea9aa69501..e385dcb8bcb 100644 --- a/cpp/oneapi/dal/algo/linear_kernel/test/batch.cpp +++ b/cpp/oneapi/dal/algo/linear_kernel/test/batch.cpp @@ -45,7 +45,7 @@ class linear_kernel_batch_test : public te::float_algo_fixtureget_policy(), x_data_table_id); const table y = y_data.get_table(this->get_policy(), y_data_table_id); - INFO("create descriptor") + INFO("create descriptor"); const auto linear_kernel_desc = get_descriptor(scale, shift); INFO("run compute"); @@ -60,14 +60,14 @@ class linear_kernel_batch_test : public te::float_algo_fixture& result) { const auto result_values = result.get_values(); - INFO("check if result values table shape is expected") + INFO("check if result values table shape is expected"); REQUIRE(result_values.get_row_count() == x_data.get_row_count()); REQUIRE(result_values.get_column_count() == y_data.get_row_count()); - INFO("check if there is no NaN in result values table") + INFO("check if there is no NaN in result values table"); REQUIRE(te::has_no_nans(result_values)); - INFO("check if result values are expected") + INFO("check if result values are expected"); check_result_values(scale, shift, x_data, y_data, result_values); } diff --git a/cpp/oneapi/dal/algo/louvain/test/louvain_test.cpp b/cpp/oneapi/dal/algo/louvain/test/louvain_test.cpp index 5230d5f6c89..1cdbcce123c 100644 --- a/cpp/oneapi/dal/algo/louvain/test/louvain_test.cpp +++ b/cpp/oneapi/dal/algo/louvain/test/louvain_test.cpp @@ -25,6 +25,8 @@ namespace oneapi::dal::algo::louvain::test { namespace dal = oneapi::dal; +using namespace Catch; + class graph_base_data { protected: graph_base_data() = default; diff --git a/cpp/oneapi/dal/algo/pca/test/batch.cpp b/cpp/oneapi/dal/algo/pca/test/batch.cpp index 85f04144e89..a7792f34d1a 100644 --- a/cpp/oneapi/dal/algo/pca/test/batch.cpp +++ b/cpp/oneapi/dal/algo/pca/test/batch.cpp @@ -63,12 +63,12 @@ TEMPLATE_LIST_TEST_M(pca_batch_test, const auto eigenvalues = pca_result.get_eigenvalues(); const auto eigenvectors = pca_result.get_eigenvectors(); - INFO("check eigenvalues") { + SECTION("check eigenvalues") { const auto gold_eigenvalues = this->get_gold_eigenvalues(); this->check_eigenvalues(gold_eigenvalues, eigenvalues); } - INFO("check eigenvectors") { + SECTION("check eigenvectors") { const auto gold_eigenvectors = this->get_gold_eigenvectors(); this->check_eigenvectors(gold_eigenvectors, eigenvectors); } @@ -105,12 +105,12 @@ TEMPLATE_LIST_TEST_M(pca_batch_test, const auto eigenvectors = pca_result.get_eigenvectors(); - INFO("check eigenvalues") { + SECTION("check eigenvalues") { const auto gold_eigenvalues = this->get_gold_eigenvalues(); this->check_eigenvalues(gold_eigenvalues, eigenvalues); } - INFO("check eigenvectors") { + SECTION("check eigenvectors") { const auto gold_eigenvectors = this->get_gold_eigenvectors(); this->check_eigenvectors(gold_eigenvectors, eigenvectors); } diff --git a/cpp/oneapi/dal/algo/pca/test/fixture.hpp b/cpp/oneapi/dal/algo/pca/test/fixture.hpp index 242932bc61d..76602f79a91 100644 --- a/cpp/oneapi/dal/algo/pca/test/fixture.hpp +++ b/cpp/oneapi/dal/algo/pca/test/fixture.hpp @@ -137,7 +137,7 @@ class pca_test : public te::crtp_algo_fixture { CAPTURE(component_count); const table x = data.get_table(this->get_policy(), data_table_id); - INFO("create descriptor") + INFO("create descriptor"); const auto pca_desc = get_descriptor(component_count); INFO("run training"); const auto train_result = this->train(pca_desc, x); @@ -156,7 +156,7 @@ class pca_test : public te::crtp_algo_fixture { const table x = data.get_table(this->get_policy(), data_table_id); - INFO("create descriptor") + INFO("create descriptor"); const auto pca_desc = get_descriptor(component_count); INFO("run training"); auto partial_result = dal::pca::partial_train_result(); @@ -181,18 +181,18 @@ class pca_test : public te::crtp_algo_fixture { check_shapes(desc, data, result); check_nans(result); - INFO("check if eigenvectors order is descending") + INFO("check if eigenvectors order is descending"); check_eigenvalues_order(eigenvalues); - INFO("check if eigenvectors matrix is orthogonal") + INFO("check if eigenvectors matrix is orthogonal"); check_eigenvectors_orthogonality(eigenvectors); const auto bs = te::compute_basic_statistics(data); - INFO("check if means are expected") + INFO("check if means are expected"); check_means(bs, means); - INFO("check if variances are expected") + INFO("check if variances are expected"); check_variances(bs, variances); } @@ -204,10 +204,10 @@ class pca_test : public te::crtp_algo_fixture { check_online_shapes(desc, data, result); check_nans(result); - INFO("check if eigenvectors order is descending") + INFO("check if eigenvectors order is descending"); check_eigenvalues_order(eigenvalues); - INFO("check if eigenvectors matrix is orthogonal") + INFO("check if eigenvectors matrix is orthogonal"); check_eigenvectors_orthogonality(eigenvectors); } @@ -223,11 +223,11 @@ class pca_test : public te::crtp_algo_fixture { const std::int64_t expected_component_count = (desc.get_component_count() > 0) ? desc.get_component_count() : data.get_column_count(); - INFO("check if eigenvalues shape is expected") + INFO("check if eigenvalues shape is expected"); REQUIRE(eigenvalues.get_row_count() == 1); REQUIRE(eigenvalues.get_column_count() == expected_component_count); - INFO("check if eigenvectors shape is expected") + INFO("check if eigenvectors shape is expected"); REQUIRE(eigenvectors.get_row_count() == expected_component_count); REQUIRE(eigenvectors.get_column_count() == data.get_column_count()); } @@ -240,19 +240,19 @@ class pca_test : public te::crtp_algo_fixture { const std::int64_t expected_component_count = (desc.get_component_count() > 0) ? desc.get_component_count() : data.get_column_count(); - INFO("check if eigenvalues shape is expected") + INFO("check if eigenvalues shape is expected"); REQUIRE(eigenvalues.get_row_count() == 1); REQUIRE(eigenvalues.get_column_count() == expected_component_count); - INFO("check if eigenvectors shape is expected") + INFO("check if eigenvectors shape is expected"); REQUIRE(eigenvectors.get_row_count() == expected_component_count); REQUIRE(eigenvectors.get_column_count() == data.get_column_count()); - INFO("check if means shape is expected") + INFO("check if means shape is expected"); REQUIRE(means.get_row_count() == 1); REQUIRE(means.get_column_count() == data.get_column_count()); - INFO("check if variances shape is expected") + INFO("check if variances shape is expected"); REQUIRE(variances.get_row_count() == 1); REQUIRE(variances.get_column_count() == data.get_column_count()); } @@ -260,16 +260,16 @@ class pca_test : public te::crtp_algo_fixture { void check_nans(const pca::train_result<>& result) { const auto [means, variances, eigenvalues, eigenvectors] = unpack_result(result); - INFO("check if there is no NaN in eigenvalues") + INFO("check if there is no NaN in eigenvalues"); REQUIRE(te::has_no_nans(eigenvalues)); - INFO("check if there is no NaN in eigenvectors") + INFO("check if there is no NaN in eigenvectors"); REQUIRE(te::has_no_nans(eigenvectors)); - INFO("check if there is no NaN in means") + INFO("check if there is no NaN in means"); REQUIRE(te::has_no_nans(means)); - INFO("check if there is no NaN in variances") + INFO("check if there is no NaN in variances"); REQUIRE(te::has_no_nans(variances)); } diff --git a/cpp/oneapi/dal/algo/pca/test/serialization.cpp b/cpp/oneapi/dal/algo/pca/test/serialization.cpp index 50c29e03e3d..75b89f80ea9 100644 --- a/cpp/oneapi/dal/algo/pca/test/serialization.cpp +++ b/cpp/oneapi/dal/algo/pca/test/serialization.cpp @@ -66,7 +66,7 @@ class pca_serialization_test : public te::float_algo_fixture& actual, const infer_result& reference) { - INFO("compare responses") { + SECTION("compare responses") { te::check_if_tables_equal(actual.get_transformed_data(), reference.get_transformed_data()); } diff --git a/cpp/oneapi/dal/algo/polynomial_kernel/test/batch.cpp b/cpp/oneapi/dal/algo/polynomial_kernel/test/batch.cpp index b23501c425d..c3eeaf1ed80 100644 --- a/cpp/oneapi/dal/algo/polynomial_kernel/test/batch.cpp +++ b/cpp/oneapi/dal/algo/polynomial_kernel/test/batch.cpp @@ -55,7 +55,7 @@ class polynomial_kernel_batch_test const table x = x_data.get_table(this->get_policy(), x_data_table_id); const table y = y_data.get_table(this->get_policy(), y_data_table_id); - INFO("create descriptor") + INFO("create descriptor"); const auto polynomial_kernel_desc = get_descriptor(scale, shift, degree); INFO("run compute"); @@ -71,14 +71,14 @@ class polynomial_kernel_batch_test const polynomial_kernel::compute_result<>& result) { const auto result_values = result.get_values(); - INFO("check if result values table shape is expected") + INFO("check if result values table shape is expected"); REQUIRE(result_values.get_row_count() == x_data.get_row_count()); REQUIRE(result_values.get_column_count() == y_data.get_row_count()); - INFO("check if there is no NaN in result values table") + INFO("check if there is no NaN in result values table"); REQUIRE(te::has_no_nans(result_values)); - INFO("check if result values are expected") + INFO("check if result values are expected"); check_result_values(scale, shift, degree, x_data, y_data, result_values); } diff --git a/cpp/oneapi/dal/algo/rbf_kernel/test/batch.cpp b/cpp/oneapi/dal/algo/rbf_kernel/test/batch.cpp index 7b4935314ea..34dfdb488c2 100644 --- a/cpp/oneapi/dal/algo/rbf_kernel/test/batch.cpp +++ b/cpp/oneapi/dal/algo/rbf_kernel/test/batch.cpp @@ -43,7 +43,7 @@ class rbf_kernel_batch_test : public te::float_algo_fixtureget_policy(), x_data_table_id); const table y = y_data.get_table(this->get_policy(), y_data_table_id); - INFO("create descriptor") + INFO("create descriptor"); const auto rbf_kernel_desc = get_descriptor(sigma); INFO("run compute"); @@ -57,14 +57,14 @@ class rbf_kernel_batch_test : public te::float_algo_fixture& result) { const auto result_values = result.get_values(); - INFO("check if result values table shape is expected") + INFO("check if result values table shape is expected"); REQUIRE(result_values.get_row_count() == x_data.get_row_count()); REQUIRE(result_values.get_column_count() == y_data.get_row_count()); - INFO("check if there is no NaN in result values table") + INFO("check if there is no NaN in result values table"); REQUIRE(te::has_no_nans(result_values)); - INFO("check if result values are expected") + INFO("check if result values are expected"); check_result_values(sigma, x_data, y_data, result_values); } diff --git a/cpp/oneapi/dal/algo/sigmoid_kernel/test/batch.cpp b/cpp/oneapi/dal/algo/sigmoid_kernel/test/batch.cpp index ea2daf64e9d..7e03d51eb64 100644 --- a/cpp/oneapi/dal/algo/sigmoid_kernel/test/batch.cpp +++ b/cpp/oneapi/dal/algo/sigmoid_kernel/test/batch.cpp @@ -49,7 +49,7 @@ class sigmoid_kernel_batch_test : public te::float_algo_fixtureget_policy(), x_data_table_id); const table y = y_data.get_table(this->get_policy(), y_data_table_id); - INFO("create descriptor") + INFO("create descriptor"); const auto sigmoid_kernel_desc = get_descriptor(scale, shift); INFO("run compute"); @@ -64,14 +64,14 @@ class sigmoid_kernel_batch_test : public te::float_algo_fixture& result) { const auto result_values = result.get_values(); - INFO("check if result values table shape is expected") + INFO("check if result values table shape is expected"); REQUIRE(result_values.get_row_count() == x_data.get_row_count()); REQUIRE(result_values.get_column_count() == y_data.get_row_count()); - INFO("check if there is no NaN in result values table") + INFO("check if there is no NaN in result values table"); REQUIRE(te::has_no_nans(result_values)); - INFO("check if result values are expected") + INFO("check if result values are expected"); check_result_values(scale, shift, x_data, y_data, result_values); } diff --git a/cpp/oneapi/dal/algo/svm/test/batch.cpp b/cpp/oneapi/dal/algo/svm/test/batch.cpp index 4168c5061ca..a02988881ed 100644 --- a/cpp/oneapi/dal/algo/svm/test/batch.cpp +++ b/cpp/oneapi/dal/algo/svm/test/batch.cpp @@ -99,7 +99,7 @@ class svm_batch_test : public te::float_algo_fixtureinfer(desc, model, test_data); const auto decision_function = infer_result.get_decision_function(); - INFO("check if decision fuction is expected") + INFO("check if decision fuction is expected"); check_table_match(expected_decision_function, decision_function); } @@ -135,7 +135,7 @@ class svm_batch_test : public te::float_algo_fixture& result) { const auto [support_vectors, support_indices, coeffs] = unpack_result(result); - INFO("check if there is no NaN in support_vectors") + INFO("check if there is no NaN in support_vectors"); REQUIRE(te::has_no_nans(support_vectors)); - INFO("check if there is no NaN in support_indices") + INFO("check if there is no NaN in support_indices"); REQUIRE(te::has_no_nans(support_indices)); - INFO("check if there is no NaN in coeffs") + INFO("check if there is no NaN in coeffs"); REQUIRE(te::has_no_nans(coeffs)); } void check_shapes(const table& infer_data, const svm::infer_result<>& result) { const auto [responses, decision_function] = unpack_result(result); - INFO("check if responses shape is expected") + INFO("check if responses shape is expected"); REQUIRE(responses.get_row_count() == infer_data.get_row_count()); REQUIRE(responses.get_column_count() == 1); - INFO("check if decision_function shape is expected") + INFO("check if decision_function shape is expected"); REQUIRE(decision_function.get_row_count() == infer_data.get_row_count()); REQUIRE(decision_function.get_column_count() == 1); } @@ -210,10 +210,10 @@ class svm_batch_test : public te::float_algo_fixture& result) { const auto [responses, decision_function] = unpack_result(result); - INFO("check if there is no NaN in responses") + INFO("check if there is no NaN in responses"); REQUIRE(te::has_no_nans(responses)); - INFO("check if there is no NaN in decision_function") + INFO("check if there is no NaN in decision_function"); REQUIRE(te::has_no_nans(decision_function)); } diff --git a/cpp/oneapi/dal/algo/svm/test/serialization.cpp b/cpp/oneapi/dal/algo/svm/test/serialization.cpp index a64fb307644..c22e8833519 100644 --- a/cpp/oneapi/dal/algo/svm/test/serialization.cpp +++ b/cpp/oneapi/dal/algo/svm/test/serialization.cpp @@ -173,12 +173,12 @@ class svm_serialization_test : public te::float_algo_fixture& actual, const infer_result& reference) { - INFO("compare responses") { + SECTION("compare responses") { te::check_if_tables_equal(actual.get_responses(), reference.get_responses()); } if constexpr (std::is_same_v) { - INFO("compare decision function") { + SECTION("compare decision function") { // TODO: We observe run-to-run instabilities in SVM inference, so we compare // decision function with some tolerance. This should be replaced by // exact comparison once instability is gone. diff --git a/cpp/oneapi/dal/backend/primitives/placement/test/argwhere_dpc.cpp b/cpp/oneapi/dal/backend/primitives/placement/test/argwhere_dpc.cpp index 43b4a131bf1..ff3a2a0a6e1 100644 --- a/cpp/oneapi/dal/backend/primitives/placement/test/argwhere_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/placement/test/argwhere_dpc.cpp @@ -15,6 +15,7 @@ *******************************************************************************/ #include +#include #include "oneapi/dal/test/engine/common.hpp" #include "oneapi/dal/test/engine/fixtures.hpp" diff --git a/cpp/oneapi/dal/backend/primitives/selection/test/kselect_by_rows_dpc.cpp b/cpp/oneapi/dal/backend/primitives/selection/test/kselect_by_rows_dpc.cpp index 813e7389ef2..8729e20db60 100644 --- a/cpp/oneapi/dal/backend/primitives/selection/test/kselect_by_rows_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/selection/test/kselect_by_rows_dpc.cpp @@ -43,14 +43,14 @@ class selection_by_rows_test : public te::policy_fixture { std::int64_t row_count, std::int64_t col_count, std::int64_t k) { - INFO("Output of selected values") { + SECTION("Output of selected values") { ndarray dummy_array; auto value_array = ndarray::empty(get_queue(), { row_count, k }); kselect_by_rows sel(get_queue(), data.get_shape(), k); sel(get_queue(), data, k, value_array).wait_and_throw(); check_results(data, value_array, dummy_array); } - INFO("Output of selected indices") { + SECTION("Output of selected indices") { ndarray dummy_array; auto index_array = ndarray::empty(get_queue(), { row_count, k }); kselect_by_rows sel(get_queue(), data.get_shape(), k); @@ -58,7 +58,7 @@ class selection_by_rows_test : public te::policy_fixture { check_results(data, dummy_array, index_array); } - INFO("Output of both") { + SECTION("Output of both") { auto value_array = ndarray::empty(get_queue(), { row_count, k }); auto index_array = ndarray::empty(get_queue(), { row_count, k }); kselect_by_rows sel(get_queue(), data.get_shape(), k); diff --git a/cpp/oneapi/dal/backend/primitives/stat/test/cov_dpc.cpp b/cpp/oneapi/dal/backend/primitives/stat/test/cov_dpc.cpp index fb26e14145c..67aeeb2e2d6 100644 --- a/cpp/oneapi/dal/backend/primitives/stat/test/cov_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/stat/test/cov_dpc.cpp @@ -188,21 +188,21 @@ class cov_test : public te::float_algo_fixture { const auto [gold_corr, gold_means, gold_vars] = get_gold_result(); const double eps = te::get_tolerance(1e-4, 1e-7); - INFO("compare correlation matrix with gold") { + SECTION("compare correlation matrix with gold") { const auto corr_mat = la::matrix::wrap_nd(corr.to_host(this->get_queue())); const auto gold_corr_mat = la::matrix::wrap_nd(gold_corr); REQUIRE(la::equal_approx(corr_mat, gold_corr_mat, eps).all()); } - INFO("compare means with gold") { + SECTION("compare means with gold") { const auto means_mat = la::matrix::wrap_nd(means.to_host(this->get_queue())); const auto gold_means_mat = la::matrix::wrap_nd(gold_means); REQUIRE(la::equal_approx(means_mat, gold_means_mat, eps).all()); } - INFO("compare vars with gold") { + SECTION("compare vars with gold") { const auto vars_mat = la::matrix::wrap_nd(vars.to_host(this->get_queue())); const auto gold_vars_mat = la::matrix::wrap_nd(gold_vars); @@ -262,19 +262,19 @@ TEMPLATE_TEST_M(cov_test, "correlation on diagonal data", "[cor]", float, double // variances for each feature can be computed trivially using `diag_element` // value. - INFO("check if correlation matrix for diagonal matrix") { + SECTION("check if correlation matrix for diagonal matrix") { const double n = row_count; const double off_diag_element = -1.0 / (n - 1.0); this->check_correlation_for_diagonal_matrix(corr, off_diag_element); } - INFO("check if mean is expected") { + SECTION("check if mean is expected") { const double n = row_count; const double expected_mean = double(diag_element) / n; this->check_constant_mean(means, n, expected_mean); } - INFO("check if variance is expected") { + SECTION("check if variance is expected") { const double n = row_count; const double d = double(diag_element) * double(diag_element); ONEDAL_ASSERT(n > 1); diff --git a/cpp/oneapi/dal/backend/primitives/test/fill_dpc.cpp b/cpp/oneapi/dal/backend/primitives/test/fill_dpc.cpp index 8b915d08699..18a33079b3c 100644 --- a/cpp/oneapi/dal/backend/primitives/test/fill_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/test/fill_dpc.cpp @@ -30,11 +30,10 @@ TEST("fill device USM and copy to host", "[usm]") { std::vector data_host_vec(element_count); float* data_host = data_host_vec.data(); - INFO("copy to host") { - q.memcpy(data_host, data, sizeof(float) * element_count).wait_and_throw(); - } + INFO("copy to host"); + q.memcpy(data_host, data, sizeof(float) * element_count).wait_and_throw(); - INFO("check filler on host") { + SECTION("check filler on host") { for (std::int64_t i = 0; i < element_count; i++) { const float x = data_host[i]; CAPTURE(i); diff --git a/cpp/oneapi/dal/graph/test/service_functions_test.cpp b/cpp/oneapi/dal/graph/test/service_functions_test.cpp index 810a46a9a96..2c5843eff88 100644 --- a/cpp/oneapi/dal/graph/test/service_functions_test.cpp +++ b/cpp/oneapi/dal/graph/test/service_functions_test.cpp @@ -365,7 +365,7 @@ class service_functions_test { std::int64_t correct_value_count = 0; for (std::int64_t i = 0; i < vertex_count; i++) { for (std::int64_t j = graph_data.rows[i]; j < graph_data.rows[i + 1]; ++j) { - if (Approx(dal::preview::get_edge_value(g, i, graph_data.cols[j])) == + if (Catch::Approx(dal::preview::get_edge_value(g, i, graph_data.cols[j])) == graph_data.edge_weights_double[j]) correct_value_count++; } diff --git a/cpp/oneapi/dal/table/BUILD b/cpp/oneapi/dal/table/BUILD index 60692b736a5..42153b3042a 100755 --- a/cpp/oneapi/dal/table/BUILD +++ b/cpp/oneapi/dal/table/BUILD @@ -28,8 +28,7 @@ dal_test_suite( "detail/test/csr_utils.cpp", "detail/test/homogen_utils.cpp", "detail/test/metadata_utils.cpp", - "backend/test/copy_convert_cpp.cpp", - "backend/test/copy_convert_gpu.cpp", + "backend/test/copy_convert.cpp", ], dal_deps = [":table"], framework = "catch2", diff --git a/cpp/oneapi/dal/table/backend/test/copy_convert_gpu.cpp b/cpp/oneapi/dal/table/backend/test/copy_convert.cpp similarity index 62% rename from cpp/oneapi/dal/table/backend/test/copy_convert_gpu.cpp rename to cpp/oneapi/dal/table/backend/test/copy_convert.cpp index b0b6fb476a6..b804efedf6c 100644 --- a/cpp/oneapi/dal/table/backend/test/copy_convert_gpu.cpp +++ b/cpp/oneapi/dal/table/backend/test/copy_convert.cpp @@ -30,6 +30,60 @@ #include "oneapi/dal/table/backend/test/copy_convert_fixture.hpp" namespace oneapi::dal::backend::primitives::test { +template +class copy_convert_cpu_test : public copy_convert_fixture { +public: + using result_t = std::tuple_element_t<0, Param>; + using sources_t = std::tuple_element_t<1, Param>; + + constexpr static inline const sources_t* dummy_ptr = nullptr; + constexpr static inline auto data_types = make_types_array(dummy_ptr); + constexpr static inline std::int64_t col_size = get_col_size(dummy_ptr); + constexpr static inline std::int64_t row_count = std::tuple_size_v; + constexpr static inline auto result_type = detail::make_data_type(); + + void test_copy_convert_rm() { + auto policy = this->get_host_policy(); + + const auto res_count = this->col_count * row_count; + const auto res_size = res_count * sizeof(result_t); + auto result = dal::array::empty(res_size); + dal::array types = this->get_types_array(); + + copy_convert(policy, + types, + this->inp, + { row_count, this->col_count }, + result_type, + result, + { this->col_count, 1l }); + + auto* res_ptr = reinterpret_cast(result.get_data()); + dal::array temp(result, res_ptr, res_count); + this->compare_with_groundtruth_rm(temp); + } + + void test_copy_convert_cm() { + auto policy = detail::host_policy::get_default(); + + const auto res_count = this->col_count * row_count; + const auto res_size = res_count * sizeof(result_t); + auto result = dal::array::empty(res_size); + dal::array types = this->get_types_array(); + + copy_convert(policy, + types, + this->inp, + { row_count, this->col_count }, + result_type, + result, + { 1l, row_count }); + + const auto* res_ptr = reinterpret_cast(result.get_data()); + dal::array temp(result, res_ptr, res_count); + this->compare_with_groundtruth_cm(temp); + } +}; #ifdef ONEDAL_DATA_PARALLEL @@ -101,9 +155,27 @@ class copy_convert_dpc_test : public copy_convert_fixture { this->compare_with_groundtruth_cm(res_host); } }; +#endif + +TEMPLATE_LIST_TEST_M(copy_convert_cpu_test, + "Deterministic random array - RM", + "[convert][2d][small]", + convert_types) { + this->generate(); + this->test_copy_convert_rm(); +} + +TEMPLATE_LIST_TEST_M(copy_convert_cpu_test, + "Deterministic random array - CM", + "[convert][2d][small]", + convert_types) { + this->generate(); + this->test_copy_convert_cm(); +} +#ifdef ONEDAL_DATA_PARALLEL TEMPLATE_LIST_TEST_M(copy_convert_dpc_test, - "Determenistic random array - RM", + "Deterministic random array - RM", "[convert][2d][small]", convert_types) { this->generate(); @@ -111,7 +183,7 @@ TEMPLATE_LIST_TEST_M(copy_convert_dpc_test, } TEMPLATE_LIST_TEST_M(copy_convert_dpc_test, - "Determenistic random array - CM", + "Deterministic random array - CM", "[convert][2d][small]", convert_types) { this->generate(); diff --git a/cpp/oneapi/dal/table/backend/test/copy_convert_cpp.cpp b/cpp/oneapi/dal/table/backend/test/copy_convert_cpp.cpp deleted file mode 100644 index 88d235bc4a5..00000000000 --- a/cpp/oneapi/dal/table/backend/test/copy_convert_cpp.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* -* Copyright 2023 Intel Corporation -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*******************************************************************************/ - -#include -#include -#include - -#include "oneapi/dal/test/engine/common.hpp" -#include "oneapi/dal/test/engine/fixtures.hpp" -#include "oneapi/dal/test/engine/dataframe.hpp" - -#include "oneapi/dal/backend/dispatcher.hpp" - -#include "oneapi/dal/table/backend/convert/copy_convert.hpp" -#include "oneapi/dal/table/backend/test/copy_convert_fixture.hpp" - -namespace oneapi::dal::backend::primitives::test { - -template -class copy_convert_cpu_test : public copy_convert_fixture { -public: - using result_t = std::tuple_element_t<0, Param>; - using sources_t = std::tuple_element_t<1, Param>; - - constexpr static inline const sources_t* dummy_ptr = nullptr; - constexpr static inline auto data_types = make_types_array(dummy_ptr); - constexpr static inline std::int64_t col_size = get_col_size(dummy_ptr); - constexpr static inline std::int64_t row_count = std::tuple_size_v; - constexpr static inline auto result_type = detail::make_data_type(); - - void test_copy_convert_rm() { - auto policy = this->get_host_policy(); - - const auto res_count = this->col_count * row_count; - const auto res_size = res_count * sizeof(result_t); - auto result = dal::array::empty(res_size); - dal::array types = this->get_types_array(); - - copy_convert(policy, - types, - this->inp, - { row_count, this->col_count }, - result_type, - result, - { this->col_count, 1l }); - - auto* res_ptr = reinterpret_cast(result.get_data()); - dal::array temp(result, res_ptr, res_count); - this->compare_with_groundtruth_rm(temp); - } - - void test_copy_convert_cm() { - auto policy = detail::host_policy::get_default(); - - const auto res_count = this->col_count * row_count; - const auto res_size = res_count * sizeof(result_t); - auto result = dal::array::empty(res_size); - dal::array types = this->get_types_array(); - - copy_convert(policy, - types, - this->inp, - { row_count, this->col_count }, - result_type, - result, - { 1l, row_count }); - - const auto* res_ptr = reinterpret_cast(result.get_data()); - dal::array temp(result, res_ptr, res_count); - this->compare_with_groundtruth_cm(temp); - } -}; - -TEMPLATE_LIST_TEST_M(copy_convert_cpu_test, - "Determenistic random array - RM", - "[convert][2d][small]", - convert_types) { - this->generate(); - this->test_copy_convert_rm(); -} - -TEMPLATE_LIST_TEST_M(copy_convert_cpu_test, - "Determenistic random array - CM", - "[convert][2d][small]", - convert_types) { - this->generate(); - this->test_copy_convert_cm(); -} - -} // namespace oneapi::dal::backend::primitives::test diff --git a/cpp/oneapi/dal/table/backend/test/copy_convert_fixture.hpp b/cpp/oneapi/dal/table/backend/test/copy_convert_fixture.hpp index 71e9adad20f..decfa036b6c 100644 --- a/cpp/oneapi/dal/table/backend/test/copy_convert_fixture.hpp +++ b/cpp/oneapi/dal/table/backend/test/copy_convert_fixture.hpp @@ -16,6 +16,7 @@ #include #include +#include #include #include "oneapi/dal/test/engine/common.hpp" diff --git a/cpp/oneapi/dal/table/backend/test/copy_convert_perf_dpc.cpp b/cpp/oneapi/dal/table/backend/test/copy_convert_perf.cpp similarity index 61% rename from cpp/oneapi/dal/table/backend/test/copy_convert_perf_dpc.cpp rename to cpp/oneapi/dal/table/backend/test/copy_convert_perf.cpp index 29e648e9abe..fecddda8f9c 100644 --- a/cpp/oneapi/dal/table/backend/test/copy_convert_perf_dpc.cpp +++ b/cpp/oneapi/dal/table/backend/test/copy_convert_perf.cpp @@ -35,6 +35,63 @@ namespace oneapi::dal::backend::primitives::test { +template +class copy_convert_cpu_test : public copy_convert_fixture { +public: + using result_t = std::tuple_element_t<0, Param>; + using sources_t = std::tuple_element_t<1, Param>; + + constexpr static inline const sources_t* dummy_ptr = nullptr; + constexpr static inline auto data_types = make_types_array(dummy_ptr); + constexpr static inline std::int64_t col_size = get_col_size(dummy_ptr); + constexpr static inline std::int64_t row_count = std::tuple_size_v; + constexpr static inline auto result_type = detail::make_data_type(); + + void generate() { + this->col_count = GENERATE(100'000'001); + CAPTURE(this->col_count, row_count); + this->generate_input(); + } + + void test_copy_convert_rm() { + auto policy = this->get_host_policy(); + + const auto res_count = this->col_count * row_count; + const auto res_size = res_count * sizeof(result_t); + auto result = dal::array::empty(res_size); + dal::array types = this->get_types_array(); + + BENCHMARK(__PRETTY_FUNCTION__) { + copy_convert(policy, + types, + this->inp, + { row_count, this->col_count }, + result_type, + result, + { this->col_count, 1l }); + }; + } + + void test_copy_convert_cm() { + auto policy = this->get_host_policy(); + + const auto res_count = this->col_count * row_count; + const auto res_size = res_count * sizeof(result_t); + auto result = dal::array::empty(res_size); + dal::array types = this->get_types_array(); + + BENCHMARK(__PRETTY_FUNCTION__) { + copy_convert(policy, + types, + this->inp, + { row_count, this->col_count }, + result_type, + result, + { 1l, row_count }); + }; + } +}; + #ifdef ONEDAL_DATA_PARALLEL template @@ -97,9 +154,20 @@ class copy_convert_dpc_test : public copy_convert_fixture { }; } }; +#endif + +TEMPLATE_LIST_TEST_M(copy_convert_cpu_test, + "Deterministic random array", + "[convert][2d][small]", + convert_types) { + this->generate(); + this->test_copy_convert_rm(); + this->test_copy_convert_cm(); +} +#ifdef ONEDAL_DATA_PARALLEL TEMPLATE_LIST_TEST_M(copy_convert_dpc_test, - "Determenistic random array", + "Deterministic random array", "[convert][2d][small]", convert_types) { this->generate(); diff --git a/cpp/oneapi/dal/table/backend/test/copy_convert_perf_cpp.cpp b/cpp/oneapi/dal/table/backend/test/copy_convert_perf_cpp.cpp deleted file mode 100644 index 52256bb4360..00000000000 --- a/cpp/oneapi/dal/table/backend/test/copy_convert_perf_cpp.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* -* Copyright 2023 Intel Corporation -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*******************************************************************************/ - -#include -#include -#include - -#include "oneapi/dal/test/engine/common.hpp" -#include "oneapi/dal/test/engine/fixtures.hpp" -#include "oneapi/dal/test/engine/dataframe.hpp" - -#include "oneapi/dal/backend/dispatcher.hpp" - -#include "oneapi/dal/table/backend/convert/copy_convert.hpp" -#include "oneapi/dal/table/backend/test/copy_convert_fixture.hpp" - -#ifdef _MSC_VER -#define PRETTY_FUNCTION __FUNCSIG__ -#endif // _MSC_VER - -namespace oneapi::dal::backend::primitives::test { - -template -class copy_convert_cpu_test : public copy_convert_fixture { -public: - using result_t = std::tuple_element_t<0, Param>; - using sources_t = std::tuple_element_t<1, Param>; - - constexpr static inline const sources_t* dummy_ptr = nullptr; - constexpr static inline auto data_types = make_types_array(dummy_ptr); - constexpr static inline std::int64_t col_size = get_col_size(dummy_ptr); - constexpr static inline std::int64_t row_count = std::tuple_size_v; - constexpr static inline auto result_type = detail::make_data_type(); - - void generate() { - this->col_count = GENERATE(100'000'001); - CAPTURE(this->col_count, row_count); - this->generate_input(); - } - - void test_copy_convert_rm() { - auto policy = this->get_host_policy(); - - const auto res_count = this->col_count * row_count; - const auto res_size = res_count * sizeof(result_t); - auto result = dal::array::empty(res_size); - dal::array types = this->get_types_array(); - - BENCHMARK(__PRETTY_FUNCTION__) { - copy_convert(policy, - types, - this->inp, - { row_count, this->col_count }, - result_type, - result, - { this->col_count, 1l }); - }; - } - - void test_copy_convert_cm() { - auto policy = this->get_host_policy(); - - const auto res_count = this->col_count * row_count; - const auto res_size = res_count * sizeof(result_t); - auto result = dal::array::empty(res_size); - dal::array types = this->get_types_array(); - - BENCHMARK(__PRETTY_FUNCTION__) { - copy_convert(policy, - types, - this->inp, - { row_count, this->col_count }, - result_type, - result, - { 1l, row_count }); - }; - } -}; - -TEMPLATE_LIST_TEST_M(copy_convert_cpu_test, - "Determenistic random array", - "[convert][2d][small]", - convert_types) { - this->generate(); - this->test_copy_convert_rm(); - this->test_copy_convert_cm(); -} - -} // namespace oneapi::dal::backend::primitives::test diff --git a/cpp/oneapi/dal/table/test/heterogen.cpp b/cpp/oneapi/dal/table/test/heterogen.cpp index 73370b69cb5..1d69c36dcfa 100644 --- a/cpp/oneapi/dal/table/test/heterogen.cpp +++ b/cpp/oneapi/dal/table/test/heterogen.cpp @@ -14,6 +14,8 @@ * limitations under the License. *******************************************************************************/ +#include + #include "oneapi/dal/array.hpp" #include "oneapi/dal/chunked_array.hpp" diff --git a/cpp/oneapi/dal/table/test/row_accessor.cpp b/cpp/oneapi/dal/table/test/row_accessor.cpp index 6455b97f80a..61d71509a64 100644 --- a/cpp/oneapi/dal/table/test/row_accessor.cpp +++ b/cpp/oneapi/dal/table/test/row_accessor.cpp @@ -20,6 +20,8 @@ #include "oneapi/dal/test/engine/common.hpp" #include "oneapi/dal/test/engine/linalg.hpp" +using namespace Catch; + namespace oneapi::dal { namespace te = dal::test::engine; diff --git a/cpp/oneapi/dal/test/array.cpp b/cpp/oneapi/dal/test/array.cpp index 188e958117c..27f153a5aef 100644 --- a/cpp/oneapi/dal/test/array.cpp +++ b/cpp/oneapi/dal/test/array.cpp @@ -17,6 +17,8 @@ #include "oneapi/dal/array.hpp" #include "oneapi/dal/test/engine/common.hpp" +using namespace Catch; + namespace oneapi::dal::test { TEST("can construct empty array") { diff --git a/cpp/oneapi/dal/test/communicator.cpp b/cpp/oneapi/dal/test/communicator.cpp index 4e3e05fed4d..39a9cc0a682 100644 --- a/cpp/oneapi/dal/test/communicator.cpp +++ b/cpp/oneapi/dal/test/communicator.cpp @@ -15,6 +15,7 @@ *******************************************************************************/ #include +#include #include "oneapi/dal/spmd/detail/communicator_utils.hpp" #include "oneapi/dal/detail/communicator.hpp" #include "oneapi/dal/test/engine/fixtures.hpp" diff --git a/cpp/oneapi/dal/test/engine/catch.hpp b/cpp/oneapi/dal/test/engine/catch.hpp index 035ec2fd112..87b8c1a98f7 100644 --- a/cpp/oneapi/dal/test/engine/catch.hpp +++ b/cpp/oneapi/dal/test/engine/catch.hpp @@ -31,4 +31,4 @@ // It is easier to debug exception via GDB if there is handler. #define CATCH_CONFIG_DISABLE_EXCEPTIONS -#include +#include diff --git a/cpp/oneapi/dal/test/engine/catch_main.cpp b/cpp/oneapi/dal/test/engine/catch_main.cpp index 074d9575835..5d25f52f9bd 100644 --- a/cpp/oneapi/dal/test/engine/catch_main.cpp +++ b/cpp/oneapi/dal/test/engine/catch_main.cpp @@ -17,16 +17,16 @@ #include #include #include +#include #include -#define CATCH_CONFIG_RUNNER #include "oneapi/dal/test/engine/catch.hpp" #include "oneapi/dal/test/engine/config.hpp" inline constexpr int default_benchmark_run_count = 5; int main(int argc, char** argv) { - using namespace Catch::clara; + using namespace Catch::Clara; using oneapi::dal::test::engine::global_config; global_config config; diff --git a/cpp/oneapi/dal/test/engine/metrics/classification.hpp b/cpp/oneapi/dal/test/engine/metrics/classification.hpp index d9c5cfa65c0..784d99c3e54 100644 --- a/cpp/oneapi/dal/test/engine/metrics/classification.hpp +++ b/cpp/oneapi/dal/test/engine/metrics/classification.hpp @@ -28,7 +28,7 @@ template inline auto accuracy_score(const table& groundtruth, const table& prediction, const Float tolerance = Float(0)) { - INFO("check if label shape is expected to be equal") + INFO("check if label shape is expected to be equal"); REQUIRE(prediction.get_row_count() == groundtruth.get_row_count()); REQUIRE(prediction.get_column_count() == groundtruth.get_column_count()); diff --git a/cpp/oneapi/dal/test/engine/metrics/clustering.hpp b/cpp/oneapi/dal/test/engine/metrics/clustering.hpp index cca431f71eb..68a05683ad4 100644 --- a/cpp/oneapi/dal/test/engine/metrics/clustering.hpp +++ b/cpp/oneapi/dal/test/engine/metrics/clustering.hpp @@ -27,7 +27,7 @@ namespace oneapi::dal::test::engine { template Float davies_bouldin_index(const table& data, const table& centroids, const table& assignments) { - INFO("check if data shape is expected to be consistent") + INFO("check if data shape is expected to be consistent"); REQUIRE(data.get_row_count() == assignments.get_row_count()); REQUIRE(data.get_column_count() == centroids.get_column_count()); REQUIRE(assignments.get_column_count() == 1); @@ -93,7 +93,7 @@ Float davies_bouldin_index(const table& data, const table& centroids, const tabl //this function works as sklearn.metrics.davies_bouldin_score template Float davies_bouldin_index(const table& data, const table& assignments) { - INFO("check if data shape is expected to be consistent") + INFO("check if data shape is expected to be consistent"); REQUIRE(data.get_row_count() == assignments.get_row_count()); REQUIRE(assignments.get_column_count() == 1); @@ -178,7 +178,7 @@ Float davies_bouldin_index(const table& data, const table& assignments) { template table centers_of_mass(const table& data, const table& assignments, std::int64_t cluster_count) { - INFO("check if data shape is expected to be consistent") + INFO("check if data shape is expected to be consistent"); REQUIRE(data.get_row_count() == assignments.get_row_count()); REQUIRE(assignments.get_column_count() == 1); diff --git a/cpp/oneapi/dal/test/engine/metrics/regression.hpp b/cpp/oneapi/dal/test/engine/metrics/regression.hpp index 03ba9cdaf31..6d5bbb67647 100644 --- a/cpp/oneapi/dal/test/engine/metrics/regression.hpp +++ b/cpp/oneapi/dal/test/engine/metrics/regression.hpp @@ -26,7 +26,7 @@ namespace oneapi::dal::test::engine { template inline auto mse_score(const table& groundtruth, const table& prediction) { - INFO("check if response shape is expected to be equal") + INFO("check if response shape is expected to be equal"); REQUIRE(prediction.get_row_count() == groundtruth.get_row_count()); REQUIRE(prediction.get_column_count() == groundtruth.get_column_count()); diff --git a/cpp/oneapi/dal/test/engine/serialization.hpp b/cpp/oneapi/dal/test/engine/serialization.hpp index a9892d41502..1a0e853c895 100644 --- a/cpp/oneapi/dal/test/engine/serialization.hpp +++ b/cpp/oneapi/dal/test/engine/serialization.hpp @@ -177,15 +177,13 @@ template void serialize_deserialize(const T& original, U& deserialized) { mock_archive_state state; - INFO("serialize") { - mock_output_archive ar(state); - detail::serialize(original, ar); - } + INFO("serialize"); + mock_output_archive input_ar(state); + detail::serialize(original, input_ar); - INFO("deserialize") { - mock_input_archive ar(state); - detail::deserialize(deserialized, ar); - } + INFO("deserialize"); + mock_input_archive output_ar(state); + detail::deserialize(deserialized, output_ar); } template diff --git a/cpp/oneapi/dal/test/serialization.cpp b/cpp/oneapi/dal/test/serialization.cpp index c1cc151d9b9..97de07e2140 100644 --- a/cpp/oneapi/dal/test/serialization.cpp +++ b/cpp/oneapi/dal/test/serialization.cpp @@ -43,16 +43,15 @@ TEST("mock primitive type") { te::mock_archive_state state; - INFO("serialize") { - te::mock_output_archive ar(state); - detail::serialize(original, ar); + INFO("serialize"); + te::mock_output_archive ar(state); + detail::serialize(original, ar); - REQUIRE(ar.prologue_call_count == 1); - REQUIRE(ar.epilogue_call_count == 1); - REQUIRE(state.get(0) == original); - } + REQUIRE(ar.prologue_call_count == 1); + REQUIRE(ar.epilogue_call_count == 1); + REQUIRE(state.get(0) == original); - INFO("deserialize") { + SECTION("deserialize") { float deserialized; te::mock_input_archive ar(state); detail::deserialize(deserialized, ar); @@ -70,16 +69,15 @@ TEST("mock enum") { te::mock_archive_state state; - INFO("serialize") { - te::mock_output_archive ar(state); - detail::serialize(original, ar); + INFO("serialize"); + te::mock_output_archive ar(state); + detail::serialize(original, ar); - REQUIRE(ar.prologue_call_count == 1); - REQUIRE(ar.epilogue_call_count == 1); - REQUIRE(state.get(0) == original); - } + REQUIRE(ar.prologue_call_count == 1); + REQUIRE(ar.epilogue_call_count == 1); + REQUIRE(state.get(0) == original); - INFO("deserialize") { + SECTION("deserialize") { my_enum deserialized; te::mock_input_archive ar(state); detail::deserialize(deserialized, ar); @@ -101,19 +99,18 @@ TEST("mock POD type") { te::mock_archive_state state; - INFO("serialize") { - te::mock_output_archive ar(state); - detail::serialize(original, ar); + INFO("serialize"); + te::mock_output_archive ar(state); + detail::serialize(original, ar); - REQUIRE(state.get(0) == original.x1); - REQUIRE(state.get(1) == original.x2); - REQUIRE(state.get(2) == original.x3); - REQUIRE(state.get(3) == original.x4); - REQUIRE(state.get(4) == original.x5); - REQUIRE(state.get(5) == original.x6); - } + REQUIRE(state.get(0) == original.x1); + REQUIRE(state.get(1) == original.x2); + REQUIRE(state.get(2) == original.x3); + REQUIRE(state.get(3) == original.x4); + REQUIRE(state.get(4) == original.x5); + REQUIRE(state.get(5) == original.x6); - INFO("deserialize") { + SECTION("deserialize") { pod_type deserialized; te::mock_input_archive ar(state); detail::deserialize(deserialized, ar); @@ -170,18 +167,17 @@ TEST("mock non-trivially copyable type") { te::mock_archive_state state; - INFO("serialize") { - te::mock_output_archive ar(state); - detail::serialize(original, ar); + INFO("serialize"); + te::mock_output_archive ar(state); + detail::serialize(original, ar); - REQUIRE(state.get(0) == element_count); - for (std::int64_t i = 1; i < element_count + 1; i++) { - CAPTURE(i); - REQUIRE(state.get(i) == original.vec[i - 1]); - } + REQUIRE(state.get(0) == element_count); + for (std::int64_t i = 1; i < element_count + 1; i++) { + CAPTURE(i); + REQUIRE(state.get(i) == original.vec[i - 1]); } - INFO("deserialize") { + SECTION("deserialize") { vector_type deserialized; te::mock_input_archive ar(state); detail::deserialize(deserialized, ar); @@ -344,15 +340,14 @@ TEST("mock polymorphic type") { te::mock_archive_state state; - INFO("serialize") { - te::mock_output_archive ar(state); - detail::serialize(original, ar); + INFO("serialize"); + te::mock_output_archive ar(state); + detail::serialize(original, ar); - REQUIRE(state.get(0) == 1); - REQUIRE(state.get(1) == polymorphic_impl_a::serialization_id()); - REQUIRE(state.get(2) == a_x1); - REQUIRE(state.get(3) == a_x2); - } + REQUIRE(state.get(0) == 1); + REQUIRE(state.get(1) == polymorphic_impl_a::serialization_id()); + REQUIRE(state.get(2) == a_x1); + REQUIRE(state.get(3) == a_x2); SECTION("deserialize to base type") { polymorphic deserialized;