From a3886552003d031acb9039e920b7c9ddce946ad6 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Sat, 17 Oct 2020 14:43:46 -0400 Subject: DIS fixes used for (rejected) RTSS'20 submission - All: Output times to stderr and nothing to stdout - Field, Update, Pointer: change definition of a job to match other stressmark execution times more closely - Matrix: move all allocations into main() - Update: Use volatile to prevent computations from being optimized out - Transitive: Use volatile to prevent computations from being optimized out - Neighborhood: Use working version of drawLineSegment from original DIS sample code --- dis/Field/field.c | 27 +-- dis/Matrix/ver2/matrix.c | 79 ++++---- dis/Neighborhood/initializeImage.c | 371 +++++++++++++++++++++++++++++++++++++ dis/Neighborhood/neighborhood.c | 14 +- dis/Neighborhood/utili.h | 161 ++++++---------- dis/Pointer/pointer.c | 32 ++-- dis/Transitive/transitive.c | 92 ++++----- dis/Update/update.c | 14 +- 8 files changed, 560 insertions(+), 230 deletions(-) create mode 100644 dis/Neighborhood/initializeImage.c (limited to 'dis') diff --git a/dis/Field/field.c b/dis/Field/field.c index 8565e8c..f83a403 100644 --- a/dis/Field/field.c +++ b/dis/Field/field.c @@ -47,7 +47,7 @@ int main(int argc, char** argv){ int mod_offset; unsigned int n; - time_t startTime; + time_t startTime, endTime; struct tokenS{ unsigned char delimiter[MAX_TOKEN_LENGTH]; @@ -92,9 +92,9 @@ int main(int argc, char** argv){ } startTime = time(NULL); - + START_LOOP + for (l =0; l errorTolerance)){ - START_LOOP /* * alpha = (transpose(vectorR) * vectorR) / @@ -434,7 +425,6 @@ void biConjugateGradient(double *value, error = vectorValue(tmpVector1)/vectorValue(vectorB); iteration++; - STOP_LOOP } *actualError = error; @@ -446,7 +436,6 @@ void biConjugateGradient(double *value, free(vectorR); free(vectorP); - WRITE_TO_FILE return; } @@ -515,10 +504,8 @@ void create_CRS(double *matrixA, } -int main(int _argc, char** _argv) +int main(int argc, char** argv) { - argc = _argc; - argv = _argv; int seed; int numberNonzero; int maxIterations; @@ -536,18 +523,22 @@ int main(int _argc, char** _argv) double *value; int *col_ind; int *row_start; - int sum; + double sum; int k; + // Internal vects for biConj + double *vectorR, *vectorP, *nextVectorR; + double *tmpVector1, *tmpVector2, *tmpVector3; + SET_UP - fscanf(stdin, "%d %d %d %d %f", - &seed, &dim, &numberNonzero,&maxIterations,&errorTolerance); + assert(fscanf(stdin, "%d %d %d %d %f", + &seed, &dim, &numberNonzero,&maxIterations,&errorTolerance) == 5); assert((seed > MIN_SEED) && (seed < MAX_SEED)); assert((dim > MIN_DIM) && (dim < MAX_DIM)); assert((numberNonzero > dim) && (numberNonzero < dim*dim)); assert((maxIterations > 0) && (maxIterations < MAX_ITERATIONS)); assert((errorTolerance > MIN_TOLERANCE) && (errorTolerance < MAX_TOLERANCE)); - matrixA = (double *)malloc(dim*dim*sizeof(double )); + matrixA = (double *)malloc(dim*dim*sizeof(double)); vectorB = (double *)malloc(dim*sizeof(double)); vectorX = (double *)malloc(dim*sizeof(double)); @@ -555,40 +546,46 @@ int main(int _argc, char** _argv) col_ind = (int *)malloc((numberNonzero+dim)*sizeof(int)); row_start = (int *)malloc((dim+1)*sizeof(int)); + // Internal matricies for biConj + vectorP = (double *)malloc(dim*sizeof(double)); + vectorR = (double *)malloc(dim*sizeof(double)); + nextVectorR = (double *)malloc(dim*sizeof(double)); + tmpVector1 = (double *)malloc(dim*sizeof(double)); + tmpVector2 = (double *)malloc(dim*sizeof(double)); + tmpVector3 = (double *)malloc(dim*sizeof(double)); + randInit(seed); + START_LOOP initMatrix(matrixA, dim, numberNonzero); - + create_CRS(matrixA, value, col_ind, row_start, dim, numberNonzero); initVector(vectorB, dim); zeroVector(vectorX, dim); - printf(" after init\n"); beginTime = time(NULL); - + actualError = 0; actualIteration = 0; - + biConjugateGradient(value, col_ind, row_start, vectorB, vectorX, errorTolerance, maxIterations, - &actualError, &actualIteration, dim); - - - - endTime = time(NULL) - beginTime; - + &actualError, &actualIteration, dim, + vectorP, vectorR, nextVectorR, tmpVector1, tmpVector2, tmpVector3); + STOP_LOOP + endTime = time(NULL); sum = 0; for (k=1; k +#endif /* NDEBUG */ +#include /* define assert() */ +#include /* define NULL, malloc(), free() */ +#include "stressmark.h" /* system include file */ +#include "neighborhood.h" /* define types, structures, etc */ +#include "errorMessage.h" /* define errorMessage() */ +#include "random.h" /* define randomUInt() */ +#include "initializeImage.h" /* define initializeImage() */ + +Image *initializeImage (Int dimension, /* dimension of image */ + Int maxImageValue, /* max legal image value */ + Int numberLines, /* number line segments for image */ + Int minThickness, /* min thickness for line segment */ + Int maxThickness) /* max thickness for line segment */ +{ /* beginning of initializeImage() */ + + Image *image; /* pointer to image structure to allocate */ + ShortInt *data; /* pointer to the data for the image structure*/ + Int lineIndex; /* loop index variable for line segments */ + Int pixelIndex; /* loop index variable for pixels */ + Int limit; /* limit for loop using pixelIndex */ + + Coord startPoint; /* starting point for a line segment */ + Coord endPoint; /* ending point for a line segment */ + Int lineThickness; /* thickness for a line segment */ + Int startValue; /* starting value for a line segment */ + Int endValue; /* ending value for a line segment */ + + /* + * Assert the assumptions that the number of columns and number of rows + * are positive values. No test on the maximum possible value is done since + * numColumns and numRows are of type Int and the maximum value of an Int + * type is possible. + */ + assert(dimension > 0); + assert(numberLines > 0); + assert((minThickness > 0) && (minThickness < dimension)); + assert((maxThickness > 0) && (maxThickness < dimension)); + assert(minThickness <= maxThickness); + + /* create image */ + image = createImage(dimension,dimension,maxImageValue); + if (image == NULL) { + return(NULL); + } /* end error check from createImage */ + + /* zero out the image */ + limit = dimension * dimension; + data = image->data; + for (pixelIndex = 0; pixelIndex < limit; pixelIndex++) { + *data++ = 0; + } /* end for loop */ + + /* + * Populate the image with line segments where the endpoints, values, and + * thickness of each line segment are randomly generated. + */ + for (lineIndex = 0; lineIndex < numberLines; lineIndex++) { + randomImageLocation(image, &startPoint); + randomImageLocation(image, &endPoint); + lineThickness = randomUInt(minThickness,maxThickness); + startValue = randomUInt(MIN_RANDOM_VALUE, maxImageValue); + endValue = randomUInt(MIN_RANDOM_VALUE, maxImageValue); + + /* add line segment to the image */ + drawLineSegment(&startPoint, &endPoint, startValue, endValue, lineThickness, + image); + + } /* end for loop */ + + return(image); +} /* end initializeImage() */ +#endif + +/* + * drawLineSegment() This routine draws a line segment into the given image + * starting at the coordinate startPoint and ending at the + * coordinate endPoint. The values along this line segment + * vary linearly from the given starting value startValue to + * the end value endValue and have a lineThickness associated + * to it. + * + * This routine is modeled after the routine draw_line() from + * "Practical Computer Vision using C", by J.R. Parker, Wiley, 1994, pp 114-116. + * It has been enhanced to have values on the line segment vary and to have + * a thickness to the line segment. + */ +void drawLineSegment (Coord *startPoint, /* starting point for line segment */ + Coord *endPoint, /* ending point for line segment */ + Int startValue, /* starting value for line segment */ + Int endValue, /* ending value for line segment */ + Int lineThickness, /* thickness for line segment */ + Image *image) /* image to add line segment to */ +{ /* beginning of drawLineSegment() */ + + /* + * Modeled after draw_line() from "Practical Computer Vision using C", + * by J.R. Parker, Wiley, 1994, pp 114-116. Enhanced to have values + * on the line segment vary and to have a thickness to the line segment. + * The value along the line segment is kept in a float variable so that + * fractional increments along the line segment can accumulate to integer + * values. + */ + Int changeColumn, changeRow; /* change along line segment in col/row */ + Int absColumn, absRow; /* absolute value of change in col/row */ + Int signColumn, signRow; /* sign of change along line segment col/row */ + Int delta; /* increment alone line segment */ + Int column, row; /* column & row of coordinate along line seg */ + Float value, valueDelta; /* value & value change along line segment */ + +// assert(validImage(image)); + assert(startPoint != NULL); + assert(endPoint != NULL); + +#ifdef DEBUG0 + fprintf(stderr, + "drawLineSegment: start row %6ld col %6ld\tend row %6ld col %6ld\n", + startPoint->row,startPoint->column,endPoint->row,endPoint->column); + fprintf(stderr," startVal %6ld endVal %6ld thickness %6ld\n", + startValue, endValue, lineThickness); +#endif /* DEBUG0 */ + + changeColumn = endPoint->column - startPoint->column; + if (changeColumn < 0) { + absColumn = - changeColumn; + signColumn = - 1; + } /* end changeColumn < 0 */ + else { /* changeColumn >= 0 */ + absColumn = changeColumn; + signColumn = 1; + } /* end changeColumn >= 0 */ + absColumn *= 2; + + changeRow = endPoint->row - startPoint->row; + if (changeRow < 0) { + absRow = - changeRow; + signRow = - 1; + } /* end changeRow < 0 */ + else { /* changeRow >= 0 */ + absRow = changeRow; + signRow = 1; + } /* end changeRow >= 0 */ + absRow *= 2; + + column = startPoint->column; + row = startPoint->row; + value = startValue; /* add changing value to algorithm */ + + if (signColumn * changeColumn > signRow * changeRow) { /* column dominant */ + /* determine the change in value for each step (added to algorithm) */ + valueDelta = ((Float) endValue - startValue) / + ((Float) changeColumn * signColumn); + + delta = absRow - (absColumn / 2); + while (TRUE) { /* inifinite loop */ + /* + * Line is column dominant, so line thickness will be along rows. Make + * sure the ending value doesn't go beyond endValue. (Added to algorithm) + */ + drawRowPoint((Int) value, lineThickness, row, column, image); + if (valueDelta >=0) { + value = MIN(endValue, value+valueDelta); + } /* values are incrementing */ + else { /* valueDelta < 0 */ + value = MAX(endValue, value+valueDelta); + } /* values are decreasing */ + + if (column == endPoint->column) { + return; /* done with line segment exit routine */ + } /* end exit criteria */ + if (delta >= 0) { + row += signRow; + delta -= absColumn; + } /* end if delta >= 0 */ + column += signColumn; + delta += absRow; + } /* end while infinite loop */ + } /* end row dominant case */ + else { /* row dominant case */ + /* determine the change in value for each step (added to algorithm) */ + if (changeRow == 0) { + valueDelta = 0; + assert(changeColumn == 0); + } /* end if changeRow == 0 */ + else { + valueDelta = ((Float) endValue - startValue) / + ((Float) changeRow * signRow); + } /* end else */ + + delta = absColumn - (absRow / 2); + while (TRUE) { /* inifinite loop */ + /* + * Line is row dominant, so line thickness will be along columns. Make + * sure the ending value doesn't go beyond endValue. (Added to algorithm) + */ + drawColumnPoint((Int) value, lineThickness, row, column, image); + if (valueDelta >=0) { + value = MIN(endValue, value+valueDelta); + } /* values are incrementing */ + else { /* valueDelta < 0 */ + value = MAX(endValue, value+valueDelta); + } /* values are decreasing */ + + if (row == endPoint->row) { + return; /* done with line segment exit routine */ + } /* end exit criteria */ + if (delta >= 0) { + column += signColumn; + delta -= absRow; + } /* end if delta >= 0 */ + row += signRow; + delta += absColumn; + } /* end while infinite loop */ + } /* end column dominant case */ + + return; +} /* end of drawLineSegment() */ + +/* + * drawRowPoint() This routine draws a point with a row thickness onto the + * given image for the coordinate and value provided. + */ +void drawRowPoint (Int value, /* value for point */ + Int pointThickness, /* thickness for point */ + Int row, /* row coordinate of point */ + Int column, /* column coordinate of point */ + Image *image) /* image to draw point onto */ +{ /* beginning of drawRowPoint() */ + Int halfThickness; /* half the point thickness */ + Int lowerRow, upperRow, rowIndex; /* loop boundaries and index for row */ + ShortInt *data; /* image data pointer */ + +// assert(validImage(image)); + assert(value >= MIN_RANDOM_VALUE); + assert(value <= image->maxImageValue); + assert(pointThickness > 0); + +#ifdef DEBUG0 + fprintf(stderr, + "drawRowPoint: value %5ld, thickness %6ld, row %6ld, column %6ld\n", + value,pointThickness,row,column); +#endif /* DEBUG0 */ + + halfThickness = (Int) pointThickness / 2; /* use integer division */ + lowerRow = MAX(0, row - halfThickness); + upperRow = MIN(image->numRows, row + pointThickness - halfThickness); + + data = image->data + (lowerRow * image->numColumns) + column; + for (rowIndex = lowerRow; rowIndex < upperRow; rowIndex++) { + *data = (ShortInt) value; + data += image->numColumns; /* increment pointer to next row */ + } /* end for loop */ + + return; +} /* end of drawRowPoint() */ + +/* + * drawColumnPoint() This routine draws a point with a column thickness onto the + * given image for the coordinate and value provided. + */ +void drawColumnPoint (Int value, /* value for point */ + Int pointThickness, /* thickness for point */ + Int row, /* row coordinate of point */ + Int column, /* column coordinate of point */ + Image *image) /* image to draw point onto */ +{ /* beginning of drawColumnPoint() */ + Int halfThickness; /* half the point thickness */ + Int leftColumn, rightColumn, columnIndex; /* col loop boundaries&index*/ + ShortInt *data; /* image data pointer */ + +// assert(validImage(image)); + assert(value >= MIN_RANDOM_VALUE); + assert(value <= image->maxImageValue); + assert(pointThickness > 0); + +#ifdef DEBUG0 + fprintf(stderr, + "drawColumnPoint: value %5ld, thickness %6ld, row %6ld, column %6ld\n", + value,pointThickness,row,column); +#endif /* DEBUG0 */ + + halfThickness = (Int) pointThickness / 2; /* use integer division */ + leftColumn = MAX(0, column - halfThickness); + rightColumn = MIN(image->numColumns, column + pointThickness - halfThickness); + + data = image->data + (row * image->numColumns) + leftColumn; + for (columnIndex = leftColumn; columnIndex < rightColumn; columnIndex++) { + *data = (ShortInt) value; + data++; /* increment pointer to next column */ + } /* end for loop */ + + return; +} /* end of drawColumnPoint() */ + +/* + * randomImageLocation() This routine generates a random coordinate yielding a + * coordinate in the given image using randomUInt(). + */ +#if 0 +#include "random.h" + +void randomImageLocation (Image *image, /* image in question */ + Coord *location) /* random location generated */ +{ /* beginning of randomImageLocation() */ + Int index; /* random location in image */ + Int maxIndex; /* maximum index in image */ + + assert(validImage(image)); + assert(location != NULL); + + maxIndex = image->numColumns * image->numRows - 1; + index = randomUInt(0, maxIndex); + + /* use integer division to clip to closest integer value */ + location->row = (Int) index / image->numColumns; + location->column = index - (location->row * image->numColumns); + + assert((location->row >= 0) && (location->row < image->numRows)); + assert((location->column >= 0) && (location->column < image->numColumns)); + assert(index = location->column + (location->row * image->numColumns)); + + return; +} /* end of randomImageLocation() */ +#endif diff --git a/dis/Neighborhood/neighborhood.c b/dis/Neighborhood/neighborhood.c index 1736d38..23f3a8e 100644 --- a/dis/Neighborhood/neighborhood.c +++ b/dis/Neighborhood/neighborhood.c @@ -11,6 +11,10 @@ * read the Benchmark Analysis and Specifications Document Version 1.0 * before going on since the detailed comments are given in this documents. * the comments are not repeated here. + * + * Change log: + * ------- ---------------- --------------------------------------------------- + * 06/2020 Joshua Bakita Include image creation time in timing */ #include @@ -58,12 +62,14 @@ int main(int argc, char** argv) randInit(seed); maxPixel = (1 << bitDepth) - 1; - image = createImage(dimension, maxPixel, numberLines, - minThickness, maxThickness); - assert (image != NULL); + image = malloc(sizeof(Pixel) * dimension * dimension); + assert(image != NULL); beginTime = time(NULL); START_LOOP + createImage(image, dimension, maxPixel, numberLines, + minThickness, maxThickness); + neighborhoodCalculation(image, dimension, distanceShort, distanceLong, &values, maxPixel); STOP_LOOP @@ -91,7 +97,7 @@ int main(int argc, char** argv) values.distLong.deg135.entropy, values.distLong.deg135.energy); - fprintf(stderr, "time for neghborhood stressmark = %f\n", + fprintf(stderr, "time for neghborhood stressmark = %f seconds.\n", difftime(endTime, beginTime)); free((Pixel *)image); diff --git a/dis/Neighborhood/utili.h b/dis/Neighborhood/utili.h index 2a8e2a0..5b54d9b 100644 --- a/dis/Neighborhood/utili.h +++ b/dis/Neighborhood/utili.h @@ -56,81 +56,23 @@ typedef struct { typedef short int Pixel; /* short int;*/ +typedef struct { + int numColumns; /* number of columns in image */ + int numRows; /* number of rows in image */ + Pixel maxImageValue; /* max legal image value */ + Pixel *data; /* data pointer */ +} Image; -void drawLineSegment(Pixel *image, - Coord startPoint, - Coord endPoint, - int startValue, - int endValue, - int thickness, - int dimension) - { - int changeColumn, changeRow; - int delta; - int column, row; - float value, valueDelta; - int t; - - changeColumn = endPoint.column - startPoint.column; - changeRow = endPoint.row - startPoint.row; - - assert((changeRow != 0) || (changeColumn != 0)); - - column = startPoint.column; - row = startPoint.row; - value = startValue; - - if (ABS(changeColumn) > ABS(changeRow)){ - valueDelta = ((float) endValue - startValue)/ - ((float) ABS(changeColumn)); - delta = 2*ABS(row) - ABS(column); - for (column = startPoint.column; - column == endPoint.column+sign(changeColumn); - column += sign(changeColumn)){ - for (t = MAX(0, row-thickness/2); - t < MIN(dimension, row+thickness - thickness/2); - t++) - image[t*dimension + column] = (int)value; - value += valueDelta; - if (delta >= 0){ - row += sign(changeRow); - delta -= 2*ABS(changeColumn); - } - column += sign(changeColumn); - delta += 2*ABS(changeRow); - } - } - else { - valueDelta = ((float) endValue - startValue)/ - ((float) ABS(changeRow)); - delta = 2* ABS(column) - ABS(row); - for (row = startPoint.row; - row == endPoint.row + sign(changeRow); - row += sign(changeRow)){ - for (t = MAX(0, column-thickness/2); - t < MIN(dimension, row + thickness - thickness/2); - t++) - image[row*dimension + t] = (int)value; - if (delta >= 0){ - column += sign(changeColumn); - delta -= 2*ABS(changeRow); - } - row += sign(changeRow); - delta += 2*ABS(changeColumn); - } - } - return; - } - - +// For correct implementation of drawLineSegment +#include "initializeImage.c" -Pixel *createImage (int dimension, +Pixel *createImage (Pixel *image, + int dimension, Pixel maxPixel, int numberLines, int minThickness, int maxThickness) { - Pixel *image; int i; Coord startPoint; @@ -138,9 +80,12 @@ Pixel *createImage (int dimension, int thickness; int startValue; int endValue; + Image img; + img.numColumns = dimension; + img.numRows = dimension; + img.maxImageValue = maxPixel; + img.data = image; - image = (Pixel *)malloc(sizeof(Pixel) * dimension * dimension); - assert (image != NULL); for (i=0; i= 0) && (binIndex < numBins)); - sumHist[binIndex] += 1; - binIndex = value0 - value1 + maxPixel - MIN_PIXEL; + binIndex = value0 + value1 - 2*MIN_PIXEL; + assert((binIndex >= 0) && (binIndex < numBins)); + sumHist[binIndex] += 1; + binIndex = value0 - value1 + maxPixel - MIN_PIXEL; - assert((binIndex >= 0) && (binIndex < numBins)); + assert((binIndex >= 0) && (binIndex < numBins)); - diffHist[binIndex] += 1; - totalNumPixels += 1; + diffHist[binIndex] += 1; + totalNumPixels += 1; } @@ -269,26 +215,26 @@ void calcEntropyEnergy( entropyValue = (double) 0; scale = 1.e0/totalNumPixels; for (index = 0; index 0){ - sumNormalized = (double) sumHist[index]*scale; - entropyValue = entropyValue - sumNormalized * - log((double)sumNormalized); - energySum = energySum + sumNormalized * sumNormalized ; - } - if (diffHist[index] > 0){ - diffNormalized = (double)diffHist[index]*scale; - entropyValue = entropyValue - diffNormalized * log(diffNormalized); - energyDifference = energyDifference + - diffNormalized * diffNormalized; - } + if (sumHist[index] > 0){ + sumNormalized = (double) sumHist[index]*scale; + entropyValue = entropyValue - sumNormalized * + log((double)sumNormalized); + energySum = energySum + sumNormalized * sumNormalized ; + } + if (diffHist[index] > 0){ + diffNormalized = (double)diffHist[index]*scale; + entropyValue = entropyValue - diffNormalized * log(diffNormalized); + energyDifference = energyDifference + + diffNormalized * diffNormalized; + } } *energy = energySum * energyDifference; *entropy = entropyValue; } return; - } +} + - void neighborhoodCalculation (Pixel *image, int dimension, @@ -306,7 +252,6 @@ void neighborhoodCalculation diffHist = (int *)malloc(numBins * sizeof(int)); assert(diffHist != NULL); - printf(" before short calc deg0\n"); calcEntropyEnergy(sumHist, diffHist, image, numBins, distanceShort, 0, &(neighborhood->distShort.deg0.entropy), diff --git a/dis/Pointer/pointer.c b/dis/Pointer/pointer.c index 5671697..3fc7248 100644 --- a/dis/Pointer/pointer.c +++ b/dis/Pointer/pointer.c @@ -38,19 +38,19 @@ int main(int argc, char** argv){ unsigned int *field; - unsigned int f; + unsigned long f; unsigned short int w; - unsigned int maxhops; - int seed; + unsigned long maxhops; + long seed; unsigned int n; - clock_t startTime; + clock_t startTime, endTime; struct threadS{ - unsigned int initial; - unsigned int minStop; - unsigned int maxStop; - unsigned int hops; + unsigned long initial; + unsigned long minStop; + unsigned long maxStop; + unsigned long hops; }*thread; unsigned int l; @@ -72,7 +72,7 @@ int main(int argc, char** argv){ return (-1); for (l=0; l= 0) && (thread[l].initial < f)); assert ((thread[l].minStop >= 0) && (thread[l].minStop < f)); @@ -89,9 +89,9 @@ int main(int argc, char** argv){ startTime = time(NULL); clock(); +START_LOOP for (l=0; l= MIN_VERTICES) && (n <= MAX_VERTICES)); assert((m >= MIN_EDGES) && (m <= MAX_EDGES)); - assert (m <= n*n); - assert ((seed >= MIN_SEED) && (seed <= MAX_SEED)); + assert(m <= n*n); + assert((seed >= MIN_SEED) && (seed <= MAX_SEED)); if ((din = (unsigned int *)malloc(n*n*sizeof(unsigned int))) == NULL) - return (-1); + return (-1); if ((dout = (unsigned int *)malloc(n*n*sizeof(unsigned int))) == NULL) - return (-1); + return (-1); for (i=0; i= minStop) && (index < maxStop)))){ @@ -92,7 +93,6 @@ int main(int argc, char** argv){ unsigned int max, min; unsigned int partition; unsigned int high; - if (hops % 100 == 0) {START_LOOP} // These loops are too quick to sample individually max = MAX_FIELD_SIZE; min = 0; high = 0; @@ -125,13 +125,15 @@ int main(int argc, char** argv){ field[index] = sum % (f-w); index = (partition+hops)%(f-w); hops++; - if (hops % 100 == 0) {STOP_LOOP} // These loops are too quick to sample individually }/* end for loop */ + STOP_LOOP - startTime = time(NULL) - startTime; + endTime = time(NULL); - fprintf(stdout, "%u hops\n", hops); - fprintf(stderr, "total time = %u seconds.\n", (unsigned int)startTime); + volatile int _stop_optimizer = hops; + //fprintf(stdout, "%u hops\n", hops); + fprintf(stderr, "time for update stressmark = %f seconds.\n", + difftime(endTime, startTime)); free(field); WRITE_TO_FILE return(1); -- cgit v1.2.2