Skip to content

Commit

Permalink
[test] Add asum test to dpcpp
Browse files Browse the repository at this point in the history
Momentaneously fix asum test to allow compilation and testing using
dpcpp.
  • Loading branch information
s-Nick committed Aug 28, 2023
1 parent 9293f77 commit 32c60ec
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/interface/blas1/backend/amd_gpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ typename sb_handle_t::event_t _asum(sb_handle_t &sb_handle, index_t _N,
container_0_t _vx, increment_t _incx,
container_1_t _rs) {
if (_N < (1 << 18)) {
constexpr auto localSize = 1024ul;
constexpr auto localSize = 1024;
const auto blocks = (_N + localSize - 1) / localSize;
return blas::internal::_asum_impl<localSize, 32>(sb_handle, _N, _vx, _incx,
_rs, blocks);
} else {
constexpr auto localSize = 512ul;
constexpr auto blocks = 256ul;
constexpr auto localSize = 512;
constexpr auto blocks = 256;
return blas::internal::_asum_impl<localSize, 32>(sb_handle, _N, _vx, _incx,
_rs, blocks);
}
Expand Down
4 changes: 0 additions & 4 deletions src/operations/blas1/asum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@

namespace blas {

/*! Asum.
* @brief Implements the reduction operation for assignments
* (in the form y = x) with y a scalar and x a subexpression tree.
*/
template <typename lhs_t, typename rhs_t>
Asum<lhs_t, rhs_t>::Asum(lhs_t &_l, rhs_t &_r) : lhs_(_l), rhs_(_r){};

Expand Down
2 changes: 1 addition & 1 deletion test/unittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include_directories(${PORTBLAS_TEST} ${BLAS_INCLUDE_DIRS})
# compiling tests
set(SYCL_UNITTEST_SRCS
# Blas 1 tests
${PORTBLAS_UNITTEST}/blas1/blas1_asum_test.cpp
${PORTBLAS_UNITTEST}/blas1/blas1_axpy_test.cpp
${PORTBLAS_UNITTEST}/blas1/blas1_copy_test.cpp
${PORTBLAS_UNITTEST}/blas1/blas1_scal_test.cpp
Expand Down Expand Up @@ -81,7 +82,6 @@ if(is_computecpp)
set(SYCL_UNITTEST_SRCS ${SYCL_UNITTEST_SRCS}
# Blas 1 tests
${PORTBLAS_UNITTEST}/blas1/blas1_swap_test.cpp
${PORTBLAS_UNITTEST}/blas1/blas1_asum_test.cpp
${PORTBLAS_UNITTEST}/blas1/blas1_dot_test.cpp
${PORTBLAS_UNITTEST}/blas1/blas1_nrm2_test.cpp
${PORTBLAS_UNITTEST}/blas1/blas1_iamax_test.cpp
Expand Down
13 changes: 8 additions & 5 deletions test/unittest/blas1/blas1_asum_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
#include "blas_test.hpp"

template <typename scalar_t>
using combination_t = std::tuple<api_type, int, int>;
using combination_t = std::tuple<api_type, int, int, scalar_t>;

template <typename scalar_t>
void run_test(const combination_t<scalar_t> combi) {
api_type api;
index_t size;
index_t incX;
std::tie(api, size, incX) = combi;
scalar_t unused;
std::tie(api, size, incX, unused) = combi;

// Input vector
std::vector<scalar_t> x_v(size * incX);
Expand Down Expand Up @@ -77,15 +78,17 @@ const auto combi = ::testing::Combine(::testing::Values(api_type::async,
api_type::sync), // Api
::testing::Values(11, 65, 10000,
1002400), // size
::testing::Values(1, 4) // incX
);
::testing::Values(1, 4), // incX
::testing::Values(1.0));


template <class T>
static std::string generate_name(
const ::testing::TestParamInfo<combination_t<T>>& info) {
api_type api;
int size, incX;
BLAS_GENERATE_NAME(info.param, api, size, incX);
T unused;
BLAS_GENERATE_NAME(info.param, api, size, incX, unused);
}

BLAS_REGISTER_TEST_ALL(Asum, combination_t, combi, generate_name);

0 comments on commit 32c60ec

Please sign in to comment.