Commit adbc57b0 authored by Kenneth Moreland's avatar Kenneth Moreland

Add ability to do factor-of-2 scaling studies.

SimpleTiming has an option to try all processor combinations that are
powers of 2 up to the job size. Jobs of small size are run concurrently,
which should speed the overall job time but will probably result in some
communication contention.
parent e611cd8e
......@@ -92,6 +92,7 @@ static IceTBoolean g_do_magic_k_study;
static IceTInt g_max_magic_k;
static IceTBoolean g_do_image_split_study;
static IceTInt g_min_image_split;
static IceTBoolean g_do_scaling_study_factor_2;
static float g_color[4];
......@@ -116,10 +117,12 @@ static void usage(char *argv[])
printstat(" -radixk Use the radix-k 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");
" multiple values of k, up to <num>, doubling each time.\n");
printstat(" -max-image-split-study <num> Repeat the test for multiple maximum image\n"
" splits starting at <num> and doubling each time.\n");
printstat(" -h, -help Print this help message.\n");
" splits starting at <num> and doubling each time.\n");
printstat(" -scaling-study-factor-2 Perform a scaling study for all process counts\n"
" that are a factor of 2.\n");
printstat(" -h, -help Print this help message.\n");
printstat("\nFor general testing options, try -h or -help before test name.\n");
}
......@@ -143,6 +146,7 @@ static void parse_arguments(int argc, char *argv[])
g_max_magic_k = 0;
g_do_image_split_study = ICET_FALSE;
g_min_image_split = 0;
g_do_scaling_study_factor_2 = ICET_FALSE;
for (arg = 1; arg < argc; arg++) {
if (strcmp(argv[arg], "-tilesx") == 0) {
......@@ -191,6 +195,8 @@ static void parse_arguments(int argc, char *argv[])
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_RADIXK;
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], "-h") == 0)
|| (strcmp(argv[arg], "-help")) ) {
usage(argv);
......@@ -910,38 +916,8 @@ static int SimpleTimingDoRender()
return TEST_PASSED;
}
int SimpleTimingRun()
static int SimpleTimingDoParameterStudies()
{
IceTInt rank;
icetGetIntegerv(ICET_RANK, &rank);
if (rank == 0) {
printf("HEADER,"
"num processes,"
"multi-tile strategy,"
"single-image strategy,"
"tiles x,"
"tiles y,"
"width,"
"height,"
"transparent,"
"interlacing,"
"collection,"
"max image split,"
"frame,"
"render time,"
"buffer read time,"
"buffer write time,"
"compress time,"
"blend time,"
"draw time,"
"composite time,"
"collect time,"
"bytes sent,"
"frame time\n");
}
if (g_do_magic_k_study) {
IceTContext original_context = icetGetContext();
IceTInt magic_k;
......@@ -1023,6 +999,133 @@ int SimpleTimingRun()
}
}
static IceTCommunicator MakeCommSubset(IceTInt size, IceTInt offset)
{
IceTInt32 *ranks;
IceTInt rank_index;
IceTCommunicator old_comm;
IceTCommunicator new_comm;
ranks = malloc(size*sizeof(IceTInt32));
for (rank_index = 0; rank_index < size; rank_index++) {
ranks[rank_index] = rank_index + offset;
}
old_comm = icetGetCommunicator();
new_comm = old_comm->Subset(old_comm, size, ranks);
free(ranks);
return new_comm;
}
static int SimpleTimingDoScalingStudyFactor2()
{
IceTInt size;
IceTInt rank;
IceTInt max_power_2;
IceTInt min_size = g_num_tiles_x*g_num_tiles_y;
IceTContext original_context = icetGetContext();
int worst_result = TEST_PASSED;
{
int result = SimpleTimingDoParameterStudies();
if (result != TEST_PASSED) { return result; }
}
icetGetIntegerv(ICET_NUM_PROCESSES, &size);
icetGetIntegerv(ICET_RANK, &rank);
max_power_2 = 1;
while (max_power_2 <= size) { max_power_2 *= 2; }
max_power_2 /= 2;
if ((max_power_2 < size) && (max_power_2 >= min_size)) {
IceTCommunicator new_communicator = MakeCommSubset(max_power_2, 0);
if (rank < max_power_2) {
IceTContext new_context = icetCreateContext(new_communicator);
int result = SimpleTimingDoParameterStudies();
if (result != TEST_PASSED) { worst_result = result; }
icetSetContext(original_context);
icetDestroyContext(new_context);
new_communicator->Destroy(new_communicator);
}
}
{
IceTInt power_2 = max_power_2/2;
IceTInt offset = 0;
IceTBoolean has_group = ICET_FALSE;
IceTCommunicator new_comm;
while (power_2 >= min_size) {
IceTCommunicator try_comm = MakeCommSubset(power_2, offset);
if ((rank >= offset) && (rank < offset+power_2)) {
has_group = ICET_TRUE;
new_comm = try_comm;
}
offset += power_2;
power_2 /= 2;
}
if (has_group) {
IceTContext new_context;
new_context = icetCreateContext(new_comm);
new_comm->Destroy(new_comm);
int result = SimpleTimingDoParameterStudies();
if (result != TEST_PASSED) { worst_result = result; }
icetSetContext(original_context);
icetDestroyContext(new_context);
}
}
return worst_result;
}
static int SimpleTimingDoScalingStudies()
{
if (g_do_scaling_study_factor_2) {
return SimpleTimingDoScalingStudyFactor2();
} else {
return SimpleTimingDoParameterStudies();
}
}
int SimpleTimingRun()
{
IceTInt rank;
icetGetIntegerv(ICET_RANK, &rank);
if (rank == 0) {
printf("HEADER,"
"num processes,"
"multi-tile strategy,"
"single-image strategy,"
"tiles x,"
"tiles y,"
"width,"
"height,"
"transparent,"
"interlacing,"
"collection,"
"max image split,"
"frame,"
"render time,"
"buffer read time,"
"buffer write time,"
"compress time,"
"blend time,"
"draw time,"
"composite time,"
"collect time,"
"bytes sent,"
"frame time\n");
}
return SimpleTimingDoScalingStudies();
}
int SimpleTiming(int argc, char * argv[])
{
parse_arguments(argc, argv);
......
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