From d89fbe96f6fcd81324a407e3f5c483fbca5398b9 Mon Sep 17 00:00:00 2001 From: Mariia Vtiurina Date: Mon, 29 Apr 2024 12:42:45 -0400 Subject: [PATCH] chore(deps): revert dependency catch2 to v2 for 2024.4.0 (#2739) * Revert "Update dependency catch2 to v3.5.4 (#2703)" * Revert "chore(deps): update dependency catch2 to v3 (#2205)" --- 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 +- .../table/backend/test/copy_convert_cpp.cpp | 103 ++++++++++++++++++ .../backend/test/copy_convert_fixture.hpp | 1 - ...{copy_convert.cpp => copy_convert_gpu.cpp} | 76 +------------ .../backend/test/copy_convert_perf_cpp.cpp | 102 +++++++++++++++++ ...ert_perf.cpp => copy_convert_perf_dpc.cpp} | 70 +----------- 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, 456 insertions(+), 397 deletions(-) create mode 100644 cpp/oneapi/dal/table/backend/test/copy_convert_cpp.cpp rename cpp/oneapi/dal/table/backend/test/{copy_convert.cpp => copy_convert_gpu.cpp} (62%) create mode 100644 cpp/oneapi/dal/table/backend/test/copy_convert_perf_cpp.cpp rename cpp/oneapi/dal/table/backend/test/{copy_convert_perf.cpp => copy_convert_perf_dpc.cpp} (61%) diff --git a/WORKSPACE b/WORKSPACE index 48cfa890abe..b41d663ab61 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -108,9 +108,9 @@ onedal_repo( http_archive( name = "catch2", - url = "https://github.com/catchorg/Catch2/archive/v3.5.4.tar.gz", - sha256 = "b7754b711242c167d8f60b890695347f90a1ebc95949a045385114165d606dbb", - strip_prefix = "Catch2-3.5.4", + url = "https://github.com/catchorg/Catch2/archive/v2.13.10.tar.gz", + sha256 = "d54a712b7b1d7708bc7a819a8e6e47b2fde9536f487b89ccbca295072a7d9943", + strip_prefix = "Catch2-2.13.10", ) http_archive( diff --git a/cpp/oneapi/dal/algo/covariance/test/fixture.hpp b/cpp/oneapi/dal/algo/covariance/test/fixture.hpp index 00e9738acad..47742e0eca5 100644 --- a/cpp/oneapi/dal/algo/covariance/test/fixture.hpp +++ b/cpp/oneapi/dal/algo/covariance/test/fixture.hpp @@ -117,7 +117,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 | @@ -126,7 +126,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); @@ -134,7 +134,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); @@ -142,7 +142,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); @@ -150,7 +150,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); @@ -158,7 +158,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); @@ -166,7 +166,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); @@ -174,7 +174,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); @@ -187,7 +187,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 | @@ -201,7 +201,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); @@ -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 cor"); + INFO("create descriptor cor") cov_desc = covariance::descriptor().set_result_options( covariance::result_options::cor_matrix); @@ -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 means"); + INFO("create descriptor means") cov_desc = covariance::descriptor().set_result_options( covariance::result_options::means); @@ -240,7 +240,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); @@ -253,7 +253,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); @@ -266,7 +266,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); @@ -285,32 +285,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(desc, data, means); } } diff --git a/cpp/oneapi/dal/algo/dbscan/test/fixture.hpp b/cpp/oneapi/dal/algo/dbscan/test/fixture.hpp index b2e374bc4f8..6b58731cb88 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 2a530d0b0b5..d2f64bb2dff 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 f1ac29d0e51..4d2ccf17936 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 7e1d176db01..34639fc2bfc 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) { - SECTION("compare responses") { + INFO("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 0f805757c84..d1042741b00 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 (Catch::Approx(jaccard_coeffs_data[i]) == correct_jaccard_coeffs[i]) + if (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 06aa7856de7..eda2ce38e76 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,8 +14,6 @@ * 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 646629196a0..026fe813a35 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,8 +14,6 @@ * 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 e4b5125d618..1fdf3cc00e1 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); - SECTION("check if centroids close to gold") { + INFO("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(); - SECTION("check if responses are expected") { + INFO("check if responses are expected") { check_response_match(match_map, expected_responses, responses); } - SECTION("check if objective function value is expected") { + INFO("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 df15e3238cb..2c7e3d34063 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); - SECTION("check if all results bitwise equal on all ranks") { + INFO("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 - SECTION("check centroids") { + INFO("check centroids") { const auto centroids = result.get_model().get_centroids(); te::check_if_tables_equal(centroids, front_centroids); } - SECTION("check iterations") { + INFO("check iterations") { REQUIRE(result.get_iteration_count() == front_iteration_count); } - SECTION("check objective function") { + INFO("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 0e188777556..4cb493281d8 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(); - SECTION("check if responses are expected") { + INFO("check if responses are expected") { check_response_match(match_map, expected_responses, responses); } - SECTION("check if objective function value is expected") { + INFO("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); - SECTION("check if all results bitwise equal on all ranks") { - SECTION("check centroids") { + INFO("check if all results bitwise equal on all ranks") { + INFO("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 } } - SECTION("check iterations") { + INFO("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); } - SECTION("check objective function") { + INFO("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 c3a628c57ae..6ae42f01a4b 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 9f5f60ac6e3..7fa0c36db30 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 1451f62e7b8..5fc99e4fc37 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) { - SECTION("compare responses") { + INFO("compare responses") { te::check_if_tables_equal(actual.get_responses(), reference.get_responses()); } } if constexpr (is_regression) { - SECTION("compare responses") { + INFO("compare responses") { check_if_tables_close(actual.get_responses(), reference.get_responses()); } } if constexpr (is_search) { - SECTION("compare indices") { + INFO("compare indices") { te::check_if_tables_equal(actual.get_indices(), reference.get_indices()); } - SECTION("compare distances") { + INFO("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 59097eb2ebe..e6e6344993a 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 e385dcb8bcb..bea9aa69501 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 1cdbcce123c..5230d5f6c89 100644 --- a/cpp/oneapi/dal/algo/louvain/test/louvain_test.cpp +++ b/cpp/oneapi/dal/algo/louvain/test/louvain_test.cpp @@ -25,8 +25,6 @@ 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 a7792f34d1a..85f04144e89 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(); - SECTION("check eigenvalues") { + INFO("check eigenvalues") { const auto gold_eigenvalues = this->get_gold_eigenvalues(); this->check_eigenvalues(gold_eigenvalues, eigenvalues); } - SECTION("check eigenvectors") { + INFO("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(); - SECTION("check eigenvalues") { + INFO("check eigenvalues") { const auto gold_eigenvalues = this->get_gold_eigenvalues(); this->check_eigenvalues(gold_eigenvalues, eigenvalues); } - SECTION("check eigenvectors") { + INFO("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 3d696d3779e..c86655f128b 100644 --- a/cpp/oneapi/dal/algo/pca/test/fixture.hpp +++ b/cpp/oneapi/dal/algo/pca/test/fixture.hpp @@ -138,7 +138,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); @@ -157,7 +157,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(); @@ -182,18 +182,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); } @@ -205,10 +205,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); } @@ -231,11 +231,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()); } @@ -248,19 +248,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()); } @@ -277,16 +277,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 75b89f80ea9..50c29e03e3d 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) { - SECTION("compare responses") { + INFO("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 c3eeaf1ed80..b23501c425d 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 34dfdb488c2..7b4935314ea 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 7e03d51eb64..ea2daf64e9d 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 a02988881ed..4168c5061ca 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 c22e8833519..a64fb307644 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) { - SECTION("compare responses") { + INFO("compare responses") { te::check_if_tables_equal(actual.get_responses(), reference.get_responses()); } if constexpr (std::is_same_v) { - SECTION("compare decision function") { + INFO("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 ff3a2a0a6e1..43b4a131bf1 100644 --- a/cpp/oneapi/dal/backend/primitives/placement/test/argwhere_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/placement/test/argwhere_dpc.cpp @@ -15,7 +15,6 @@ *******************************************************************************/ #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 8729e20db60..813e7389ef2 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) { - SECTION("Output of selected values") { + INFO("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); } - SECTION("Output of selected indices") { + INFO("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); } - SECTION("Output of both") { + INFO("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 f39d21251c3..c2188d43444 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); - SECTION("compare correlation matrix with gold") { + INFO("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()); } - SECTION("compare means with gold") { + INFO("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()); } - SECTION("compare vars with gold") { + INFO("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); @@ -264,19 +264,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. - SECTION("check if correlation matrix for diagonal matrix") { + INFO("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); } - SECTION("check if mean is expected") { + INFO("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); } - SECTION("check if variance is expected") { + INFO("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 18a33079b3c..8b915d08699 100644 --- a/cpp/oneapi/dal/backend/primitives/test/fill_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/test/fill_dpc.cpp @@ -30,10 +30,11 @@ 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(); + } - SECTION("check filler on host") { + INFO("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 2c5843eff88..810a46a9a96 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 (Catch::Approx(dal::preview::get_edge_value(g, i, graph_data.cols[j])) == + if (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 42153b3042a..60692b736a5 100755 --- a/cpp/oneapi/dal/table/BUILD +++ b/cpp/oneapi/dal/table/BUILD @@ -28,7 +28,8 @@ dal_test_suite( "detail/test/csr_utils.cpp", "detail/test/homogen_utils.cpp", "detail/test/metadata_utils.cpp", - "backend/test/copy_convert.cpp", + "backend/test/copy_convert_cpp.cpp", + "backend/test/copy_convert_gpu.cpp", ], dal_deps = [":table"], framework = "catch2", diff --git a/cpp/oneapi/dal/table/backend/test/copy_convert_cpp.cpp b/cpp/oneapi/dal/table/backend/test/copy_convert_cpp.cpp new file mode 100644 index 00000000000..88d235bc4a5 --- /dev/null +++ b/cpp/oneapi/dal/table/backend/test/copy_convert_cpp.cpp @@ -0,0 +1,103 @@ +/******************************************************************************* +* 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 decfa036b6c..71e9adad20f 100644 --- a/cpp/oneapi/dal/table/backend/test/copy_convert_fixture.hpp +++ b/cpp/oneapi/dal/table/backend/test/copy_convert_fixture.hpp @@ -16,7 +16,6 @@ #include #include -#include #include #include "oneapi/dal/test/engine/common.hpp" diff --git a/cpp/oneapi/dal/table/backend/test/copy_convert.cpp b/cpp/oneapi/dal/table/backend/test/copy_convert_gpu.cpp similarity index 62% rename from cpp/oneapi/dal/table/backend/test/copy_convert.cpp rename to cpp/oneapi/dal/table/backend/test/copy_convert_gpu.cpp index b804efedf6c..b0b6fb476a6 100644 --- a/cpp/oneapi/dal/table/backend/test/copy_convert.cpp +++ b/cpp/oneapi/dal/table/backend/test/copy_convert_gpu.cpp @@ -30,60 +30,6 @@ #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 @@ -155,27 +101,9 @@ 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, - "Deterministic random array - RM", + "Determenistic random array - RM", "[convert][2d][small]", convert_types) { this->generate(); @@ -183,7 +111,7 @@ TEMPLATE_LIST_TEST_M(copy_convert_dpc_test, } TEMPLATE_LIST_TEST_M(copy_convert_dpc_test, - "Deterministic random array - CM", + "Determenistic random array - CM", "[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 new file mode 100644 index 00000000000..52256bb4360 --- /dev/null +++ b/cpp/oneapi/dal/table/backend/test/copy_convert_perf_cpp.cpp @@ -0,0 +1,102 @@ +/******************************************************************************* +* 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/backend/test/copy_convert_perf.cpp b/cpp/oneapi/dal/table/backend/test/copy_convert_perf_dpc.cpp similarity index 61% rename from cpp/oneapi/dal/table/backend/test/copy_convert_perf.cpp rename to cpp/oneapi/dal/table/backend/test/copy_convert_perf_dpc.cpp index fecddda8f9c..29e648e9abe 100644 --- a/cpp/oneapi/dal/table/backend/test/copy_convert_perf.cpp +++ b/cpp/oneapi/dal/table/backend/test/copy_convert_perf_dpc.cpp @@ -35,63 +35,6 @@ 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 @@ -154,20 +97,9 @@ 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, - "Deterministic random array", + "Determenistic random array", "[convert][2d][small]", convert_types) { this->generate(); diff --git a/cpp/oneapi/dal/table/test/heterogen.cpp b/cpp/oneapi/dal/table/test/heterogen.cpp index 1d69c36dcfa..73370b69cb5 100644 --- a/cpp/oneapi/dal/table/test/heterogen.cpp +++ b/cpp/oneapi/dal/table/test/heterogen.cpp @@ -14,8 +14,6 @@ * 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 61d71509a64..6455b97f80a 100644 --- a/cpp/oneapi/dal/table/test/row_accessor.cpp +++ b/cpp/oneapi/dal/table/test/row_accessor.cpp @@ -20,8 +20,6 @@ #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 27f153a5aef..188e958117c 100644 --- a/cpp/oneapi/dal/test/array.cpp +++ b/cpp/oneapi/dal/test/array.cpp @@ -17,8 +17,6 @@ #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 39a9cc0a682..4e3e05fed4d 100644 --- a/cpp/oneapi/dal/test/communicator.cpp +++ b/cpp/oneapi/dal/test/communicator.cpp @@ -15,7 +15,6 @@ *******************************************************************************/ #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 87b8c1a98f7..035ec2fd112 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 5d25f52f9bd..074d9575835 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 784d99c3e54..d9c5cfa65c0 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 68a05683ad4..cca431f71eb 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 6d5bbb67647..03ba9cdaf31 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 1a0e853c895..a9892d41502 100644 --- a/cpp/oneapi/dal/test/engine/serialization.hpp +++ b/cpp/oneapi/dal/test/engine/serialization.hpp @@ -177,13 +177,15 @@ template void serialize_deserialize(const T& original, U& deserialized) { mock_archive_state state; - INFO("serialize"); - mock_output_archive input_ar(state); - detail::serialize(original, input_ar); + INFO("serialize") { + mock_output_archive ar(state); + detail::serialize(original, ar); + } - INFO("deserialize"); - mock_input_archive output_ar(state); - detail::deserialize(deserialized, output_ar); + INFO("deserialize") { + mock_input_archive ar(state); + detail::deserialize(deserialized, ar); + } } template diff --git a/cpp/oneapi/dal/test/serialization.cpp b/cpp/oneapi/dal/test/serialization.cpp index 97de07e2140..c1cc151d9b9 100644 --- a/cpp/oneapi/dal/test/serialization.cpp +++ b/cpp/oneapi/dal/test/serialization.cpp @@ -43,15 +43,16 @@ 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); + } - SECTION("deserialize") { + INFO("deserialize") { float deserialized; te::mock_input_archive ar(state); detail::deserialize(deserialized, ar); @@ -69,15 +70,16 @@ 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); + } - SECTION("deserialize") { + INFO("deserialize") { my_enum deserialized; te::mock_input_archive ar(state); detail::deserialize(deserialized, ar); @@ -99,18 +101,19 @@ 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); + } - SECTION("deserialize") { + INFO("deserialize") { pod_type deserialized; te::mock_input_archive ar(state); detail::deserialize(deserialized, ar); @@ -167,17 +170,18 @@ 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]); + } } - SECTION("deserialize") { + INFO("deserialize") { vector_type deserialized; te::mock_input_archive ar(state); detail::deserialize(deserialized, ar); @@ -340,14 +344,15 @@ 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;