Commit b4e1e73e authored by Kenneth Moreland's avatar Kenneth Moreland

Merge branch 'RadixKR'

parents 2e37a636 08fb7c03
......@@ -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
)
......
......@@ -75,21 +75,31 @@
_depth_format = icetSparseImageGetDepthFormat(INPUT_SPARSE_IMAGE);
_pixel_count = icetSparseImageGetNumPixels(INPUT_SPARSE_IMAGE);
if ( (_color_format != icetImageGetColorFormat(OUTPUT_IMAGE))
|| (_depth_format != icetImageGetDepthFormat(OUTPUT_IMAGE))
if (_color_format != icetImageGetColorFormat(OUTPUT_IMAGE)) {
icetRaiseError("Input/output buffers have different color formats.",
ICET_SANITY_CHECK_FAIL);
}
if (_depth_format != icetImageGetDepthFormat(OUTPUT_IMAGE)) {
icetRaiseError("Input/output buffers have different depth formats.",
ICET_SANITY_CHECK_FAIL);
}
#ifdef PIXEL_COUNT
|| (_pixel_count != PIXEL_COUNT)
if (_pixel_count != PIXEL_COUNT) {
icetRaiseError("Unexpected input pixel count.",
ICET_SANITY_CHECK_FAIL);
}
#else
|| (_pixel_count != icetImageGetNumPixels(OUTPUT_IMAGE))
if (_pixel_count != icetImageGetNumPixels(OUTPUT_IMAGE)) {
icetRaiseError("Unexpected input pixel count.",
ICET_SANITY_CHECK_FAIL);
}
#endif
#ifdef OFFSET
|| (_pixel_count > icetImageGetNumPixels(OUTPUT_IMAGE) - OFFSET)
#endif
)
{
icetRaiseError("Input/output buffers do not agree for decompression.",
if (_pixel_count > icetImageGetNumPixels(OUTPUT_IMAGE) - OFFSET) {
icetRaiseError("Offset pixels outside range of output image.",
ICET_SANITY_CHECK_FAIL);
}
#endif
if (_composite_mode == ICET_COMPOSITE_MODE_Z_BUFFER) {
if (_depth_format == ICET_IMAGE_DEPTH_FLOAT) {
......
......@@ -20,6 +20,10 @@
#include <signal.h>
#ifndef WIN32
#include <unistd.h>
#endif
static IceTEnum currentError = ICET_NO_ERROR;
static IceTEnum currentLevel;
......@@ -125,5 +129,9 @@ void icetDiagnostics(IceTBitField mask)
void icetDebugBreak(void)
{
#if 0
printf("Waiting for debugger in process %d\n", getpid());
sleep(100);
#endif
raise(SIGSEGV);
}
......@@ -219,6 +219,8 @@ 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
#define ICET_SINGLE_IMAGE_STRATEGY_BSWAP_FOLDING (IceTEnum)0x7006
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;
......
......@@ -13,14 +13,18 @@
#include <IceTDevDiagnostics.h>
#include <IceTDevImage.h>
#include <string.h>
#define BSWAP_INCOMING_IMAGES_BUFFER ICET_SI_STRATEGY_BUFFER_0
#define BSWAP_OUTGOING_IMAGES_BUFFER ICET_SI_STRATEGY_BUFFER_1
#define BSWAP_SPARE_WORKING_IMAGE_BUFFER ICET_SI_STRATEGY_BUFFER_2
#define BSWAP_IMAGE_ARRAY ICET_SI_STRATEGY_BUFFER_3
#define BSWAP_DUMMY_ARRAY ICET_SI_STRATEGY_BUFFER_4
#define BSWAP_COMPOSE_GROUP_BUFFER ICET_SI_STRATEGY_BUFFER_5
#define BSWAP_SWAP_IMAGES 21
#define BSWAP_TELESCOPE 22
#define BSWAP_FOLD 23
#define BIT_REVERSE(result, x, max_val_plus_one) \
{ \
......@@ -554,7 +558,7 @@ static void bswapComposeNoCombine(const IceTInt *compose_group,
input_image = working_image;
available_image = icetSparseImageNull();
}
/* I am part of the lower group. Do the actual binary swap. */
bswapComposePow2(compose_group,
......@@ -594,7 +598,7 @@ void icetBswapCompose(const IceTInt *compose_group,
IceTSparseImage *result_image,
IceTSizeType *piece_offset)
{
icetRaiseDebug("In bswapCompose");
icetRaiseDebug("In binary-swap compose");
/* Remove warning about unused parameter. Binary swap leaves images evenly
* partitioned, so we have no use of the image_dest parameter. */
......@@ -608,3 +612,141 @@ void icetBswapCompose(const IceTInt *compose_group,
result_image,
piece_offset);
}
void icetBswapFoldingCompose(const IceTInt *compose_group,
IceTInt group_size,
IceTInt image_dest,
IceTSparseImage input_image,
IceTSparseImage *result_image,
IceTSizeType *piece_offset)
{
IceTInt group_rank = icetFindMyRankInGroup(compose_group, group_size);
IceTInt pow2size = bswapFindPower2(group_size);
IceTInt extra_proc = group_size - pow2size;
IceTBoolean use_interlace;
IceTSparseImage working_image;
IceTSparseImage available_image;
IceTSparseImage spare_image;
IceTSizeType total_num_pixels = icetSparseImageGetNumPixels(input_image);
IceTInt *pow2group;
icetRaiseDebug("In binary-swap folding compose");
(void)image_dest; /* not used */
if (group_size < 2) {
*result_image = input_image;
*piece_offset = 0;
return;
}
/* Interlace images when requested. */
use_interlace = (pow2size > 2) && icetIsEnabled(ICET_INTERLACE_IMAGES);
if (use_interlace) {
IceTSparseImage interlaced_image = icetGetStateBufferSparseImage(
BSWAP_SPARE_WORKING_IMAGE_BUFFER,
icetSparseImageGetWidth(input_image),
icetSparseImageGetHeight(input_image));
icetSparseImageInterlace(input_image,
pow2size,
BSWAP_DUMMY_ARRAY,
interlaced_image);
working_image = interlaced_image;
available_image = input_image;
} else {
/* Allocate available (scratch) image buffer. */
available_image = icetGetStateBufferSparseImage(
BSWAP_SPARE_WORKING_IMAGE_BUFFER,
icetSparseImageGetWidth(input_image),
icetSparseImageGetHeight(input_image));
working_image = input_image;
}
/* Fold the existing number of processes into a subset that is the maximum
* power of 2. */
pow2group = icetGetStateBuffer(BSWAP_COMPOSE_GROUP_BUFFER,
sizeof(IceTInt)*pow2size);
{
IceTInt whole_group_index = 0;
IceTInt pow2group_index = 0;
while (pow2group_index < extra_proc) {
pow2group[pow2group_index] = compose_group[whole_group_index];
if (group_rank == whole_group_index) {
/* I need to receive a folded image and composite it. */
IceTSizeType incoming_size
= icetSparseImageBufferSize(total_num_pixels, 1);
IceTVoid *in_image_buffer
= icetGetStateBuffer(BSWAP_INCOMING_IMAGES_BUFFER,
incoming_size);
IceTSparseImage in_image;
IceTSparseImage old_working_image;
icetCommRecv(in_image_buffer,
incoming_size,
ICET_BYTE,
compose_group[whole_group_index+1],
BSWAP_FOLD);
in_image = icetSparseImageUnpackageFromReceive(in_image_buffer);
icetCompressedCompressedComposite(working_image,
in_image,
available_image);
old_working_image = working_image;
working_image = available_image;
available_image = old_working_image;
} else if (group_rank == whole_group_index + 1) {
/* I need to send my image to get folded then drop out. */
IceTVoid *package_buffer;
IceTSizeType package_size;
icetSparseImagePackageForSend(working_image,
&package_buffer, &package_size);
icetCommSend(package_buffer,
package_size,
ICET_BYTE,
compose_group[whole_group_index],
BSWAP_FOLD);
*result_image = icetSparseImageNull();
*piece_offset = 0;
return;
}
whole_group_index += 2;
pow2group_index++;
}
/* That handles all the folded images. The rest of the group can just
* copy over. Do a sanity check too to make sure that we haven't messed
* up our indexing. */
if ((group_size - whole_group_index) != (pow2size - pow2group_index)) {
icetRaiseError("Miscounted indices while folding.",
ICET_SANITY_CHECK_FAIL);
}
memcpy(&pow2group[pow2group_index],
&compose_group[whole_group_index],
sizeof(IceTInt)*(group_size-whole_group_index));
}
/* Time to do the actual binary-swap on our new power of two group. */
bswapComposePow2(pow2group,
pow2size,
pow2size,
working_image,
available_image,
result_image,
piece_offset,
&spare_image);
if (use_interlace) {
IceTInt global_partition;
IceTInt pow2rank = icetFindMyRankInGroup(pow2group, pow2size);
BIT_REVERSE(global_partition, pow2rank, pow2size);
*piece_offset = icetGetInterlaceOffset(global_partition,
pow2size,
total_num_pixels);
}
}
......@@ -30,6 +30,8 @@
#include <IceTDevDiagnostics.h>
#include <IceTDevImage.h>
/* #define RADIXK_USE_TELESCOPE */
#define RADIXK_SWAP_IMAGE_TAG_START 2200
#define RADIXK_TELESCOPE_IMAGE_TAG 2300
......@@ -91,6 +93,7 @@ typedef struct radixkPartnerInfoStruct {
} \
}
#ifdef RADIXK_USE_TELESCOPE
/* Finds the largest power of 2 equal to or smaller than x. */
static IceTInt radixkFindPower2(IceTInt x)
{
......@@ -99,6 +102,7 @@ static IceTInt radixkFindPower2(IceTInt x)
pow2 = pow2 >> 1;
return pow2;
}
#endif
static IceTInt radixkFindFloorPow2(IceTInt x)
{
......@@ -784,14 +788,13 @@ static void radixkCompositeIncomingImages(radixkPartnerInfo *partners,
}
}
static void icetRadixkBasicCompose(const IceTInt *compose_group,
static void icetRadixkBasicCompose(const radixkInfo *info,
const IceTInt *compose_group,
IceTInt group_size,
IceTInt total_num_partitions,
IceTSparseImage working_image,
IceTSizeType *piece_offset)
{
radixkInfo info = { NULL, 0 };
IceTSizeType my_offset;
IceTInt current_round;
IceTInt remaining_partitions;
......@@ -812,10 +815,8 @@ static void icetRadixkBasicCompose(const IceTInt *compose_group,
return;
}
info = radixkGetK(group_size, group_rank);
/* num_rounds > 0 is assumed several places throughout this function */
if (info.num_rounds <= 0) {
if (info->num_rounds <= 0) {
icetRaiseError("Radix-k has no rounds?", ICET_SANITY_CHECK_FAIL);
}
......@@ -826,9 +827,9 @@ static void icetRadixkBasicCompose(const IceTInt *compose_group,
my_offset = 0;
remaining_partitions = total_num_partitions;
for (current_round = 0; current_round < info.num_rounds; current_round++) {
for (current_round = 0; current_round < info->num_rounds; current_round++) {
IceTSizeType my_size = icetSparseImageGetNumPixels(working_image);
const radixkRoundInfo *round_info = &info.rounds[current_round];
const radixkRoundInfo *round_info = &info->rounds[current_round];
radixkPartnerInfo *partners = radixkGetPartners(round_info,
remaining_partitions,
compose_group,
......@@ -875,6 +876,8 @@ static void icetRadixkBasicCompose(const IceTInt *compose_group,
return;
}
#ifdef RADIXK_USE_TELESCOPE
static IceTInt icetRadixkTelescopeFindUpperGroupSender(
const IceTInt *my_group,
IceTInt my_group_size,
......@@ -971,9 +974,15 @@ static void icetRadixkTelescopeComposeReceive(const IceTInt *my_group,
{
IceTSparseImage working_image = input_image;
IceTInt upper_sender;
radixkInfo info;
IceTInt my_group_rank;
my_group_rank = icetFindMyRankInGroup(my_group, my_group_size);
info = radixkGetK(my_group_size, my_group_rank);
/* Start with the basic compose of my group. */
icetRadixkBasicCompose(my_group,
icetRadixkBasicCompose(&info,
my_group,
my_group_size,
total_num_partitions,
working_image,
......@@ -1206,7 +1215,7 @@ static void icetRadixkTelescopeCompose(const IceTInt *compose_group,
/* Here is a convenient place to determine the final number of
partitions. */
{
/* Middle argument does not matter. */
/* Group rank does not matter for our purposes. */
radixkInfo info = radixkGetK(main_group_size, 0);
total_num_partitions = radixkGetTotalNumPartitions(&info);
}
......@@ -1280,12 +1289,11 @@ static void icetRadixkTelescopeCompose(const IceTInt *compose_group,
return;
}
info = radixkGetK(main_group_size,
main_group_rank);
info = radixkGetK(main_group_size, main_group_rank);
global_partition = radixkGetFinalPartitionIndex(&info);
*piece_offset = icetGetInterlaceOffset(global_partition,
main_group_size,
total_num_partitions,
original_image_size);
}
......@@ -1293,6 +1301,7 @@ static void icetRadixkTelescopeCompose(const IceTInt *compose_group,
}
void icetRadixkCompose(const IceTInt *compose_group,
IceTInt group_size,
IceTInt image_dest,
......@@ -1308,6 +1317,59 @@ void icetRadixkCompose(const IceTInt *compose_group,
piece_offset);
}
#else
void icetRadixkCompose(const IceTInt *compose_group,
IceTInt group_size,
IceTInt image_dest,
IceTSparseImage input_image,
IceTSparseImage *result_image,
IceTSizeType *piece_offset)
{
IceTInt group_rank = icetFindMyRankInGroup(compose_group, group_size);
radixkInfo info = radixkGetK(group_size, group_rank);
IceTInt total_num_partitions = radixkGetTotalNumPartitions(&info);
IceTBoolean use_interlace = icetIsEnabled(ICET_INTERLACE_IMAGES);
IceTSparseImage working_image = input_image;
IceTSizeType original_image_size = icetSparseImageGetNumPixels(input_image);
(void)image_dest; /* Not used. */
if (use_interlace) {
use_interlace = (info.num_rounds > 1);
}
if (use_interlace) {
IceTSparseImage interlaced_image = icetGetStateBufferSparseImage(
RADIXK_INTERLACED_IMAGE_BUFFER,
icetSparseImageGetWidth(working_image),
icetSparseImageGetHeight(working_image));
icetSparseImageInterlace(working_image,
total_num_partitions,
RADIXK_SPLIT_OFFSET_ARRAY_BUFFER,
interlaced_image);
working_image = interlaced_image;
}
icetRadixkBasicCompose(&info,
compose_group,
group_size,
total_num_partitions,
working_image,
piece_offset);
*result_image = working_image;
if (use_interlace && (0 < icetSparseImageGetNumPixels(working_image))) {
IceTInt global_partition = radixkGetFinalPartitionIndex(&info);
*piece_offset = icetGetInterlaceOffset(global_partition,
total_num_partitions,
original_image_size);
}
}
#endif
static IceTBoolean radixkTryPartitionLookup(IceTInt group_size)
{
IceTInt *partition_assignments;
......@@ -1422,6 +1484,8 @@ ICET_EXPORT IceTBoolean icetRadixkPartitionLookupUnitTest(void)
return ICET_TRUE;
}
#ifdef RADIXK_USE_TELESCOPE
#define MAIN_GROUP_RANK(idx) (10000 + idx)
#define SUB_GROUP_RANK(idx) (20000 + idx)
static IceTBoolean radixkTryTelescopeSendReceive(IceTInt *main_group,
......@@ -1495,7 +1559,7 @@ static IceTBoolean radixkTryTelescopeSendReceive(IceTInt *main_group,
return ICET_TRUE;
}
ICET_EXPORT IceTBoolean icetRadixTelescopeSendReceiveTest(void)
ICET_EXPORT IceTBoolean icetRadixkTelescopeSendReceiveTest(void)
{
IceTInt main_group_size;
......@@ -1556,3 +1620,13 @@ ICET_EXPORT IceTBoolean icetRadixTelescopeSendReceiveTest(void)
return ICET_TRUE;
}
#else /*!RADIXK_USE_TELESCOPE*/
ICET_EXPORT IceTBoolean icetRadixkTelescopeSendReceiveTest(void)
{
/* Telescope method disabled. */
return ICET_TRUE;
}
#endif /*!RADIXK_USE_TELESCOPE*/
This diff is collapsed.
......@@ -34,6 +34,12 @@ extern void icetBswapCompose(const IceTInt *compose_group,
IceTSparseImage input_image,
IceTSparseImage *result_image,
IceTSizeType *piece_offset);
void icetBswapFoldingCompose(const IceTInt *compose_group,
IceTInt group_size,
IceTInt image_dest,
IceTSparseImage input_image,
IceTSparseImage *result_image,
IceTSizeType *piece_offset);
extern void icetTreeCompose(const IceTInt *compose_group,
IceTInt group_size,
IceTInt image_dest,
......@@ -46,6 +52,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 +144,8 @@ 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:
case ICET_SINGLE_IMAGE_STRATEGY_BSWAP_FOLDING:
return ICET_TRUE;
default:
return ICET_FALSE;
......@@ -145,6 +159,8 @@ 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";
case ICET_SINGLE_IMAGE_STRATEGY_BSWAP_FOLDING: return "Folded Binary Swap";
default:
icetRaiseError("Invalid single image strategy.", ICET_INVALID_ENUM);
return "<Invalid>";
......@@ -195,6 +211,22 @@ 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;
case ICET_SINGLE_IMAGE_STRATEGY_BSWAP_FOLDING:
icetBswapFoldingCompose(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
......
......@@ -86,7 +86,8 @@ static int OddProcessCountsTryCollectOptions(void)
icetGetIntegerv(ICET_SINGLE_IMAGE_STRATEGY, &si_strategy);
if (si_strategy == ICET_SINGLE_IMAGE_STRATEGY_RADIXK) {
if ((si_strategy == ICET_SINGLE_IMAGE_STRATEGY_RADIXK)
|| (si_strategy == ICET_SINGLE_IMAGE_STRATEGY_RADIXKR)) {
IceTInt rank;
IceTInt num_proc;
IceTInt magic_k;
......
......@@ -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);
}
......@@ -117,6 +117,7 @@ static IceTBoolean g_do_image_split_study;
static IceTInt g_min_image_split;
static IceTBoolean g_do_scaling_study_factor_2;
static IceTBoolean g_do_scaling_study_factor_2_3;
static IceTInt g_num_scaling_study_random;
static float g_color[4];
......@@ -141,7 +142,9 @@ static void usage(char *argv[])
printstat(" -vtree Use the virtual trees strategy.\n");
printstat(" -sequential Use the sequential strategy.\n");
printstat(" -bswap Use the binary-swap single-image strategy.\n");
printstat(" -bswapfold Use the binary-swap with folding single-image strategy.\n");
printstat(" -radixk Use the radix-k single-image strategy.\n");
printstat(" -radixkr Use the radix-kr single-image strategy.\n");
printstat(" -tree Use the tree single-image strategy.\n");
printstat(" -magic-k-study <num> Use the radix-k single-image strategy and repeat for\n"
" multiple values of k, up to <num>, doubling each time.\n");
......@@ -153,6 +156,10 @@ static void usage(char *argv[])
" process counts that are a factor of 2 plus all process\n"
" counts that are a factor of 3 plus most process counts\n"
" that have factors of 2 and 3.\n");
printstat(" -scaling-study-random <num> Picks a random number to bifurcate the\n"
" processes and runs the compositing on each of them. This\n"
" experiment is run <num> times. Run enough times this test\n"
" should give performance over scales at odd process counts.\n");
printstat(" -h, -help Print this help message.\n");
printstat("\nFor general testing options, try -h or -help before test name.\n");
}
......@@ -182,6 +189,7 @@ static void parse_arguments(int argc, char *argv[])
g_min_image_split = 0;
g_do_scaling_study_factor_2 = ICET_FALSE;
g_do_scaling_study_factor_2_3 = ICET_FALSE;
g_num_scaling_study_random = 0;
for (arg = 1; arg < argc; arg++) {
if (strcmp(argv[arg], "-tilesx") == 0) {
......@@ -225,24 +233,31 @@ static void parse_arguments(int argc, char *argv[])
g_strategy = ICET_STRATEGY_SEQUENTIAL;
} else if (strcmp(argv[arg], "-bswap") == 0) {
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_BSWAP;
} else if (strcmp(argv[arg], "-bswapfold") == 0) {
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_BSWAP_FOLDING;
} else if (strcmp(argv[arg], "-radixk") == 0) {
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_RADIXK;
} else if (strcmp(argv[arg], "-radixkr") == 0) {
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_RADIXKR;
} else if (strcmp(argv[arg], "-tree") == 0) {
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_TREE;
} else if (strcmp(argv[arg], "-magic-k-study") == 0) {
g_do_magic_k_study = ICET_TRUE;
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_RADIXK;
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_RADIXKR;
arg++;
g_max_magic_k = atoi(argv[arg]);
} else if (strcmp(argv[arg], "-max-image-split-study") == 0) {
g_do_image_split_study = ICET_TRUE;
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_RADIXK;
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_RADIXKR;
arg++;
g_min_image_split = atoi(argv[arg]);
} else if (strcmp(argv[arg], "-scaling-study-factor-2") == 0) {
g_do_scaling_study_factor_2 = ICET_TRUE;
} else if (strcmp(argv[arg], "-scaling-study-factor-2-3") == 0) {
g_do_scaling_study_factor_2_3 = ICET_TRUE;
} else if (strcmp(argv[arg], "-scaling-study-random") == 0) {
arg++;
g_num_scaling_study_random = atoi(argv[arg]);
} else if ( (strcmp(argv[arg], "-h") == 0)
|| (strcmp(argv[arg], "-help")) ) {
usage(argv);
......@@ -1099,6 +1114,13 @@ static int SimpleTimingDoRender()
icetGetIntegerv(ICET_MAGIC_K, &magic_k);
sprintf(name_buffer, "radix-k %d", (int)magic_k);
si_strategy_name = name_buffer;
} else if (g_single_image_strategy == ICET_SINGLE_IMAGE_STRATEGY_RADIXKR) {
static char name_buffer[256];
IceTInt magic_k;
icetGetIntegerv(ICET_MAGIC_K, &magic_k);
sprintf(name_buffer, "radix-kr %d", (int)magic_k);
si_strategy_name = name_buffer;
} else {
si_strategy_name = icetGetSingleImageStrategyName();
}
......@@ -1615,6 +1637,69 @@ static int SimpleTimingDoScalingStudyFactor2_3()
return worst_result;
}
static int SimpleTimingDoScalingStudyRandom()
{
IceTInt size;
IceTInt rank;
IceTInt min_size = g_num_tiles_x*g_num_tiles_y;
IceTContext original_context = icetGetContext();
int worst_result = TEST_PASSED;
IceTInt trial;
IceTInt *pivots;
icetGetIntegerv(ICET_NUM_PROCESSES, &size);
icetGetIntegerv(ICET_RANK, &rank);
/* Choose pivot points to bifurcate processes. Do them all at once here
* so the psudorandom numbers do not interfear with those choosen during
* the rendering. */
pivots = malloc(sizeof(IceTInt)*g_num_scaling_study_random);
srand(g_seed);
for (trial = 0; trial < g_num_scaling_study_random; trial++) {
pivots[trial] = rand()%size;
}
for (trial = 0; trial < g_num_scaling_study_random; trial++) {
IceTCommunicator left_comm;
IceTCommunicator right_comm;
IceTInt left_size;
IceTInt right_size