diff --git a/Validation/Performance/bin/BuildFile.xml b/Validation/Performance/bin/BuildFile.xml deleted file mode 100644 index 383435ec15238..0000000000000 --- a/Validation/Performance/bin/BuildFile.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/Validation/Performance/bin/FFT.c b/Validation/Performance/bin/FFT.c deleted file mode 100644 index 5a2a74b030ded..0000000000000 --- a/Validation/Performance/bin/FFT.c +++ /dev/null @@ -1,151 +0,0 @@ -#include -#include -#include - -#include "FFT.h" - -#define PI 3.1415926535897932 - -/*-----------------------------------------------------------------------*/ - -static int int_log2(int n); - -double FFT_num_flops(int N) { - double Nd = (double)N; - double logN = (double)int_log2(N); - - return (5.0 * Nd - 2) * logN + 2 * (Nd + 1); -} - -static int int_log2(int n) { - int k = 1; - int log = 0; - for (/*k=1*/; k < n; k *= 2, log++) - ; - if (n != (1 << log)) { - printf("FFT: Data length is not a power of 2!: %d ", n); - exit(1); - } - return log; -} - -static void FFT_transform_internal(int N, double *data, int direction) { - int n = N / 2; - int bit = 0; - int logn; - int dual = 1; - - if (n == 1) - return; /* Identity operation! */ - logn = int_log2(n); - - if (N == 0) - return; - - /* bit reverse the input data for decimation in time algorithm */ - FFT_bitreverse(N, data); - - /* apply fft recursion */ - /* this loop executed int_log2(N) times */ - for (bit = 0; bit < logn; bit++, dual *= 2) { - double w_real = 1.0; - double w_imag = 0.0; - int a; - int b; - - double theta = 2.0 * direction * PI / (2.0 * (double)dual); - double s = sin(theta); - double t = sin(theta / 2.0); - double s2 = 2.0 * t * t; - - for (a = 0, b = 0; b < n; b += 2 * dual) { - int i = 2 * b; - int j = 2 * (b + dual); - - double wd_real = data[j]; - double wd_imag = data[j + 1]; - - data[j] = data[i] - wd_real; - data[j + 1] = data[i + 1] - wd_imag; - data[i] += wd_real; - data[i + 1] += wd_imag; - } - - /* a = 1 .. (dual-1) */ - for (a = 1; a < dual; a++) { - /* trignometric recurrence for w-> exp(i theta) w */ - { - double tmp_real = w_real - s * w_imag - s2 * w_real; - double tmp_imag = w_imag + s * w_real - s2 * w_imag; - w_real = tmp_real; - w_imag = tmp_imag; - } - for (b = 0; b < n; b += 2 * dual) { - int i = 2 * (b + a); - int j = 2 * (b + a + dual); - - double z1_real = data[j]; - double z1_imag = data[j + 1]; - - double wd_real = w_real * z1_real - w_imag * z1_imag; - double wd_imag = w_real * z1_imag + w_imag * z1_real; - - data[j] = data[i] - wd_real; - data[j + 1] = data[i + 1] - wd_imag; - data[i] += wd_real; - data[i + 1] += wd_imag; - } - } - } -} - -void FFT_bitreverse(int N, double *data) { - /* This is the Goldrader bit-reversal algorithm */ - int n = N / 2; - int nm1 = n - 1; - int i = 0; - int j = 0; - for (; i < nm1; i++) { - /*int ii = 2*i; */ - int ii = i << 1; - - /*int jj = 2*j; */ - int jj = j << 1; - - /* int k = n / 2 ; */ - int k = n >> 1; - - if (i < j) { - double tmp_real = data[ii]; - double tmp_imag = data[ii + 1]; - data[ii] = data[jj]; - data[ii + 1] = data[jj + 1]; - data[jj] = tmp_real; - data[jj + 1] = tmp_imag; - } - - while (k <= j) { - /*j = j - k ; */ - j -= k; - - /*k = k / 2 ; */ - k >>= 1; - } - j += k; - } -} - -void FFT_transform(int N, double *data) { FFT_transform_internal(N, data, -1); } - -void FFT_inverse(int N, double *data) { - int n = N / 2; - double norm = 0.0; - int i = 0; - FFT_transform_internal(N, data, +1); - - /* Normalize */ - - norm = 1 / ((double)n); - for (i = 0; i < N; i++) - data[i] *= norm; -} diff --git a/Validation/Performance/bin/FFT.h b/Validation/Performance/bin/FFT.h deleted file mode 100644 index 73508f5d793f3..0000000000000 --- a/Validation/Performance/bin/FFT.h +++ /dev/null @@ -1,5 +0,0 @@ - -void FFT_transform(int N, double *data); -void FFT_inverse(int N, double *data); -void FFT_bitreverse(int N, double *data); -double FFT_num_flops(int N); diff --git a/Validation/Performance/bin/LU.c b/Validation/Performance/bin/LU.c deleted file mode 100644 index 3c1ddd8a683d5..0000000000000 --- a/Validation/Performance/bin/LU.c +++ /dev/null @@ -1,85 +0,0 @@ -#include -#include "LU.h" - -double LU_num_flops(int N) { - /* rougly 2/3*N^3 */ - - double Nd = (double)N; - - return (2.0 * Nd * Nd * Nd / 3.0); -} - -void LU_copy_matrix(int M, int N, double **lu, double **A) { - int i; - int j; - - for (i = 0; i < M; i++) - for (j = 0; j < N; j++) - lu[i][j] = A[i][j]; -} - -int LU_factor(int M, int N, double **A, int *pivot) { - int minMN = M < N ? M : N; - int j = 0; - - for (j = 0; j < minMN; j++) { - /* find pivot in column j and test for singularity. */ - - int jp = j; - int i; - - double t = fabs(A[j][j]); - for (i = j + 1; i < M; i++) { - double ab = fabs(A[i][j]); - if (ab > t) { - jp = i; - t = ab; - } - } - - pivot[j] = jp; - - /* jp now has the index of maximum element */ - /* of column j, below the diagonal */ - - if (A[jp][j] == 0) - return 1; /* factorization failed because of zero pivot */ - - if (jp != j) { - /* swap rows j and jp */ - double *tA = A[j]; - A[j] = A[jp]; - A[jp] = tA; - } - - if (j < M - 1) /* compute elements j+1:M of jth column */ - { - /* note A(j,j), was A(jp,p) previously which was */ - /* guarranteed not to be zero (Label #1) */ - - double recp = 1.0 / A[j][j]; - int k; - for (k = j + 1; k < M; k++) - A[k][j] *= recp; - } - - if (j < minMN - 1) { - /* rank-1 update to trailing submatrix: E = E - x*y; */ - /* E is the region A(j+1:M, j+1:N) */ - /* x is the column vector A(j+1:M,j) */ - /* y is row vector A(j,j+1:N) */ - - int ii; - for (ii = j + 1; ii < M; ii++) { - double *Aii = A[ii]; - double *Aj = A[j]; - double AiiJ = Aii[j]; - int jj; - for (jj = j + 1; jj < N; jj++) - Aii[jj] -= AiiJ * Aj[jj]; - } - } - } - - return 0; -} diff --git a/Validation/Performance/bin/LU.h b/Validation/Performance/bin/LU.h deleted file mode 100644 index b7ae9d32c2fdd..0000000000000 --- a/Validation/Performance/bin/LU.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef LU_H -#define LU_H - -double LU_num_flops(int N); -void LU_copy_matrix(int M, int N, double **lu, double **A); -int LU_factor(int M, int N, double **A, int *pivot); - -#endif diff --git a/Validation/Performance/bin/MonteCarlo.c b/Validation/Performance/bin/MonteCarlo.c deleted file mode 100644 index b74bac8724915..0000000000000 --- a/Validation/Performance/bin/MonteCarlo.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "Random.h" - -/** - Estimate Pi by approximating the area of a circle. - - How: generate N random numbers in the unit square, (0,0) to (1,1) - and see how are within a radius of 1 or less, i.e. -
  
