Skip to content

Commit

Permalink
Merge unified tests
Browse files Browse the repository at this point in the history
This merges equivalent tests between CUDA, HIP, DPC++ and OpenMP in the common test interface.

Related PR: #1117
  • Loading branch information
upsj authored Sep 29, 2022
2 parents 4c3320c + d0206b6 commit 409ff3a
Show file tree
Hide file tree
Showing 157 changed files with 3,225 additions and 29,390 deletions.
34 changes: 16 additions & 18 deletions core/test/matrix/fbcsr_sample.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,16 @@ class FbcsrSampleComplex {
v[i] = 0.15 + fbcsr_test_offset;
}

using namespace std::complex_literals;
v[0] = 1.0 + 1.15i;
v[2] = 2.0 + 2.15i;
v[1] = 3.0 - 3.15i;
v[3] = 0.0 - 0.15i;
v[0] = value_type{1.0, 1.15};
v[2] = value_type{2.0, 2.15};
v[1] = value_type{3.0, -3.15};
v[3] = value_type{0.0, -0.15};
v[9] = 0.0;
v[11] = 0.0;
v[12] = -12.0 + 12.15i;
v[14] = -1.0 + 1.15i;
v[13] = -2.0 - 2.15i;
v[15] = -11.0 - 11.15i;
v[12] = -value_type{12.0, 12.15};
v[14] = -value_type{1.0, 1.15};
v[13] = -value_type{2.0, -2.15};
v[15] = -value_type{11.0, -11.15};

return Fbcsr::create(exec,
gko::dim<2>{static_cast<size_type>(nrows),
Expand All @@ -491,17 +490,16 @@ class FbcsrSampleComplex {
v[i] = 0.15 + fbcsr_test_offset;
}

using namespace std::complex_literals;
v[0] = 1.0 + 1.15i;
v[1] = 2.0 + 2.15i;
v[2] = 3.0 - 3.15i;
v[3] = 0.0 - 0.15i;
v[0] = value_type{1.0, 1.15};
v[1] = value_type{2.0, 2.15};
v[2] = value_type{3.0, -3.15};
v[3] = value_type{0.0, -0.15};
v[10] = 0.0;
v[11] = 0.0;
v[12] = -12.0 + 12.15i;
v[13] = -1.0 + 1.15i;
v[14] = -2.0 - 2.15i;
v[15] = -11.0 - 11.15i;
v[12] = -value_type{12.0, 12.15};
v[13] = -value_type{1.0, 1.15};
v[14] = -value_type{2.0, -2.15};
v[15] = -value_type{11.0, -11.15};

return Csr::create(exec,
gko::dim<2>{static_cast<size_type>(nrows),
Expand Down
4 changes: 3 additions & 1 deletion core/test/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define GKO_CORE_TEST_UTILS_HPP_


#include <cmath>
#include <complex>
#include <initializer_list>
#include <limits>
Expand Down Expand Up @@ -189,7 +190,8 @@ struct reduction_factor {
using nc_output = remove_complex<OutputType>;
using nc_precision = remove_complex<Precision>;
static constexpr nc_output value{
std::numeric_limits<nc_precision>::epsilon() * nc_output{10}};
std::numeric_limits<nc_precision>::epsilon() * nc_output{10} *
(gko::is_complex<Precision>() ? nc_output{1.4142} : one<nc_output>())};
};


Expand Down
1 change: 0 additions & 1 deletion core/test/utils/fb_matrix_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ std::unique_ptr<matrix::Fbcsr<ValueType, IndexType>> generate_fbcsr_from_csr(

const IndexType* const row_ptrs = fmtx->get_const_row_ptrs();
const IndexType* const col_idxs = fmtx->get_const_col_idxs();
const IndexType nnz = nbnz * bs2;
ValueType* const vals = fmtx->get_values();
std::uniform_real_distribution<gko::remove_complex<ValueType>>
off_diag_dist(-1.0, 1.0);
Expand Down
4 changes: 0 additions & 4 deletions cuda/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ include(${PROJECT_SOURCE_DIR}/cmake/create_test.cmake)

add_subdirectory(base)
add_subdirectory(components)
add_subdirectory(factorization)
add_subdirectory(matrix)
add_subdirectory(preconditioner)
add_subdirectory(reorder)
add_subdirectory(solver)
add_subdirectory(stop)
add_subdirectory(utils)
1 change: 0 additions & 1 deletion cuda/test/components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ ginkgo_create_cuda_test(cooperative_groups)
ginkgo_create_cuda_test(merging)
ginkgo_create_cuda_test(searching)
ginkgo_create_cuda_test(sorting)
ginkgo_create_test(prefix_sum_kernels)
96 changes: 0 additions & 96 deletions cuda/test/components/prefix_sum_kernels.cpp

This file was deleted.

6 changes: 0 additions & 6 deletions cuda/test/factorization/CMakeLists.txt

This file was deleted.

146 changes: 0 additions & 146 deletions cuda/test/factorization/ic_kernels.cpp

This file was deleted.

Loading

0 comments on commit 409ff3a

Please sign in to comment.