From f783b84695a6542586f06a5a01b93726087c6eeb Mon Sep 17 00:00:00 2001 From: Aurelius84 Date: Mon, 24 Jan 2022 16:32:03 +0800 Subject: [PATCH] Move dim_test/ddim_test into tests directory (#39111) Co-authored-by: Chen Weihang --- paddle/pten/core/CMakeLists.txt | 6 ------ paddle/pten/tests/core/CMakeLists.txt | 8 ++++++++ .../pten/{core/ddim_test.cc => tests/core/test_ddim.cc} | 6 ++++++ paddle/pten/{core/dim_test.cu => tests/core/test_dim.cu} | 8 +++++++- 4 files changed, 21 insertions(+), 7 deletions(-) rename paddle/pten/{core/ddim_test.cc => tests/core/test_ddim.cc} (96%) rename paddle/pten/{core/dim_test.cu => tests/core/test_dim.cu} (96%) diff --git a/paddle/pten/core/CMakeLists.txt b/paddle/pten/core/CMakeLists.txt index 181012732f..b281f95f36 100644 --- a/paddle/pten/core/CMakeLists.txt +++ b/paddle/pten/core/CMakeLists.txt @@ -23,12 +23,6 @@ cc_library(infermeta_utils SRCS infermeta_utils.cc DEPS meta_tensor) cc_test(unroll_array_ops_test SRCS unroll_array_ops_test.cc) cc_library(ddim SRCS ddim.cc DEPS eigen3 boost enforce) -cc_test(ddim_test SRCS ddim_test.cc DEPS ddim) -if(WITH_GPU) - nv_test(dim_test SRCS dim_test.cu DEPS ddim) -elseif(WITH_ROCM) - hip_test(dim_test SRCS dim_test.cu DEPS ddim) -endif() cc_library(selected_rows SRCS selected_rows.cc DEPS dense_tensor mixed_vector enforce ddim) diff --git a/paddle/pten/tests/core/CMakeLists.txt b/paddle/pten/tests/core/CMakeLists.txt index 363a57f036..43e1480e2c 100644 --- a/paddle/pten/tests/core/CMakeLists.txt +++ b/paddle/pten/tests/core/CMakeLists.txt @@ -4,6 +4,14 @@ cc_test(test_type_info SRCS test_type_info.cc) cc_test(test_convert_utils SRCS test_convert_utils.cc DEPS convert_utils) cc_test(test_kernel_factory SRCS test_kernel_factory.cc DEPS kernel_factory scale_kernel) cc_test(test_pten_device_context SRCS test_device_context.cc DEPS pten_context cpu_context) + +cc_test(test_ddim SRCS test_ddim.cc DEPS ddim) +if(WITH_GPU) + nv_test(test_dim SRCS test_dim.cu DEPS ddim) +elseif(WITH_ROCM) + hip_test(test_dim SRCS test_dim.cu DEPS ddim) +endif() + cc_test(selected_rows_test SRCS test_selected_rows.cc DEPS selected_rows) if(WITH_TESTING AND TEST selected_rows_test) set_tests_properties(selected_rows_test PROPERTIES TIMEOUT 120) diff --git a/paddle/pten/core/ddim_test.cc b/paddle/pten/tests/core/test_ddim.cc similarity index 96% rename from paddle/pten/core/ddim_test.cc rename to paddle/pten/tests/core/test_ddim.cc index 1903bbfdff..b13fe68ef5 100644 --- a/paddle/pten/core/ddim_test.cc +++ b/paddle/pten/tests/core/test_ddim.cc @@ -17,6 +17,9 @@ #include "gtest/gtest.h" #include "paddle/pten/core/ddim.h" +namespace pten { +namespace tests { + TEST(DDim, Equality) { // construct a DDim from an initialization list pten::framework::DDim ddim = pten::framework::make_ddim({9, 1, 5}); @@ -81,3 +84,6 @@ TEST(DDim, Print) { ss << ddim; EXPECT_EQ("2, 3, 4", ss.str()); } + +} // namespace tests +} // namespace pten diff --git a/paddle/pten/core/dim_test.cu b/paddle/pten/tests/core/test_dim.cu similarity index 96% rename from paddle/pten/core/dim_test.cu rename to paddle/pten/tests/core/test_dim.cu index 0f8d71c5d3..1c4a9c163f 100644 --- a/paddle/pten/core/dim_test.cu +++ b/paddle/pten/tests/core/test_dim.cu @@ -18,6 +18,9 @@ #include "gtest/gtest.h" #include "paddle/pten/core/dim.h" +namespace pten { +namespace tests { + __global__ void test(pten::framework::Dim<2>* o) { o[0] = pten::framework::make_dim(5, 6); } @@ -94,4 +97,7 @@ TEST(Dim, Print) { ss << pten::framework::make_dim(8); EXPECT_EQ(ss.str(), "8"); } -} \ No newline at end of file +} + +} // namespace tests +} // namespace pten \ No newline at end of file -- GitLab