Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified tests #1117

Merged
merged 29 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>())};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\sqrt{2}$?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, though it was surprisingly complicated to get that value in there, so I hand-wrote it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sqrt(2) right? So why not

Suggested change
(gko::is_complex<Precision>() ? nc_output{1.4142} : one<nc_output>())};
(gko::is_complex<Precision>() ? nc_output{std::sqrt(2f)} : one<nc_output>())};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice suggestion, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately this doesn't work, because it needs to be constexpr

};


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