From c5bc22078e84c55e0f6890c8e14c7cfbc67807f0 Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Mon, 18 Apr 2022 20:18:56 +0200 Subject: [PATCH] #1544: Tests: Reduce number of elements for 4 dim Collection in test_construct --- src/vt/topos/mapping/dense/dense.impl.h | 7 +++++++ .../collection/test_collection_construct_common.h | 14 ++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/vt/topos/mapping/dense/dense.impl.h b/src/vt/topos/mapping/dense/dense.impl.h index 2d6d83b8c1..8c553ade18 100644 --- a/src/vt/topos/mapping/dense/dense.impl.h +++ b/src/vt/topos/mapping/dense/dense.impl.h @@ -93,6 +93,13 @@ NodeType dense3DRoundRobinMap(Idx3DPtr idx, Idx3DPtr max, NodeType nx) { return lin_idx % nx; } +template +NodeType denseNDRoundRobinMap(IdxNDPtr idx, IdxNDPtr max, NodeType nx) { + using IndexElmType = typename IdxTypeND::DenseIndexType; + auto const& lin_idx = linearizeDenseIndexColMajor(idx, max); + return lin_idx % nx; +} + // Default block mappings template NodeType dense1DBlockMap(Idx1DPtr idx, Idx1DPtr max, NodeType nx) { diff --git a/tests/unit/collection/test_collection_construct_common.h b/tests/unit/collection/test_collection_construct_common.h index 9dfe33ac96..bd014f97d4 100644 --- a/tests/unit/collection/test_collection_construct_common.h +++ b/tests/unit/collection/test_collection_construct_common.h @@ -119,8 +119,11 @@ void test_construct_1() { auto const& this_node = theContext()->getNode(); if (this_node == 0) { - auto const& col_size = 32; - auto rng = CreateRange(col_size); + // We don't want too many elements for 4 dimensions + auto constexpr num_dims = ColType::IndexType::ndims(); + auto constexpr col_size = 8 / num_dims; + + auto rng = CreateRange(col_size); auto proxy = ConstructParams::construct(rng); proxy.template broadcast< MsgType, @@ -133,8 +136,11 @@ template void test_construct_distributed_1() { using MsgType = typename ColType::MsgType; - auto const& col_size = 32; - auto rng = CreateRange(col_size); + // We don't want too many elements for 4 dimensions + auto constexpr num_dims = ColType::IndexType::ndims(); + auto constexpr col_size = 8 / num_dims; + + auto rng = CreateRange(col_size); auto proxy = ConstructParams::constructCollective(rng); proxy.template broadcast< MsgType,