Commit 386ca43a authored by Kenneth Moreland's avatar Kenneth Moreland

Print most messages in tests on rank 0 only.

Messages that print everywhere should also report from what process
they come from.
parent e3678bff
......@@ -17,7 +17,7 @@
static void draw(void)
{
printf("In draw\n");
printstat("In draw\n");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glBegin(GL_QUADS);
......@@ -26,7 +26,7 @@ static void draw(void)
glVertex3d(0.5, 0.5, 0.0);
glVertex3d(-0.5, 0.5, 0.0);
glEnd();
printf("Leaving draw\n");
printstat("Leaving draw\n");
}
static int BlankTilesDoTest(void)
......@@ -43,7 +43,7 @@ static int BlankTilesDoTest(void)
IceTSizeType my_width = -1;
IceTSizeType my_height = -1;
IceTImage image;
printf("\nRunning on a %d x %d display.\n", tile_dim, tile_dim);
printstat("\nRunning on a %d x %d display.\n", tile_dim, tile_dim);
icetResetTiles();
for (y = 0; y < tile_dim; y++) {
for (x = 0; x < tile_dim; x++) {
......@@ -63,7 +63,7 @@ static int BlankTilesDoTest(void)
}
}
printf("Rendering frame.\n");
printstat("Rendering frame.\n");
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1, tile_dim*2-1, -1, tile_dim*2-1, -1, 1);
......@@ -73,28 +73,28 @@ static int BlankTilesDoTest(void)
swap_buffers();
if (rank == 0) {
printf("Rank == 0, tile should have stuff in it.\n");
printrank("Rank == 0, tile should have stuff in it.\n");
} else if (rank < tile_dim*tile_dim) {
IceTUByte *cb;
int pixel;
if ( (my_width != icetImageGetWidth(image))
|| (my_height != icetImageGetHeight(image)) ) {
printf("Image size is wrong!!!!!!!!!\n");
printrank("Image size is wrong!!!!!!!!!\n");
result = TEST_FAILED;
}
printf("Checking returned image data.\n");
printrank("Checking returned image data.\n");
cb = icetImageGetColorub(image);
for (pixel = 0; pixel < my_width*my_height*4; pixel++) {
if (cb[pixel] != 0) {
printf("Found bad pixel!!!!!!!!\n");
printrank("Found bad pixel!!!!!!!!\n");
result = TEST_FAILED;
break;
}
}
} else {
printf("Not a display node. Not testing image.\n");
printrank("Not a display node. Not testing image.\n");
}
}
......@@ -121,7 +121,7 @@ static int BlankTilesRun()
int num_single_image_strategy;
icetStrategy(strategy);
printf("\n\nUsing %s strategy.\n", icetGetStrategyName());
printstat("\n\nUsing %s strategy.\n", icetGetStrategyName());
if (strategy_uses_single_image_strategy(strategy)) {
num_single_image_strategy = SINGLE_IMAGE_STRATEGY_LIST_SIZE;
......@@ -138,8 +138,8 @@ static int BlankTilesRun()
int test_result;
icetSingleImageStrategy(single_image_strategy);
printf("Using %s single image sub-strategy.\n",
icetGetSingleImageStrategyName());
printstat("Using %s single image sub-strategy.\n",
icetGetSingleImageStrategyName());
test_result = BlankTilesDoTest();
if (test_result != TEST_PASSED) {
......
......@@ -33,9 +33,9 @@ static void PrintMatrix(float *mat)
for (c = 0; c < 4; c++) {
for (r = 0; r < 4; r++) {
printf("%f ", mat[4*r + c]);
printstat("%f ", mat[4*r + c]);
}
printf("\n");
printstat("\n");
}
}
......@@ -75,10 +75,10 @@ static int BoundsBehindViewerRun()
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 2.0);
printf("Modelview matrix:\n");
printstat("Modelview matrix:\n");
glGetFloatv(GL_MODELVIEW_MATRIX, mat);
PrintMatrix(mat);
printf("Projection matrix:\n");
printstat("Projection matrix:\n");
glGetFloatv(GL_PROJECTION_MATRIX, mat);
PrintMatrix(mat);
......@@ -96,7 +96,7 @@ static int BoundsBehindViewerRun()
if (rank == 0) {
IceTUInt *cb = icetImageGetColorui(image);
if (cb[0] != 0xFFFFFFFF) {
printf("First pixel in color buffer wrong: 0x%x\n", cb[0]);
printstat("First pixel in color buffer wrong: 0x%x\n", cb[0]);
return TEST_FAILED;
}
}
......
This diff is collapsed.
......@@ -28,9 +28,9 @@ static int global_result;
static void draw(void)
{
printf("In draw\n");
printrank("In draw\n");
if (global_rank == 0) {
printf("ERROR: Draw called on rank 0!\n");
printrank("ERROR: Draw called on rank 0!\n");
global_result = TEST_FAILED;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
......@@ -42,12 +42,12 @@ static void draw(void)
glVertex3d(-1.0, 1.0, 0.0);
glEnd();
}
printf("Leaving draw\n");
printrank("Leaving draw\n");
}
static void DisplayNoDrawInit(void)
{
printf("Setting tile.");
printstat("Setting tile.");
icetResetTiles();
icetAddTile(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
......@@ -81,7 +81,7 @@ static void DisplayNoDrawDoTest(void)
IceTImage image;
IceTUByte *color_buffer;
printf("Blank image is rank %d\n", global_iteration);
printstat("Blank image is rank %d\n", global_iteration);
image = icetGLDrawFrame();
swap_buffers();
......@@ -94,13 +94,13 @@ static void DisplayNoDrawDoTest(void)
&& ((global_num_proc > 2) || (global_iteration != 1)) ) {
int p;
int bad_count = 0;
printf("Checking pixels.\n");
printrank("Checking pixels.\n");
color_buffer = icetImageGetColorub(image);
for (p = 0;
(p < SCREEN_WIDTH*SCREEN_HEIGHT*4) && (bad_count < 10); p++) {
if (color_buffer[p] != 255) {
printf("BAD PIXEL %d.%d\n", p/4, p%4);
printf(" Expected 255, got %d\n", color_buffer[p]);
printrank("BAD PIXEL %d.%d\n", p/4, p%4);
printrank(" Expected 255, got %d\n", color_buffer[p]);
bad_count++;
}
}
......@@ -124,7 +124,7 @@ static int DisplayNoDrawRun(void)
icetGetIntegerv(ICET_RANK, &global_rank);
icetGetIntegerv(ICET_NUM_PROCESSES, &global_num_proc);
printf("Starting DisplayNoDraw.\n");
printstat("Starting DisplayNoDraw.\n");
global_result = TEST_PASSED;
......@@ -137,7 +137,7 @@ static int DisplayNoDrawRun(void)
int num_single_image_strategy;
icetStrategy(strategy);
printf("\n\nUsing %s strategy.\n", icetGetStrategyName());
printstat("\n\nUsing %s strategy.\n", icetGetStrategyName());
if (strategy_uses_single_image_strategy(strategy)) {
num_single_image_strategy = SINGLE_IMAGE_STRATEGY_LIST_SIZE;
......@@ -153,8 +153,8 @@ static int DisplayNoDrawRun(void)
= single_image_strategy_list[single_image_strategy_index];
icetSingleImageStrategy(single_image_strategy);
printf("Using %s single image sub-strategy.\n",
icetGetSingleImageStrategyName());
printstat("Using %s single image sub-strategy.\n",
icetGetSingleImageStrategyName());
DisplayNoDrawDoTest();
}
......
......@@ -73,7 +73,7 @@ static void LowerTriangleImage(IceTImage image)
} else if (icetImageGetColorFormat(image) == ICET_IMAGE_COLOR_NONE) {
/* Do nothing. */
} else {
printf("ERROR: Encountered unknown color format.");
printrank("ERROR: Encountered unknown color format.");
}
if (icetImageGetDepthFormat(image) == ICET_IMAGE_DEPTH_FLOAT) {
......@@ -91,7 +91,7 @@ static void LowerTriangleImage(IceTImage image)
} else if (icetImageGetDepthFormat(image) == ICET_IMAGE_DEPTH_NONE) {
/* Do nothing. */
} else {
printf("ERROR: Encountered unknown depth format.");
printrank("ERROR: Encountered unknown depth format.");
}
}
......@@ -124,7 +124,7 @@ static void FullImage(IceTImage image)
} else if (icetImageGetColorFormat(image) == ICET_IMAGE_COLOR_NONE) {
/* Do nothing. */
} else {
printf("ERROR: Encountered unknown color format.");
printrank("ERROR: Encountered unknown color format.");
}
if (icetImageGetDepthFormat(image) == ICET_IMAGE_DEPTH_FLOAT) {
......@@ -138,7 +138,7 @@ static void FullImage(IceTImage image)
} else if (icetImageGetDepthFormat(image) == ICET_IMAGE_DEPTH_NONE) {
/* Do nothing. */
} else {
printf("ERROR: Encountered unknown depth format.");
printrank("ERROR: Encountered unknown depth format.");
}
}
......@@ -155,13 +155,13 @@ static IceTBoolean CompareImageColors(const IceTImage image_a,
IceTSizeType y;
if (icetImageGetColorFormat(image_a) != icetImageGetColorFormat(image_b)) {
printf("ERROR: Image formats do not match.\n");
printrank("ERROR: Image formats do not match.\n");
return ICET_FALSE;
}
if ( (icetImageGetWidth(image_a) != icetImageGetWidth(image_b))
|| (icetImageGetHeight(image_a) != icetImageGetHeight(image_b)) ) {
printf("ERROR: Images have different dimensions.\n");
printrank("ERROR: Images have different dimensions.\n");
return ICET_FALSE;
}
......@@ -185,11 +185,11 @@ static IceTBoolean CompareImageColors(const IceTImage image_a,
|| (data_a[1] != data_b[1])
|| (data_a[2] != data_b[2])
|| (data_a[3] != data_b[3]) ) {
printf("ERROR: Encountered bad pixel @ (%d,%d).\n", x, y);
printf("Expected (%d, %d, %d, %d)\n",
data_a[0], data_a[1], data_a[2], data_a[3]);
printf("Got (%d, %d, %d, %d)\n",
data_b[0], data_b[1], data_b[2], data_b[3]);
printrank("ERROR: Encountered bad pixel @ (%d,%d).\n", x, y);
printrank("Expected (%d, %d, %d, %d)\n",
data_a[0], data_a[1], data_a[2], data_a[3]);
printrank("Got (%d, %d, %d, %d)\n",
data_b[0], data_b[1], data_b[2], data_b[3]);
return ICET_FALSE;
}
data_a += 4;
......@@ -216,13 +216,13 @@ static IceTBoolean CompareImageDepths(const IceTImage image_a,
IceTSizeType y;
if (icetImageGetDepthFormat(image_a) != icetImageGetDepthFormat(image_b)) {
printf("ERROR: Image formats do not match.\n");
printrank("ERROR: Image formats do not match.\n");
return ICET_FALSE;
}
if ( (icetImageGetWidth(image_a) != icetImageGetWidth(image_b))
|| (icetImageGetHeight(image_a) != icetImageGetHeight(image_b)) ) {
printf("ERROR: Images have different dimensions.\n");
printrank("ERROR: Images have different dimensions.\n");
return ICET_FALSE;
}
......@@ -243,8 +243,8 @@ static IceTBoolean CompareImageDepths(const IceTImage image_a,
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
if (data_a[0] != data_b[0]) {
printf("ERROR: Encountered bad pixel @ (%d,%d).\n", x, y);
printf("Expected %f, got %f\n", data_a[0], data_b[0]);
printrank("ERROR: Encountered bad pixel @ (%d,%d).\n", x, y);
printrank("Expected %f, got %f\n", data_a[0], data_b[0]);
return ICET_FALSE;
}
data_a++;
......@@ -307,13 +307,13 @@ static int TestInterlaceSplit(const IceTImage image)
icetCompressImage(image, original_sparse);
printf("Interlacing image for %d pieces\n", NUM_PARTITIONS);
printstat("Interlacing image for %d pieces\n", NUM_PARTITIONS);
icetSparseImageInterlace(original_sparse,
NUM_PARTITIONS,
ICET_SI_STRATEGY_BUFFER_0,
interlaced_sparse);
printf("Splitting image %d times\n", NUM_PARTITIONS);
printstat("Splitting image %d times\n", NUM_PARTITIONS);
icetSparseImageSplit(interlaced_sparse,
0,
NUM_PARTITIONS,
......@@ -321,7 +321,7 @@ static int TestInterlaceSplit(const IceTImage image)
sparse_partition,
offsets);
printf("Reconstructing image.\n");
printstat("Reconstructing image.\n");
for (partition = 0; partition < NUM_PARTITIONS; partition++) {
IceTSizeType real_offset = icetGetInterlaceOffset(partition,
NUM_PARTITIONS,
......@@ -353,13 +353,13 @@ static int InterlaceRunFormat()
imagebuffer = malloc(icetImageBufferSize(SCREEN_WIDTH, SCREEN_HEIGHT));
image = icetImageAssignBuffer(imagebuffer, SCREEN_WIDTH, SCREEN_HEIGHT);
printf("\n********* Creating lower triangle image\n");
printstat("\n********* Creating lower triangle image\n");
LowerTriangleImage(image);
result = TestInterlaceSplit(image);
if (result != TEST_PASSED) { return result; }
printf("\n********* Creating full image\n");
printstat("\n********* Creating full image\n");
FullImage(image);
result = TestInterlaceSplit(image);
......
......@@ -184,10 +184,10 @@ static int MaxImageSplitCheckImage(const IceTImage image)
for (y = 0; y < PROC_REGION_HEIGHT; y++) {
for (x = 0; x < PROC_REGION_WIDTH; x++) {
if (*pixel != proc) {
printf("**** Found bad pixel!!!! ****\n");
printf("Region for process %d, x = %d, y = %d\n",
proc, x, y);
printf("Reported %d\n", *pixel);
printrank("**** Found bad pixel!!!! ****\n");
printrank("Region for process %d, x = %d, y = %d\n",
proc, x, y);
printrank("Reported %d\n", *pixel);
return TEST_FAILED;
}
pixel++;
......@@ -227,8 +227,8 @@ static int MaxImageSplitTryStrategy()
si_strategy_idx < SINGLE_IMAGE_STRATEGY_LIST_SIZE;
si_strategy_idx++) {
icetSingleImageStrategy(single_image_strategy_list[si_strategy_idx]);
printf(" Trying single image strategy %s\n",
icetGetSingleImageStrategyName());
printstat(" Trying single image strategy %s\n",
icetGetSingleImageStrategyName());
result += MaxImageSplitTryRender();
}
......@@ -250,7 +250,7 @@ static int MaxImageSplitTryMax()
char image_split_string[32];
IceTInt reported_image_split;
printf("Trying max image split of %d\n", max_image_split);
printstat("Trying max image split of %d\n", max_image_split);
sprintf(image_split_string, "%d", max_image_split);
setenv("ICET_MAX_IMAGE_SPLIT", image_split_string, ICET_TRUE);
......@@ -266,7 +266,7 @@ static int MaxImageSplitTryMax()
icetGetIntegerv(ICET_MAX_IMAGE_SPLIT, &reported_image_split);
if (max_image_split != reported_image_split) {
printf("**** Max image split not set correctly!!!! ****\n");
printrank("**** Max image split not set correctly!!!! ****\n");
return TEST_FAILED;
}
......
......@@ -118,14 +118,14 @@ static int OddImageSizesRun(void)
width = c_image_sizes[image_size_index][0];
height = c_image_sizes[image_size_index][1];
printf("\n\nUsing image size %dx%d\n", (int)width, (int)height);
printstat("\n\nUsing image size %dx%d\n", (int)width, (int)height);
for (tile_dimensions = 1;
tile_dimensions*tile_dimensions <= num_proc;
tile_dimensions++) {
int strategy_index;
printf("Using tile dimensions %d\n", tile_dimensions);
printstat("Using tile dimensions %d\n", tile_dimensions);
setup_tiles(tile_dimensions, width, height);
......@@ -137,7 +137,7 @@ static int OddImageSizesRun(void)
int num_single_image_strategy;
icetStrategy(strategy);
printf("Using %s strategy\n", icetGetStrategyName());
printstat("Using %s strategy\n", icetGetStrategyName());
if (strategy_uses_single_image_strategy(strategy)) {
num_single_image_strategy = SINGLE_IMAGE_STRATEGY_LIST_SIZE;
......@@ -153,8 +153,8 @@ static int OddImageSizesRun(void)
single_image_strategy_list[single_image_strategy_index];
icetSingleImageStrategy(single_image_strategy);
printf("Using %s single image sub-strategy.\n",
icetGetSingleImageStrategyName());
printstat("Using %s single image sub-strategy.\n",
icetGetSingleImageStrategyName());
/* Just invoke a frame. I'm more worried about crashing
than other incorrect behavior. */
......
......@@ -97,9 +97,7 @@ static int OddProcessCountsTryCollectOptions(void)
for (magic_k = 2; magic_k <= num_proc; magic_k *= 2) {
IceTInt max_image_split;
if (rank == 0) {
printf(" Using magic k value of %d\n", magic_k);
}
printstat(" Using magic k value of %d\n", magic_k);
icetStateSetInteger(ICET_MAGIC_K, magic_k);
for (max_image_split = 0;
......@@ -107,10 +105,8 @@ static int OddProcessCountsTryCollectOptions(void)
max_image_split += magic_k) {
IceTInt result;
if (rank == 0) {
printf(" Using image split of %d\n",
max_image_split);
}
printstat(" Using image split of %d\n",
max_image_split);
icetStateSetInteger(ICET_MAX_IMAGE_SPLIT, max_image_split);
result = OddProcessCountsTryFrame();
......@@ -144,10 +140,8 @@ static int OddProcessCountsTryStrategy(void)
single_image_strategy_list[single_image_strategy_index];
icetSingleImageStrategy(single_image_strategy);
if (rank == 0) {
printf(" Using %s single image sub-strategy.\n",
icetGetSingleImageStrategyName());
}
printstat(" Using %s single image sub-strategy.\n",
icetGetSingleImageStrategyName());
result = OddProcessCountsTryCollectOptions();
......@@ -180,9 +174,7 @@ static int OddProcessCountsTryCount(void)
IceTInt num_proc = mid_proc + add_proc;
IceTInt result;
if (rank == 0) {
printf(" Using %d processes\n", num_proc);
}
printstat(" Using %d processes\n", num_proc);
if ((max_proc - rank) <= num_proc) {
/* In visible range. */
......
This diff is collapsed.
......@@ -97,30 +97,30 @@ static float g_color[4];
static void usage(char *argv[])
{
printf("\nUSAGE: %s [testargs]\n", argv[0]);
printf("\nWhere testargs are:\n");
printf(" -tilesx <num> Sets the number of tiles horizontal (default 1).\n");
printf(" -tilesy <num> Sets the number of tiles vertical (default 1).\n");
printf(" -frames Sets the number of frames to render (default 2).\n");
printf(" -seed <num> Use the given number as the random seed.\n");
printf(" -transparent Render transparent images. (Uses 4 floats for colors.)\n");
printf(" -colored-background Use a color for the background and correct as necessary.\n");
printf(" -no-interlace Turn off the image interlacing optimization.\n");
printf(" -no-collect Turn off image collection.\n");
printf(" -sync-render Synchronize rendering by adding a barrier to the draw callback.\n");
printf(" -write-image Write an image on the first frame.\n");
printf(" -reduce Use the reduce strategy (default).\n");
printf(" -vtree Use the virtual trees strategy.\n");
printf(" -sequential Use the sequential strategy.\n");
printf(" -bswap Use the binary-swap single-image strategy.\n");
printf(" -radixk Use the radix-k single-image strategy.\n");
printf(" -tree Use the tree single-image strategy.\n");
printf(" -magic-k-study <num> Use the radix-k single-image strategy and repeat for\n"
printstat("\nUSAGE: %s [testargs]\n", argv[0]);
printstat("\nWhere testargs are:\n");
printstat(" -tilesx <num> Sets the number of tiles horizontal (default 1).\n");
printstat(" -tilesy <num> Sets the number of tiles vertical (default 1).\n");
printstat(" -frames Sets the number of frames to render (default 2).\n");
printstat(" -seed <num> Use the given number as the random seed.\n");
printstat(" -transparent Render transparent images. (Uses 4 floats for colors.)\n");
printstat(" -colored-background Use a color for the background and correct as necessary.\n");
printstat(" -no-interlace Turn off the image interlacing optimization.\n");
printstat(" -no-collect Turn off image collection.\n");
printstat(" -sync-render Synchronize rendering by adding a barrier to the draw callback.\n");
printstat(" -write-image Write an image on the first frame.\n");
printstat(" -reduce Use the reduce strategy (default).\n");
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(" -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");
printf(" -max-image-split-study <num> Repeat the test for multiple maximum image\n"
printstat(" -max-image-split-study <num> Repeat the test for multiple maximum image\n"
" splits starting at <num> and doubling each time.\n");
printf(" -h, -help Print this help message.\n");
printf("\nFor general testing options, try -h or -help before test name.\n");
printstat(" -h, -help Print this help message.\n");
printstat("\nFor general testing options, try -h or -help before test name.\n");
}
static void parse_arguments(int argc, char *argv[])
......@@ -196,7 +196,7 @@ static void parse_arguments(int argc, char *argv[])
usage(argv);
exit(0);
} else {
printf("Unknown option `%s'.\n", argv[arg]);
printstat("Unknown option `%s'.\n", argv[arg]);
usage(argv);
exit(1);
}
......@@ -317,7 +317,7 @@ static void draw(const IceTDouble *projection_matrix,
success = icetMatrixInverseTranspose((const IceTDouble *)transform,
inverse_transpose_transform);
if (!success) {
printf("ERROR: Inverse failed.\n");
printrank("ERROR: Inverse failed.\n");
}
for (planeIdx = 0; planeIdx < NUM_HEX_PLANES; planeIdx++) {
......@@ -690,7 +690,7 @@ static int SimpleTimingDoRender()
}
}
} else {
printf("Not enough processes to %dx%d tiles.\n",
printstat("Not enough processes to %dx%d tiles.\n",
g_num_tiles_x, g_num_tiles_y);
return TEST_FAILED;
}
......@@ -717,7 +717,7 @@ static int SimpleTimingDoRender()
/* Initialize randomness. */
if (rank == 0) {
int i;
printf("Seed = %d\n", g_seed);
printstat("Seed = %d\n", g_seed);
for (i = 1; i < num_proc; i++) {
icetCommSend(&g_seed, 1, ICET_INT, i, 33);
}
......
......@@ -93,9 +93,9 @@ static int CompareSparseImages(const IceTSparseImage image0,
if ( icetSparseImageGetCompressedBufferSize(image0)
!= icetSparseImageGetCompressedBufferSize(image1) ) {
printf("Buffer sizes do not match: %d vs %d!\n",
icetSparseImageGetCompressedBufferSize(image0),
icetSparseImageGetCompressedBufferSize(image1));
printrank("Buffer sizes do not match: %d vs %d!\n",
icetSparseImageGetCompressedBufferSize(image0),
icetSparseImageGetCompressedBufferSize(image1));
return TEST_FAILED;
}
......@@ -114,8 +114,8 @@ static int CompareSparseImages(const IceTSparseImage image0,
for (i = 0; i < width*height; i++) {
if (color_buffer[0][i] != color_buffer[1][i]) {
printf("Buffer mismatch at uint %d\n", i);
printf("0x%x vs 0x%x\n", color_buffer[0][i], color_buffer[1][i]);
printrank("Buffer mismatch at uint %d\n", i);
printrank("0x%x vs 0x%x\n", color_buffer[0][i], color_buffer[1][i]);
return TEST_FAILED;
}
}
......@@ -140,7 +140,7 @@ static int TrySparseImageCopyPixels(const IceTImage image,
int result;
printf("Trying sparse image copy from %d to %d\n", start, end);
printstat("Trying sparse image copy from %d to %d\n", start, end);
full_sparse_buffer = malloc(icetSparseImageBufferSize(width, height));
full_sparse = icetSparseImageAssignBuffer(full_sparse_buffer,width,height);
......@@ -176,7 +176,7 @@ static int TestSparseImageCopyPixels(const IceTImage image)
int start, end;
if (height <= 20) {
printf("Need image height greater than 20.\n");
printstat("Need image height greater than 20.\n");
return TEST_NOT_RUN;
}
......@@ -245,7 +245,7 @@ static int TestSparseImageSplit(const IceTImage image)
icetCompressImage(image, full_sparse);
printf("Spliting image %d times\n", NUM_PARTITIONS);
printstat("Spliting image %d times\n", NUM_PARTITIONS);
icetSparseImageSplit(full_sparse,
0,
NUM_PARTITIONS,
......@@ -259,14 +259,14 @@ static int TestSparseImageSplit(const IceTImage image)
icetSparseImageGetNumPixels(
sparse_partition[partition]),
compare_sparse);
printf(" Comparing partition %d\n", partition);
printstat(" Comparing partition %d\n", partition);
result = CompareSparseImages(compare_sparse,
sparse_partition[partition]);
if (result != TEST_PASSED) return result;
}
printf("Spliting image %d times with first partition in place.\n",
NUM_PARTITIONS);
printstat("Spliting image %d times with first partition in place.\n",
NUM_PARTITIONS);
sparse_partition[0] = full_sparse;
icetSparseImageSplit(full_sparse,
0,
......@@ -281,7 +281,7 @@ static int TestSparseImageSplit(const IceTImage image)
icetSparseImageGetNumPixels(
sparse_partition[partition]),
compare_sparse);
printf(" Comparing partition %d\n", partition);
printstat(" Comparing partition %d\n", partition);
result = CompareSparseImages(compare_sparse,
sparse_partition[partition]);
if (result != TEST_PASSED) return result;
......@@ -309,7 +309,7 @@ static int SparseImageCopyRun()
imagebuffer = malloc(icetImageBufferSize(SCREEN_WIDTH, SCREEN_HEIGHT));
image = icetImageAssignBuffer(imagebuffer, SCREEN_WIDTH, SCREEN_HEIGHT);
printf("\n********* Creating lower triangle image\n");
printstat("\n********* Creating lower triangle image\n");
LowerTriangleImage(image);
if (TestSparseImageCopyPixels(image) != TEST_PASSED) {
......@@ -319,7 +319,7 @@ static int SparseImageCopyRun()
return TEST_FAILED;
}
printf("\n********* Creating upper triangle image\n");
printstat("\n********* Creating upper triangle image\n");
UpperTriangleImage(image);
if (TestSparseImageCopyPixels(image) != TEST_PASSED) {
......
......@@ -68,7 +68,7 @@ static void checkOglError(void)
GLenum error = glGetError();
#define CASE_ERROR(ename) \
case ename: printf("## Current IceT error = " #ename "\n"); break;
case ename: printrank("## Current IceT error = " #ename "\n"); break;
switch (error) {
CASE_ERROR(GL_NO_ERROR);
......@@ -82,7 +82,7 @@ static void checkOglError(void)
CASE_ERROR(GL_TABLE_TOO_LARGE);
#endif
default:
printf("## UNKNOWN OPENGL ERROR CODE!!!!!!\n");
printrank("## UNKNOWN OPENGL ERROR CODE!!!!!!\n");
break;
}
......@@ -95,7 +95,7 @@ static void checkIceTError(void)
IceTEnum error = icetGetError();
#define CASE_ERROR(ename) \
case ename: printf("## Current IceT error = " #ename "\n"); break;
case ename: printrank("## Current IceT error = " #ename "\n"); break;
switch (error) {
CASE_ERROR(ICET_NO_ERROR);
......@@ -106,7 +106,7 @@ static void checkIceTError(void)
CASE_ERROR(ICET_INVALID_OPERATION);
CASE_ERROR(ICET_INVALID_VALUE);
default:
printf("## UNKNOWN ICET ERROR CODE!!!!!\n");
printrank("## UNKNOWN ICET ERROR CODE!!!!!\n");
break;
}
......@@ -130,6 +130,35 @@ static void realprintf(const char *fmt, ...)
}
#endif
void printstat(const char *fmt, ...)
{
va_list ap;
IceTInt rank;
icetGetIntegerv(ICET_RANK, &rank);
if ((rank == 0) || (realstdout == NULL)) {
va_start(ap, fmt);