-
- sqrt(x^2 + y^2) < r
-
- 
- since the radius is 1.0, we can square both sides - and avoid a sqrt() computation: -
-
-    x^2 + y^2 <= 1.0
-
-  
- this area under the curve is (Pi * r^2)/ 4.0, - and the area of the unit of square is 1.0, - so Pi can be approximated by -
-                # points with x^2+y^2 < 1
-     Pi =~      --------------------------  * 4.0
-                     total # points
-
-  
- -*/ - -static const int SEED = 113; - -double MonteCarlo_num_flops(int Num_samples) { - /* 3 flops in x^2+y^2 and 1 flop in random routine */ - - return ((double)Num_samples) * 4.0; -} - -double MonteCarlo_integrate(int Num_samples) { - Random R = new_Random_seed(SEED); - - int under_curve = 0; - int count; - - for (count = 0; count < Num_samples; count++) { - double x = Random_nextDouble(R); - double y = Random_nextDouble(R); - - if (x * x + y * y <= 1.0) - under_curve++; - } - - Random_delete(R); - - return ((double)under_curve / Num_samples) * 4.0; -} diff --git a/Validation/Performance/bin/MonteCarlo.h b/Validation/Performance/bin/MonteCarlo.h deleted file mode 100644 index d5f8663214886..0000000000000 --- a/Validation/Performance/bin/MonteCarlo.h +++ /dev/null @@ -1,2 +0,0 @@ -double MonteCarlo_integrate(int Num_samples); -double MonteCarlo_num_flops(int Num_samples); diff --git a/Validation/Performance/bin/Random.c b/Validation/Performance/bin/Random.c deleted file mode 100644 index 94c1a46a6b4e3..0000000000000 --- a/Validation/Performance/bin/Random.c +++ /dev/null @@ -1,153 +0,0 @@ - - -#include - -#include "Random.h" - -#ifndef NULL -#define NULL 0 -#endif - -/* static const int mdig = 32; */ -#define MDIG 32 - -/* static const int one = 1; */ -#define ONE 1 - -static const int m1 = (ONE << (MDIG - 2)) + ((ONE << (MDIG - 2)) - ONE); -static const int m2 = ONE << MDIG / 2; - -/* For mdig = 32 : m1 = 2147483647, m2 = 65536 - For mdig = 64 : m1 = 9223372036854775807, m2 = 4294967296 - */ - -/* move to initialize() because */ -/* compiler could not resolve as */ -/* a constant. */ - -static /*const*/ double dm1; /* = 1.0 / (double) m1; */ - -/* private methods (defined below, but not in Random.h */ - -static void initialize(Random R, int seed); - -Random new_Random_seed(int seed) { - Random R = (Random)malloc(sizeof(Random_struct)); - - initialize(R, seed); - R->left = 0.0; - R->right = 1.0; - R->width = 1.0; - R->haveRange = 0 /*false*/; - - return R; -} - -Random new_Random(int seed, double left, double right) { - Random R = (Random)malloc(sizeof(Random_struct)); - - initialize(R, seed); - R->left = left; - R->right = right; - R->width = right - left; - R->haveRange = 1; /* true */ - - return R; -} - -void Random_delete(Random R) { free(R); } - -/* Returns the next random number in the sequence. */ - -double Random_nextDouble(Random R) { - int k; - - int I = R->i; - int J = R->j; - int *m = R->m; - - k = m[I] - m[J]; - if (k < 0) - k += m1; - R->m[J] = k; - - if (I == 0) - I = 16; - else - I--; - R->i = I; - - if (J == 0) - J = 16; - else - J--; - R->j = J; - - if (R->haveRange) - return R->left + dm1 * (double)k * R->width; - else - return dm1 * (double)k; -} - -/*-------------------------------------------------------------------- - PRIVATE METHODS - ----------------------------------------------------------------- */ - -static void initialize(Random R, int seed) { - int jseed, k0, k1, j0, j1, iloop; - - dm1 = 1.0 / (double)m1; - - R->seed = seed; - - if (seed < 0) - seed = -seed; /* seed = abs(seed) */ - jseed = (seed < m1 ? seed : m1); /* jseed = min(seed, m1) */ - if (jseed % 2 == 0) - --jseed; - k0 = 9069 % m2; - k1 = 9069 / m2; - j0 = jseed % m2; - j1 = jseed / m2; - for (iloop = 0; iloop < 17; ++iloop) { - jseed = j0 * k0; - j1 = (jseed / m2 + j0 * k1 + j1 * k0) % (m2 / 2); - j0 = jseed % m2; - R->m[iloop] = j0 + m2 * j1; - } - R->i = 4; - R->j = 16; -} - -double *RandomVector(int N, Random R) { - int i; - double *x = (double *)malloc(sizeof(double) * N); - - for (i = 0; i < N; i++) - x[i] = Random_nextDouble(R); - - return x; -} - -double **RandomMatrix(int M, int N, Random R) { - int i; - int j; - - /* allocate matrix */ - - double **A = (double **)malloc(sizeof(double *) * M); - - if (A == NULL) - return NULL; - - for (i = 0; i < M; i++) { - A[i] = (double *)malloc(sizeof(double) * N); - if (A[i] == NULL) { - free(A); - return NULL; - } - for (j = 0; j < N; j++) - A[i][j] = Random_nextDouble(R); - } - return A; -} diff --git a/Validation/Performance/bin/Random.h b/Validation/Performance/bin/Random.h deleted file mode 100644 index 8c88e5585b321..0000000000000 --- a/Validation/Performance/bin/Random.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef RANDOM_H -#define RANDOM_H - -typedef struct { - int m[17]; - int seed; - int i; /* originally = 4 */ - int j; /* originally = 16 */ - int /*boolean*/ haveRange; /* = false; */ - double left; /*= 0.0; */ - double right; /* = 1.0; */ - double width; /* = 1.0; */ -} Random_struct, *Random; - -Random new_Random_seed(int seed); -double Random_nextDouble(Random R); -void Random_delete(Random R); -double *RandomVector(int N, Random R); -double **RandomMatrix(int M, int N, Random R); - -#endif diff --git a/Validation/Performance/bin/SOR.c b/Validation/Performance/bin/SOR.c deleted file mode 100644 index 3e2a17155b02c..0000000000000 --- a/Validation/Performance/bin/SOR.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "SOR.h" - -double SOR_num_flops(int M, int N, int num_iterations) { - double Md = (double)M; - double Nd = (double)N; - double num_iterD = (double)num_iterations; - - return (Md - 1) * (Nd - 1) * num_iterD * 6.0; -} - -void SOR_execute(int M, int N, double omega, double **G, int num_iterations) { - double omega_over_four = omega * 0.25; - double one_minus_omega = 1.0 - omega; - - /* update interior points */ - - int Mm1 = M - 1; - int Nm1 = N - 1; - int p; - int i; - int j; - double *Gi; - double *Gim1; - double *Gip1; - - for (p = 0; p < num_iterations; p++) { - for (i = 1; i < Mm1; i++) { - Gi = G[i]; - Gim1 = G[i - 1]; - Gip1 = G[i + 1]; - for (j = 1; j < Nm1; j++) - Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j - 1] + Gi[j + 1]) + one_minus_omega * Gi[j]; - } - } -} diff --git a/Validation/Performance/bin/SOR.h b/Validation/Performance/bin/SOR.h deleted file mode 100644 index 3a0cf088f557a..0000000000000 --- a/Validation/Performance/bin/SOR.h +++ /dev/null @@ -1,3 +0,0 @@ - -double SOR_num_flops(int M, int N, int num_iterations); -void SOR_execute(int M, int N, double omega, double **G, int num_iterations); diff --git a/Validation/Performance/bin/SparseCompRow.c b/Validation/Performance/bin/SparseCompRow.c deleted file mode 100644 index ee2194e8b2a4c..0000000000000 --- a/Validation/Performance/bin/SparseCompRow.c +++ /dev/null @@ -1,35 +0,0 @@ -/* multiple iterations used to make kernel have roughly - same granulairty as other Scimark kernels. */ - -double SparseCompRow_num_flops(int N, int nz, int num_iterations) { - /* Note that if nz does not divide N evenly, then the - actual number of nonzeros used is adjusted slightly. - */ - int actual_nz = (nz / N) * N; - return ((double)actual_nz) * 2.0 * ((double)num_iterations); -} - -/* computes a matrix-vector multiply with a sparse matrix - held in compress-row format. If the size of the matrix - in MxN with nz nonzeros, then the val[] is the nz nonzeros, - with its ith entry in column col[i]. The integer vector row[] - is of size M+1 and row[i] points to the begining of the - ith row in col[]. - */ - -void SparseCompRow_matmult(int M, double *y, double *val, int *row, int *col, double *x, int NUM_ITERATIONS) { - int reps; - int r; - int i; - - for (reps = 0; reps < NUM_ITERATIONS; reps++) { - for (r = 0; r < M; r++) { - double sum = 0.0; - int rowR = row[r]; - int rowRp1 = row[r + 1]; - for (i = rowR; i < rowRp1; i++) - sum += x[col[i]] * val[i]; - y[r] = sum; - } - } -} diff --git a/Validation/Performance/bin/SparseCompRow.h b/Validation/Performance/bin/SparseCompRow.h deleted file mode 100644 index e6f049d5cd460..0000000000000 --- a/Validation/Performance/bin/SparseCompRow.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef SPARSE_COMPROW_H -#define SPARSE_COMPROW_H - -double SparseCompRow_num_flops(int N, int nz, int num_iterations); - -void SparseCompRow_matmult(int M, double *y, double *val, int *row, int *col, double *x, int NUM_ITERATIONS); - -#endif diff --git a/Validation/Performance/bin/Stopwatch.c b/Validation/Performance/bin/Stopwatch.c deleted file mode 100644 index 4e09904126055..0000000000000 --- a/Validation/Performance/bin/Stopwatch.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include "Stopwatch.h" - -double seconds() { return ((double)clock()) / (double)CLOCKS_PER_SEC; } - -void Stopwtach_reset(Stopwatch Q) { - Q->running = 0; /* false */ - Q->last_time = 0.0; - Q->total = 0.0; -} - -Stopwatch new_Stopwatch(void) { - Stopwatch S = (Stopwatch)malloc(sizeof(Stopwatch_struct)); - if (S == NULL) - return NULL; - - Stopwtach_reset(S); - return S; -} - -void Stopwatch_delete(Stopwatch S) { - if (S != NULL) - free(S); -} - -/* Start resets the timer to 0.0; use resume for continued total */ - -void Stopwatch_start(Stopwatch Q) { - if (!(Q->running)) { - Q->running = 1; /* true */ - Q->total = 0.0; - Q->last_time = seconds(); - } -} - -/** - Resume timing, after stopping. (Does not wipe out - accumulated times.) - -*/ - -void Stopwatch_resume(Stopwatch Q) { - if (!(Q->running)) { - Q->last_time = seconds(); - Q->running = 1; /*true*/ - } -} - -void Stopwatch_stop(Stopwatch Q) { - if (Q->running) { - Q->total += seconds() - Q->last_time; - Q->running = 0; /* false */ - } -} - -double Stopwatch_read(Stopwatch Q) { - if (Q->running) { - double t = seconds(); - Q->total += t - Q->last_time; - Q->last_time = t; - } - return Q->total; -} diff --git a/Validation/Performance/bin/Stopwatch.h b/Validation/Performance/bin/Stopwatch.h deleted file mode 100644 index 685a24275890d..0000000000000 --- a/Validation/Performance/bin/Stopwatch.h +++ /dev/null @@ -1,20 +0,0 @@ - -#include - -typedef struct { - int running; /* boolean */ - double last_time; - double total; - -} *Stopwatch, Stopwatch_struct; - -double seconds(); - -void Stopwtach_reset(Stopwatch Q); - -Stopwatch new_Stopwatch(void); -void Stopwatch_delete(Stopwatch S); -void Stopwatch_start(Stopwatch Q); -void Stopwatch_resume(Stopwatch Q); -void Stopwatch_stop(Stopwatch Q); -double Stopwatch_read(Stopwatch Q); diff --git a/Validation/Performance/bin/array.c b/Validation/Performance/bin/array.c deleted file mode 100644 index e137f7aab553c..0000000000000 --- a/Validation/Performance/bin/array.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include "array.h" - -#ifndef NULL -#define NULL 0 -#endif - -double **new_Array2D_double(int M, int N) { - int i = 0; - int failed = 0; - - double **A = (double **)malloc(sizeof(double *) * M); - if (A == NULL) - return NULL; - - for (i = 0; i < M; i++) { - A[i] = (double *)malloc(N * sizeof(double)); - if (A[i] == NULL) { - failed = 1; - break; - } - } - - /* if we didn't successfully allocate all rows of A */ - /* clean up any allocated memory (i.e. go back and free */ - /* previous rows) and return NULL */ - - if (failed) { - i--; - for (; i <= 0; i--) - free(A[i]); - free(A); - return NULL; - } else - return A; -} -void Array2D_double_delete(int M, int N, double **A) { - int i; - if (A == NULL) - return; - - for (i = 0; i < M; i++) - free(A[i]); - - free(A); -} - -void Array2D_double_copy(int M, int N, double **B, double **A) { - int remainder = N & 3; /* N mod 4; */ - int i = 0; - int j = 0; - - for (i = 0; i < M; i++) { - double *Bi = B[i]; - double *Ai = A[i]; - for (j = 0; j < remainder; j++) - Bi[j] = Ai[j]; - for (j = remainder; j < N; j += 4) { - Bi[j] = Ai[j]; - Bi[j + 1] = Ai[j + 1]; - Bi[j + 2] = Ai[j + 2]; - Bi[j + 3] = Ai[j + 3]; - } - } -} diff --git a/Validation/Performance/bin/array.h b/Validation/Performance/bin/array.h deleted file mode 100644 index a0cd07909e30f..0000000000000 --- a/Validation/Performance/bin/array.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef ARRAY_H -#define ARRAY_H - -double **new_Array2D_double(int M, int N); -void Array2D_double_delete(int M, int N, double **A); -void Array2D_double_copy(int M, int N, double **B, double **A); - -#endif diff --git a/Validation/Performance/bin/constants.h b/Validation/Performance/bin/constants.h deleted file mode 100644 index 76c9ff60f64cb..0000000000000 --- a/Validation/Performance/bin/constants.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef CONSTANTS_H_ -#define CONSTANTS_H_ - -const double RESOLUTION_DEFAULT = 2.0; /* secs (normally 2.0) */ -const int RANDOM_SEED = 101010; - -/* default: small (cache-contained) problem sizes */ - -const int FFT_SIZE = 1024; /* must be a power of two */ -const int SOR_SIZE = 100; /* NxN grid */ -const int SPARSE_SIZE_M = 1000; -const int SPARSE_SIZE_nz = 5000; -const int LU_SIZE = 100; - -/* large (out-of-cache) problem sizes */ - -const int LG_FFT_SIZE = 1048576; /* must be a power of two */ -const int LG_SOR_SIZE = 1000; /* NxN grid */ -const int LG_SPARSE_SIZE_M = 100000; -const int LG_SPARSE_SIZE_nz = 1000000; -const int LG_LU_SIZE = 1000; - -/* tiny problem sizes (used to mainly to preload network classes */ -/* for applet, so that network download times */ -/* are factored out of benchmark.) */ -/* */ -const int TINY_FFT_SIZE = 16; /* must be a power of two */ -const int TINY_SOR_SIZE = 10; /* NxN grid */ -const int TINY_SPARSE_SIZE_M = 10; -const int TINY_SPARSE_SIZE_N = 10; -const int TINY_SPARSE_SIZE_nz = 50; -const int TINY_LU_SIZE = 10; - -#endif diff --git a/Validation/Performance/bin/kernel.c b/Validation/Performance/bin/kernel.c deleted file mode 100644 index 6c0fcdc6b7a8d..0000000000000 --- a/Validation/Performance/bin/kernel.c +++ /dev/null @@ -1,206 +0,0 @@ -#include -#include -#include "LU.h" -#include "FFT.h" -#include "SOR.h" -#include "MonteCarlo.h" -#include "LU.h" -#include "Random.h" -#include "Stopwatch.h" -#include "SparseCompRow.h" -#include "array.h" - -double kernel_measureFFT(int N, double mintime, Random R) { - /* initialize FFT data as complex (N real/img pairs) */ - - int twoN = 2 * N; - double *x = RandomVector(twoN, R); - long cycles = 1; - Stopwatch Q = new_Stopwatch(); - int i = 0; - double result = 0.0; - - while (1) { - Stopwatch_start(Q); - for (i = 0; i < cycles; i++) { - FFT_transform(twoN, x); /* forward transform */ - FFT_inverse(twoN, x); /* backward transform */ - } - Stopwatch_stop(Q); - if (Stopwatch_read(Q) >= mintime) - break; - - cycles *= 2; - } - /* approx Mflops */ - - result = FFT_num_flops(N) * cycles / Stopwatch_read(Q) * 1.0e-6; - Stopwatch_delete(Q); - free(x); - return result; -} - -double kernel_measureSOR(int N, double min_time, Random R) { - double **G = RandomMatrix(N, N, R); - double result = 0.0; - - Stopwatch Q = new_Stopwatch(); - int cycles = 1; - while (1) { - Stopwatch_start(Q); - SOR_execute(N, N, 1.25, G, cycles); - Stopwatch_stop(Q); - - if (Stopwatch_read(Q) >= min_time) - break; - - cycles *= 2; - } - /* approx Mflops */ - - result = SOR_num_flops(N, N, cycles) / Stopwatch_read(Q) * 1.0e-6; - Stopwatch_delete(Q); - Array2D_double_delete(N, N, G); - return result; -} - -double kernel_measureMonteCarlo(double min_time, Random R) { - double result = 0.0; - Stopwatch Q = new_Stopwatch(); - - int cycles = 1; - while (1) { - Stopwatch_start(Q); - MonteCarlo_integrate(cycles); - Stopwatch_stop(Q); - if (Stopwatch_read(Q) >= min_time) - break; - - cycles *= 2; - } - /* approx Mflops */ - result = MonteCarlo_num_flops(cycles) / Stopwatch_read(Q) * 1.0e-6; - Stopwatch_delete(Q); - return result; -} - -double kernel_measureSparseMatMult(int N, int nz, double min_time, Random R) { - /* initialize vector multipliers and storage for result */ - /* y = A*y; */ - - double *x = RandomVector(N, R); - double *y = (double *)malloc(sizeof(double) * N); - - double result = 0.0; - -#if 0 - // initialize square sparse matrix - // - // for this test, we create a sparse matrix with M/nz nonzeros - // per row, with spaced-out evenly between the begining of the - // row to the main diagonal. Thus, the resulting pattern looks - // like - // +-----------------+ - // +* + - // +*** + - // +* * * + - // +** * * + - // +** * * + - // +* * * * + - // +* * * * + - // +* * * * + - // +-----------------+ - // - // (as best reproducible with integer artihmetic) - // Note that the first nr rows will have elements past - // the diagonal. -#endif - - int nr = nz / N; /* average number of nonzeros per row */ - int anz = nr * N; /* _actual_ number of nonzeros */ - - double *val = RandomVector(anz, R); - int *col = (int *)malloc(sizeof(int) * nz); - int *row = (int *)malloc(sizeof(int) * (N + 1)); - int r = 0; - int cycles = 1; - - Stopwatch Q = new_Stopwatch(); - - row[0] = 0; - for (r = 0; r < N; r++) { - /* initialize elements for row r */ - - int rowr = row[r]; - int step = r / nr; - int i = 0; - - row[r + 1] = rowr + nr; - if (step < 1) - step = 1; /* take at least unit steps */ - - for (i = 0; i < nr; i++) - col[rowr + i] = i * step; - } - - while (1) { - Stopwatch_start(Q); - SparseCompRow_matmult(N, y, val, row, col, x, cycles); - Stopwatch_stop(Q); - if (Stopwatch_read(Q) >= min_time) - break; - - cycles *= 2; - } - /* approx Mflops */ - result = SparseCompRow_num_flops(N, nz, cycles) / Stopwatch_read(Q) * 1.0e-6; - - Stopwatch_delete(Q); - free(row); - free(col); - free(val); - free(y); - free(x); - - return result; -} - -double kernel_measureLU(int N, double min_time, Random R) { - double **A = NULL; - double **lu = NULL; - int *pivot = NULL; - - Stopwatch Q = new_Stopwatch(); - double result = 0.0; - int i = 0; - int cycles = 1; - - if ((A = RandomMatrix(N, N, R)) == NULL) - exit(1); - if ((lu = new_Array2D_double(N, N)) == NULL) - exit(1); - if ((pivot = (int *)malloc(N * sizeof(int))) == NULL) - exit(1); - - while (1) { - Stopwatch_start(Q); - for (i = 0; i < cycles; i++) { - Array2D_double_copy(N, N, lu, A); - LU_factor(N, N, lu, pivot); - } - Stopwatch_stop(Q); - if (Stopwatch_read(Q) >= min_time) - break; - - cycles *= 2; - } - /* approx Mflops */ - result = LU_num_flops(N) * cycles / Stopwatch_read(Q) * 1.0e-6; - - Stopwatch_delete(Q); - free(pivot); - Array2D_double_delete(N, N, lu); - Array2D_double_delete(N, N, A); - - return result; -} diff --git a/Validation/Performance/bin/kernel.h b/Validation/Performance/bin/kernel.h deleted file mode 100644 index b3955d0829dca..0000000000000 --- a/Validation/Performance/bin/kernel.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef KERNEL_H -#define KERNEL_H - -#include "Random.h" -double kernel_measureFFT(int FFT_size, double min_time, Random R); -double kernel_measureSOR(int SOR_size, double min_time, Random R); -double kernel_measureMonteCarlo(double min_time, Random R); -double kernel_measureSparseMatMult(int Sparse_size_N, int Sparse_size_nz, double min_time, Random R); -double kernel_measureLU(int LU_size, double min_time, Random R); - -#endif diff --git a/Validation/Performance/bin/scimark2.c b/Validation/Performance/bin/scimark2.c deleted file mode 100644 index f1565ad77db0e..0000000000000 --- a/Validation/Performance/bin/scimark2.c +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include -#include - -#include "Random.h" -#include "kernel.h" -#include "constants.h" - -void print_banner(void); - -int main(int argc, char *argv[]) { - /* default to the (small) cache-contained version */ - - double min_time = RESOLUTION_DEFAULT; - - int FFT_size = FFT_SIZE; - int SOR_size = SOR_SIZE; - int Sparse_size_M = SPARSE_SIZE_M; - int Sparse_size_nz = SPARSE_SIZE_nz; - int LU_size = LU_SIZE; - - /* run the benchmark */ - - double res[6] = {0.0}; - Random R = new_Random_seed(RANDOM_SEED); - - if (argc > 1) { - int current_arg = 1; - - if (strcmp(argv[1], "-help") == 0 || strcmp(argv[1], "-h") == 0) { - fprintf(stderr, "Usage: [-large] [minimum_time]\n"); - exit(0); - } - - if (strcmp(argv[1], "-large") == 0) { - FFT_size = LG_FFT_SIZE; - SOR_size = LG_SOR_SIZE; - Sparse_size_M = LG_SPARSE_SIZE_M; - Sparse_size_nz = LG_SPARSE_SIZE_nz; - LU_size = LG_LU_SIZE; - - current_arg++; - } - - if (current_arg < argc) { - min_time = atof(argv[current_arg]); - } - } - - print_banner(); - printf("Using %10.2f seconds min time per kenel.\n", min_time); - - res[1] = kernel_measureFFT(FFT_size, min_time, R); - res[2] = kernel_measureSOR(SOR_size, min_time, R); - res[3] = kernel_measureMonteCarlo(min_time, R); - res[4] = kernel_measureSparseMatMult(Sparse_size_M, Sparse_size_nz, min_time, R); - res[5] = kernel_measureLU(LU_size, min_time, R); - - res[0] = (res[1] + res[2] + res[3] + res[4] + res[5]) / 5; - - /* print out results */ - printf("Composite Score: %8.2f\n", res[0]); - printf("FFT Mflops: %8.2f (N=%d)\n", res[1], FFT_size); - printf("SOR Mflops: %8.2f (%d x %d)\n", res[2], SOR_size, SOR_size); - printf("MonteCarlo: Mflops: %8.2f\n", res[3]); - printf("Sparse matmult Mflops: %8.2f (N=%d, nz=%d)\n", res[4], Sparse_size_M, Sparse_size_nz); - printf("LU Mflops: %8.2f (M=%d, N=%d)\n", res[5], LU_size, LU_size); - - Random_delete(R); - - return 0; -} - -void print_banner() { - printf("** **\n"); - printf("** SciMark2 Numeric Benchmark, see http://math.nist.gov/scimark **\n"); - printf("** for details. (Results can be submitted to pozo@nist.gov) **\n"); - printf("** **\n"); -} diff --git a/Validation/Performance/bin/scimark2.h b/Validation/Performance/bin/scimark2.h deleted file mode 100644 index 915752975bc46..0000000000000 --- a/Validation/Performance/bin/scimark2.h +++ /dev/null @@ -1,19 +0,0 @@ - -#ifndef SCIMARK2_H -#define SCIMARK2_H - -#define VERSION 2.0 - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#endif diff --git a/Validation/Performance/scripts/cmsScimarkLaunch.csh b/Validation/Performance/scripts/cmsScimarkLaunch.csh deleted file mode 100755 index 46c1f0b8f8cf9..0000000000000 --- a/Validation/Performance/scripts/cmsScimarkLaunch.csh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/csh -#The script should always be invoked with 1 argument: -#the cpu core number -#(0-4 on our lxbuild machines, 0-8 on dual quad-core machines). -#E.g (the ./ should not be necessary once this script is in CVS): -#taskset -c 0 ./cmsScimarkLaunch.csh 0 -#or -#taskset -c 2 ./cmsScimarkLaunch.csh 2 -#Set the environment -eval `scramv1 runtime -csh` -#Check if the cmsScimark output file exists: -#if it does, move it to _old.log -if (-e cmsScimark_$1.log) then -mv cmsScimark_$1.log cmsScimark_$1_old.log -endif -#Get the date in the log for each iteration -date>cmsScimark_$1.log -set iterations=0 -#Infinite loop of subsequent submissions of cmsScimark -while 1 -#Script assumes cmsScimark2 command is in the release: -cmsScimark2>>cmsScimark_$1.log -#echo "$CMSSW_RELEASE_BASE/bin/slc4_ia32_gcc345/cmsScimark2>>cmsScimark_$1.log" -date>>cmsScimark_$1.log -#The following part was thought as a complement to this script: -#Automatically parse the logs and produce a Root plot -#of the Composite Score vs time and of the Composite Score distribution -#in a html. -#Unfortunately it seems that using Root, after the number of Composite Scores -#approaches ~2000, one starts to get segmentation faults if using the -#SetBatch(1) option in PyRoot. This options avoids the annoying popping up of -#X-windows (Root canvases) every time a plot is made. -#As a consequence the SetBatch(1) option became SetBatch(0) by default in the -#parsing/plotting script. -#So the solution for now is to exclude this parsing/plotting part from this -#script, letting the user run it by hand when (s)he wants to see the results. -#Alternatively one could uncomment the following and set a large number of -#iterations at which to parse/publish the results, thus minimizing the -#canvas popping... -#Check if a cmsScimark results directory exists already for the wanted cpu: -#if not create it. -#if (!(-e cmsScimarkResults_cpu$1)) then -#mkdir cmsScimarkResults_cpu$1 -#endif -#@ iterations = $iterations + 1 -#if (!($iterations % 500)) then -#echo $iterations -#./cmsScimarkParser.py -i cmsScimark_$1.log -o cmsScimarkResults_cpu$1 -#echo "./cmsScimarkParser.py -i cmsScimark_$1.log -o cmsScimarkResults_cpu$1" -#endif -end - diff --git a/Validation/Performance/scripts/cmsScimarkParser.py b/Validation/Performance/scripts/cmsScimarkParser.py deleted file mode 100755 index 68ffa1e365842..0000000000000 --- a/Validation/Performance/scripts/cmsScimarkParser.py +++ /dev/null @@ -1,211 +0,0 @@ -#! /usr/bin/env python3 -#Script cloned from cmsTiming_parser.py - -from __future__ import print_function -def get_max(data,index=1): - max_score=-1 - for el in data: - sec=el[index] - if max_scoresec: - min_score=sec - return min_score - -def manipulate_log(outdir,logfile_name,secsperbin): - - import time - import sys - import ROOT - - # the fundamental structure: the key is the evt number the value is a list containing - # Composite Score - data=[] - - # open file and read it and fill the structure! - logfile=open(logfile_name,'r') - logfile_lines=logfile.readlines() - if not logfile_lines: - print("The logfile %s is empty! Exiting now."%logfile_name) - sys.exit() - logfile.close() - - # we get the info we need! - i=0 - bench_number=0; - while i < len(logfile_lines): - line=logfile_lines[i] - #if 'TimeEvent>' in line: - if 'Composite Score:' in line: - line=line[:-1] #no \n! - line_content_list=line.split() - #event_number=int(line_content_list[1]) - #seconds=float(line_content_list[3]) - composite_score=float(line_content_list[2]) - #data.append((event_number,seconds)) - bench_number+=1 - data.append((bench_number,composite_score)) - i+=1 - - # init Graph and histo - - # The Graphs - __argv=sys.argv # trick for a strange behaviour of the TApp.. - sys.argv=sys.argv[:1] - ROOT.gROOT.SetStyle("Plain") # style paranoia - sys.argv=__argv - #Cannot use this option when the logfile includes ~2000 - #Composite Scores or more... PyRoot seg-faults. - #Set ROOT in batch mode to avoid canvases popping up! - #ROOT.gROOT.SetBatch(1) - - # Save in file - rootfilename='%s/graphs.root' %outdir - myfile=ROOT.TFile(rootfilename,'RECREATE') - - - # Set fancy limits - min_val=get_min(data,1) - max_val=get_max(data,1) - interval=int(max_val-min_val) - - min_val=min_val-interval*0.2 - max_val=max_val+interval*0.2 - interval=int(max_val-min_val) - - nbins=int(interval/secsperbin) - - print('Minval=',min_val,' maxval=',max_val, ' interval=',interval) - - histo=ROOT.TH1F('Composite Score(Mflops)','Composite Score (Mflops)',nbins,min_val,max_val) - histo.GetXaxis().SetTitle("Mflops") - - npoints=len(data) - - graph=ROOT.TGraph(npoints) - graph.SetMarkerStyle(8) - graph.SetMarkerSize(.7) - graph.SetMarkerColor(1) - graph.SetLineWidth(3) - graph.SetLineColor(2) - graph.SetTitle('Composite Score') - graph.SetName('Composite Score') - graph.GetXaxis().SetTitle("Benchmark sequential number") - - last_event=data[-1][0] - print('last event =',last_event) - graph.GetXaxis().SetLimits(0,last_event) - - graph.GetYaxis().SetTitleOffset(1.3) - graph.GetYaxis().SetTitle("Mflops") - graph.GetYaxis().SetRangeUser(min_val,max_val) - - - - # Fill them - - evt_counter=0 - for bench_number,composite_score in data: - graph.SetPoint(evt_counter,bench_number,composite_score) - histo.Fill(composite_score) - evt_counter+=1 - - #A line which represents the average is drawn in the TGraph - avg=histo.GetMean() - avg_line=ROOT.TLine(1,avg,last_event,avg) - avg_line.SetLineColor(4) - avg_line.SetLineWidth(2) - - # draw and save! - graph_canvas=ROOT.TCanvas('graph_canvas') - graph_canvas.cd() - graph.Draw("ALP") - avg_line.Draw("Same") - - graph_canvas.Print("%s/graph.png" %outdir,"png") - - # write it on file - graph.Write() - graph_canvas.Write() - - histo_canvas=ROOT.TCanvas('histo_canvas') - histo_canvas.cd() - histo.Draw('') - - histo_canvas.Print("%s/histo.png" %outdir,"png") - - # write it on file - histo.Write() - histo_canvas.Write() - - myfile.Close() - - # The html page!------------------------------------------------------------------------------ - - titlestring='Report executed with release %s on %s.\n
\n
\n'\ - %(os.environ['CMSSW_VERSION'],time.asctime()) - - html_file_name='%s/%s.html' %(outdir,logfile_name[:-4])# a way to say the string until its last but 4th char - html_file=open(html_file_name,'w') - html_file.write('\n\n'+\ - titlestring) - html_file.write('\n'+\ - ''+\ - ''+\ - '
\n') - html_file.write('\n\n') - html_file.close() - - -################################################################################################# - -if __name__ == '__main__': - - import optparse - import os - - # Here we define an option parser to handle commandline options.. - usage='cmsScimarkParser.py ' - parser = optparse.OptionParser(usage) - parser.add_option('-i', '--in_ profile', - help='The profile to manipulate' , - default='', - dest='profile') - - parser.add_option('-o', '--outdir', - help='The directory of the output' , - default='', - dest='outdir') - - parser.add_option('-n', - help='Number of secs per bin. Default is 1.' , - default='1', - dest='startevt') - - (options,args) = parser.parse_args() - - # Now some fault control..If an error is found we raise an exception - if options.profile=='' or\ - options.outdir=='': - raise('Please select a profile and an output dir!') - - if not os.path.exists(options.profile) or\ - not os.path.exists(options.outdir): - raise ('Outdir or input profile not present!') - - try: - startevt=float(options.startevt) - except ValueError: - print('Problems in convertng starting event value!') - - - #launch the function! - manipulate_log(options.outdir,options.profile,startevt) - - diff --git a/Validation/Performance/scripts/cmsScimarkStop.py b/Validation/Performance/scripts/cmsScimarkStop.py deleted file mode 100755 index 243229ed32f45..0000000000000 --- a/Validation/Performance/scripts/cmsScimarkStop.py +++ /dev/null @@ -1,44 +0,0 @@ -#! /usr/bin/env python3 -#Script to -#1-check for cmsScimarkLaunch (infinite loop) scripts -#2-kill them -#3-report their results using cmsScimarkParser.py - -from __future__ import print_function -import subprocess,os,sys - -def main(): - #Use ps -ef to look for cmsScimarkLaunch processes - ps_stdouterr=subprocess.Popen("ps -efww|grep cmsScimarkLaunch|grep -v grep|grep -v 'sh -c'",shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout - if ps_stdouterr: - ps_lines=ps_stdouterr.readlines() - #print ps_lines - if ps_lines: - for line in ps_lines: - tokens=line.split() - #Look up the PID - PID=tokens[1] - #Look up the cpu core - core=tokens[9] - print("Found process:\n%s"%line[:-1]) #to eliminate the extra \n - #Kill the PID - print("Killing process with PID %s"%PID) - kill_stdouterr=subprocess.Popen("kill %s"%PID,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read() - print(kill_stdouterr) - #Harvest the cmsScimark scores - #Look for the cmsScimark log: - if os.path.exists("cmsScimark_%s.log"%core): - #Create the results dir - mkdir_stdouterr=subprocess.Popen("mkdir cmsScimarkResults_cpu%s"%core,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read() - print(mkdir_stdouterr) - #Execute the harvesting scrip cmsScimarkParser.py (it is in the release) - harvest_stdouterr=subprocess.Popen("cmsScimarkParser.py -i cmsScimark_%s.log -o cmsScimarkResults_cpu%s"%(core,core),shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read() - print(harvest_stdouterr) - else: - print("No cmsScimark_%s.log file was found for cpu%s, log might be in another directory!"%(core,core)) - else: - print("No cmsScimarkLaunch processes found in the ps -ef output") - return 0 - -if __name__ == "__main__": - sys.exit(main())