Skip to content

Commit

Permalink
fix formatting and test
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelKoch committed Mar 9, 2022
1 parent 03411ff commit 843d07f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
9 changes: 6 additions & 3 deletions common/cuda_hip/distributed/vector_kernels.hpp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ void build_local(
// the flat_idx_it is used by the scatter_if as an index map for the values
auto map_to_local_row =
[range_bounds, range_starting_indices] GKO_THRUST_LAMBDA(
const auto& idx_range_id) -> LocalIndexType {
const thrust::tuple<GlobalIndexType, size_type>& idx_range_id)
-> LocalIndexType {
const auto idx = thrust::get<0>(idx_range_id);
const auto rid = thrust::get<1>(idx_range_id);
return static_cast<LocalIndexType>(idx - range_bounds[rid]) +
Expand All @@ -72,7 +73,9 @@ void build_local(

auto stride = local_mtx->get_stride();
auto map_to_flat_idx =
[stride] GKO_THRUST_LAMBDA(const auto& row_col) -> size_type {
[stride] GKO_THRUST_LAMBDA(
const thrust::tuple<LocalIndexType, GlobalIndexType>& row_col)
-> size_type {
return thrust::get<0>(row_col) * stride + thrust::get<1>(row_col);
};
auto flat_idx_it = thrust::make_transform_iterator(
Expand All @@ -81,7 +84,7 @@ void build_local(
map_to_flat_idx);

auto is_local_row = [part_ids,
local_part] GKO_THRUST_LAMBDA(const auto rid) {
local_part] GKO_THRUST_LAMBDA(const size_type rid) {
return part_ids[rid] == local_part;
};
thrust::scatter_if(thrust::device, input.get_const_values(),
Expand Down
6 changes: 3 additions & 3 deletions cuda/distributed/vector_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "core/distributed/vector_kernels.hpp"


#include <ginkgo/core/base/exception_helpers.hpp>


#include <thrust/binary_search.h>
#include <thrust/execution_policy.h>
#include <thrust/iterator/transform_iterator.h>
Expand All @@ -44,6 +41,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <thrust/tuple.h>


#include <ginkgo/core/base/exception_helpers.hpp>


namespace gko {
namespace kernels {
namespace cuda {
Expand Down
5 changes: 3 additions & 2 deletions dpcpp/distributed/vector_kernels.dp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "core/distributed/vector_kernels.hpp"


#include <ginkgo/core/base/exception_helpers.hpp>

#include <oneapi/dpl/algorithm>
#include <oneapi/dpl/iterator>


#include <ginkgo/core/base/exception_helpers.hpp>


namespace gko {
namespace kernels {
namespace dpcpp {
Expand Down
6 changes: 3 additions & 3 deletions hip/distributed/vector_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "core/distributed/vector_kernels.hpp"


#include <ginkgo/core/base/exception_helpers.hpp>


#include <functional>


Expand All @@ -47,6 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <thrust/tuple.h>


#include <ginkgo/core/base/exception_helpers.hpp>


namespace gko {
namespace kernels {
namespace hip {
Expand Down
11 changes: 6 additions & 5 deletions test/mpi/distributed/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ class VectorCreation : public ::testing::Test {
size{local_size[1] * comm.size(), 11},
md{{0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}},
md_localized{{{0, 1}, {2, 3}}, {{4, 5}, {6, 7}}, {{8, 9}, {10, 11}}}
{}
{
init_executor(gko::ReferenceExecutor::create(), exec, comm);
}

void SetUp() override
{
ASSERT_EQ(this->comm.size(), 3);
init_executor(gko::ReferenceExecutor::create(), exec, comm);
}

void TearDown() override
Expand Down Expand Up @@ -370,7 +371,10 @@ class VectorReductions : public ::testing::Test {
size{53, 11},
engine(42)
{
init_executor(gko::ReferenceExecutor::create(), exec, comm);

logger = gko::share(HostToDeviceLogger::create(ref));
exec->add_logger(logger);

dense_x = dense_type::create(exec);
dense_y = dense_type::create(exec);
Expand Down Expand Up @@ -417,8 +421,6 @@ class VectorReductions : public ::testing::Test {
void SetUp() override
{
ASSERT_GT(comm.size(), 0);
init_executor(gko::ReferenceExecutor::create(), exec, comm);
exec->add_logger(logger);
}

void TearDown() override
Expand Down Expand Up @@ -595,7 +597,6 @@ class VectorLocalOps : public ::testing::Test {
void SetUp() override
{
ASSERT_GT(comm.size(), 0);
init_executor(gko::ReferenceExecutor::create(), exec, comm);
}

void TearDown() override
Expand Down

0 comments on commit 843d07f

Please sign in to comment.