Commit 08fb7c03 authored by Kenneth Moreland's avatar Kenneth Moreland

Add a random scaling study to SimpleTiming.

Hopefully this can be used to test odd process group sizes. Randomly
picked group sizes should commonly have large factors.
parent fca94487
......@@ -113,6 +113,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];
......@@ -149,6 +150,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");
}
......@@ -176,6 +181,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) {
......@@ -222,18 +228,21 @@ static void parse_arguments(int argc, char *argv[])
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);
......@@ -1564,6 +1573,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;
IceTInt local_size;
int result;
/* Print out results from last run. */
SimpleTimingCollectAndPrintLog();
left_size = pivots[trial];
right_size = size-left_size;
left_comm = MakeCommSubset(left_size, 0);
right_comm = MakeCommSubset(right_size, left_size);
if (rank < left_size) {
icetCreateContext(left_comm);
left_comm->Destroy(left_comm);
local_size = left_size;
} else {
icetCreateContext(right_comm);
right_comm->Destroy(right_comm);
local_size = right_size;
}
if (local_size > min_size) {
result = SimpleTimingDoParameterStudies();
if (result != TEST_PASSED) { worst_result = result; }
}
icetDestroyContext(icetGetContext());
icetSetContext(original_context);
}
free(pivots);
return worst_result;
}
static int SimpleTimingDoScalingStudies()
{
int result;
......@@ -1575,6 +1647,13 @@ static int SimpleTimingDoScalingStudies()
result = SimpleTimingDoParameterStudies();
}
if (g_num_scaling_study_random > 0) {
int new_result = SimpleTimingDoScalingStudyRandom();
if (new_result != TEST_PASSED) {
result = new_result;
}
}
SimpleTimingCollectAndPrintLog();
return result;
}
......
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