Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit b08211cf authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Add sync render option to simple timing.

I am having trouble getting my crummy rendering routines to load balance
even though they have about the same amount of work to do.  Instead,
punt and add an option that will synchronize the renders so they all
finish at the same time.  When you measure the composite performance,
it will be roughly equivalent to a quick render.
parent c065d051
......@@ -70,14 +70,18 @@ static void init_opacity_lookup(void)
}
}
/* Used to signal the first render of a frame. */
static IceTBoolean g_first_render;
/* Program arguments. */
static int g_num_tiles_x;
static int g_num_tiles_y;
static int g_num_frames;
static int g_seed;
static int g_transparent;
static int g_colored_background;
static int g_write_image;
static IceTInt g_num_tiles_x;
static IceTInt g_num_tiles_y;
static IceTInt g_num_frames;
static IceTInt g_seed;
static IceTBoolean g_transparent;
static IceTBoolean g_colored_background;
static IceTBoolean g_sync_render;
static IceTBoolean g_write_image;
static IceTEnum g_strategy;
static IceTEnum g_single_image_strategy;
......@@ -90,10 +94,11 @@ static void parse_arguments(int argc, char *argv[])
g_num_tiles_x = 1;
g_num_tiles_y = 1;
g_num_frames = 2;
g_seed = (int)time(NULL);
g_transparent = 0;
g_colored_background = 0;
g_write_image = 0;
g_seed = (IceTInt)time(NULL);
g_transparent = ICET_FALSE;
g_colored_background = ICET_FALSE;
g_sync_render = ICET_FALSE;
g_write_image = ICET_FALSE;
g_strategy = ICET_STRATEGY_REDUCE;
g_single_image_strategy = ICET_SINGLE_IMAGE_STRATEGY_AUTOMATIC;
......@@ -111,11 +116,13 @@ static void parse_arguments(int argc, char *argv[])
arg++;
g_seed = atoi(argv[arg]);
} else if (strcmp(argv[arg], "-transparent") == 0) {
g_transparent = 1;
g_transparent = ICET_TRUE;
} else if (strcmp(argv[arg], "-colored-background") == 0) {
g_colored_background = 1;
g_colored_background = ICET_TRUE;
} else if (strcmp(argv[arg], "-sync-render") == 0) {
g_sync_render = ICET_TRUE;
} else if (strcmp(argv[arg], "-write-image") == 0) {
g_write_image = 1;
g_write_image = ICET_TRUE;
} else if (strcmp(argv[arg], "-reduce") == 0) {
g_strategy = ICET_STRATEGY_REDUCE;
} else if (strcmp(argv[arg], "-vtree") == 0) {
......@@ -347,6 +354,25 @@ static void draw(const IceTDouble *projection_matrix,
}
}
}
if (g_first_render) {
if (g_sync_render) {
/* The rendering we are using here is pretty crummy. It is not
meant to be practical but to create reasonable images to
composite. One problem with it is that the render times are not
well balanced even though everyone renders roughly the same sized
object. If you want to time the composite performance, this can
interfere with the measurements. To get around this problem, do
a barrier that makes it look as if all rendering finishes at the
same time. Note that there is a remote possibility that not
every process will render something, in which case this will
deadlock. Note that we make sure only to sync once to get around
the less remote possibility that some, but not all, processes
render more than once. */
icetCommBarrier();
}
g_first_render = ICET_FALSE;
}
}
/* Given the rank of this process in all of them, divides the unit box
......@@ -665,6 +691,7 @@ static int SimpleTimingRun()
/* Instead of calling draw() directly, call it indirectly through
* icetDrawFrame(). IceT will automatically handle image
* compositing. */
g_first_render = ICET_TRUE;
image = icetDrawFrame(projection_matrix,
modelview_matrix,
background_color);
......
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