Anyone?
ilmar
for (k = 0; k<SIZE-1; k++) {
/* set col values to column k of A */
for (n = k; n<SIZE; n++) {
col[n] = A[n][k];
}
/* scale values of A by multiplier */
for (n = k+1; n<SIZE; n++) {
A[k][n] /= col[k];
}
/* set row values to row k of A */
for (n = k+1; n<SIZE; n++) {
row[n] = A[k][n];
}
/* Here we update A by subtracting the appropriate values from row
and column. Note that these adjustments to A can be done in
any order */
#pragma omp parallel for shared(A, row, col)
for (i = k+1; i<SIZE; i++) {
for (j = k+1; j<SIZE; j++) {
A[i][j] = A[i][j] - row[i] * col[j];
}
}
}
% icc combined.c
% time a.out
e started at 0
e done at 5970000
pi started at 5970000
pi done at 11060000
integration started at 11060000
integration done at 19930000
Values: e*pi = 8.539734, integral = 9.666667
Total elapsed time: 19930.000 seconds
19.901u 0.035s 0:20.02 99.5% 0+0k 0+0io 0pf+0w
% setenv OMP_DYNAMIC FALSE
% setenv OMP_NUM_THREADS 2
% icc -openmp combined_mp.c
combined_mp.c(33) : (col. 1) remark: OpenMP DEFINED SECTION WAS PARALLELIZED.
combined_mp.c(65) : (col. 1) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
combined_mp.c(31) : (col. 1) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
% time a.out
e started at 0
pi started at 0
e done at 14600000
integration started at 14600000
pi done at 15190000
integration started at 15190000
integration done at 30840000
Values: e*pi = 8.539734, integral = 9.666667
Total elapsed time: 30980.000 seconds
30.963u 0.028s 0:15.64 198.0% 0+0k 0+0io 0pf+0w
% cc -xO3 combined.c
% time a.out
e started at 0
e done at 120000
pi started at 120000
pi done at 7680000
integration started at 7680000
integration done at 17620000
Values: e*pi = 8.539734, integral = 9.666667
Total elapsed time: 17620.000 seconds
17.0u 0.0s 0:17 96% 0+0k 0+0io 0pf+0w
% setenv OMP_DYNAMIC FALSE
% setenv OMP_NUM_THREADS 2
% cc -xO3 -xopenmp combined_mp.c
% time a.out
e started at 0
pi started at 0
e done at 230000
integration started at 230000
integration done at 9670000
pi done at 12650000
integration started at 12650000
Values: e*pi = 8.539734, integral = 9.666667
Total elapsed time: 17570.000 seconds
17.0u 0.0s 0:12 131% 0+0k 0+0io 0pf+0w
% setenv OMP_NUM_THREADS 4
% time a.out
integration started at 0
integration started at 0
e started at 0
pi started at 0
e done at 390000
integration started at 390000
integration done at 9340000
pi done at 14920000
integration started at 14920000
Values: e*pi = 8.539734, integral = 9.666667
Total elapsed time: 17310.000 seconds
17.0u 0.0s 0:09 170% 0+0k 0+0io 0pf+0w
Users browsing this forum: Google [Bot], Yahoo [Bot] and 11 guests