Commit d9622de8 authored by Kenneth Moreland's avatar Kenneth Moreland

Add new radix-kr single image composite algorithm

The radix-kr is essentially the radix-k algorithm with some ideas from
2-3 swap added in. Rather than forcing all the k's in radix-k to be
factors, radix-kr allows the k to have a remainder when splitting the
process. The remaining processes participate in that round by splitting
their image and sending them off, but they receive nothing that round
and then go idle. Although this adds some imbalance, it does not add
much. It also makes keeping track of partitions easier than 2-3 swap.
parent b3afdbeb
......@@ -27,6 +27,7 @@ SET(ICET_SRCS
../strategies/vtree.c
../strategies/bswap.c
../strategies/radixk.c
../strategies/radixkr.c
../strategies/tree.c
../strategies/automatic.c
)
......
......@@ -219,6 +219,7 @@ ICET_EXPORT const char *icetGetStrategyName(void);
#define ICET_SINGLE_IMAGE_STRATEGY_BSWAP (IceTEnum)0x7002
#define ICET_SINGLE_IMAGE_STRATEGY_TREE (IceTEnum)0x7003
#define ICET_SINGLE_IMAGE_STRATEGY_RADIXK (IceTEnum)0x7004
#define ICET_SINGLE_IMAGE_STRATEGY_RADIXKR (IceTEnum)0x7005
ICET_EXPORT void icetSingleImageStrategy(IceTEnum strategy);
......
......@@ -21,8 +21,8 @@ void icetAutomaticCompose(const IceTInt *compose_group,
IceTSizeType *piece_offset)
{
if (group_size > 1) {
icetRaiseDebug("Doing radix-k compose");
icetInvokeSingleImageStrategy(ICET_SINGLE_IMAGE_STRATEGY_RADIXK,
icetRaiseDebug("Doing radix-kr compose");
icetInvokeSingleImageStrategy(ICET_SINGLE_IMAGE_STRATEGY_RADIXKR,
compose_group,
group_size,
image_dest,
......@@ -34,7 +34,7 @@ void icetAutomaticCompose(const IceTInt *compose_group,
*result_image = input_image;
*piece_offset = 0;
} else {
icetRaiseDebug("Clearing pixels");
icetRaiseDebug("Clearing pixels");
icetClearSparseImage(input_image);
*result_image = input_image;
*piece_offset = 0;
......
......@@ -1495,7 +1495,7 @@ static IceTBoolean radixkTryTelescopeSendReceive(IceTInt *main_group,
return ICET_TRUE;
}
ICET_EXPORT IceTBoolean icetRadixTelescopeSendReceiveTest(void)
ICET_EXPORT IceTBoolean icetRadixkTelescopeSendReceiveTest(void)
{
IceTInt main_group_size;
......
This diff is collapsed.
......@@ -46,6 +46,12 @@ extern void icetRadixkCompose(const IceTInt *compose_group,
IceTSparseImage input_image,
IceTSparseImage *result_image,
IceTSizeType *piece_offset);
extern void icetRadixkrCompose(const IceTInt *compose_group,
IceTInt group_size,
IceTInt image_dest,
IceTSparseImage input_image,
IceTSparseImage *result_image,
IceTSizeType *piece_offset);
/*==================================================================*/
......@@ -132,6 +138,7 @@ IceTBoolean icetSingleImageStrategyValid(IceTEnum strategy)
case ICET_SINGLE_IMAGE_STRATEGY_BSWAP:
case ICET_SINGLE_IMAGE_STRATEGY_TREE:
case ICET_SINGLE_IMAGE_STRATEGY_RADIXK:
case ICET_SINGLE_IMAGE_STRATEGY_RADIXKR:
return ICET_TRUE;
default:
return ICET_FALSE;
......@@ -145,6 +152,7 @@ const char *icetSingleImageStrategyNameFromEnum(IceTEnum strategy)
case ICET_SINGLE_IMAGE_STRATEGY_BSWAP: return "Binary Swap";
case ICET_SINGLE_IMAGE_STRATEGY_TREE: return "Binary Tree";
case ICET_SINGLE_IMAGE_STRATEGY_RADIXK: return "Radix-k";
case ICET_SINGLE_IMAGE_STRATEGY_RADIXKR: return "Radix-kr";
default:
icetRaiseError("Invalid single image strategy.", ICET_INVALID_ENUM);
return "<Invalid>";
......@@ -195,6 +203,14 @@ void icetInvokeSingleImageStrategy(IceTEnum strategy,
result_image,
piece_offset);
break;
case ICET_SINGLE_IMAGE_STRATEGY_RADIXKR:
icetRadixkrCompose(compose_group,
group_size,
image_dest,
input_image,
result_image,
piece_offset);
break;
default:
icetRaiseError("Invalid single image strategy.", ICET_INVALID_ENUM);
break;
......
......@@ -51,6 +51,7 @@ SET(IceTTestSrcs
OddImageSizes.c
OddProcessCounts.c
PreRender.c
RadixkrUnitTests.c
RadixkUnitTests.c
RenderEmpty.c
SimpleTiming.c
......
......@@ -16,7 +16,7 @@
extern ICET_EXPORT IceTBoolean icetRadixkPartitionLookupUnitTest(void);
extern ICET_EXPORT IceTBoolean icetRadixTelescopeSendReceiveTest(void);
extern ICET_EXPORT IceTBoolean icetRadixkTelescopeSendReceiveTest(void);
static int RadixkUnitTestsRun(void)
{
......@@ -31,7 +31,7 @@ static int RadixkUnitTestsRun(void)
return TEST_FAILED;
}
if (!icetRadixTelescopeSendReceiveTest()) {
if (!icetRadixkTelescopeSendReceiveTest()) {
return TEST_FAILED;
}
......
/* -*- c -*- *****************************************************************
** Copyright (C) 2011 Sandia Corporation
** Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
** the U.S. Government retains certain rights in this software.
**
** This source code is released under the New BSD License.
**
** This exercises the radix-k unit tests of internal functions.
*****************************************************************************/
#include <IceT.h>
#include "test_codes.h"
#include "test_util.h"
#include <stdlib.h>
extern ICET_EXPORT IceTBoolean icetRadixkrPartitionLookupUnitTest(void);
static int RadixkUnitTestsRun(void)
{
IceTInt rank;
icetGetIntegerv(ICET_RANK, &rank);
if (rank != 0) {
return TEST_PASSED;
}
if (!icetRadixkrPartitionLookupUnitTest()) {
return TEST_FAILED;
}
return TEST_PASSED;
}
int RadixkrUnitTests(int argc, char *argv[])
{
/* To remove warning. */
(void)argc;
(void)argv;
return run_test(RadixkUnitTestsRun);
}
......@@ -37,7 +37,7 @@ IceTEnum strategy_list[5];
int STRATEGY_LIST_SIZE = 5;
/* int STRATEGY_LIST_SIZE = 1; */
IceTEnum single_image_strategy_list[4];
IceTEnum single_image_strategy_list[5];
int SINGLE_IMAGE_STRATEGY_LIST_SIZE = 4;
/* int SINGLE_IMAGE_STRATEGY_LIST_SIZE = 1; */
......@@ -238,7 +238,8 @@ void initialize_test(int *argcp, char ***argvp, IceTCommunicator comm)
single_image_strategy_list[0] = ICET_SINGLE_IMAGE_STRATEGY_AUTOMATIC;
single_image_strategy_list[1] = ICET_SINGLE_IMAGE_STRATEGY_BSWAP;
single_image_strategy_list[2] = ICET_SINGLE_IMAGE_STRATEGY_RADIXK;
single_image_strategy_list[3] = ICET_SINGLE_IMAGE_STRATEGY_TREE;
single_image_strategy_list[3] = ICET_SINGLE_IMAGE_STRATEGY_RADIXK;
single_image_strategy_list[4] = ICET_SINGLE_IMAGE_STRATEGY_TREE;
}
IceTBoolean strategy_uses_single_image_strategy(IceTEnum strategy)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment