Skip to content
Snippets Groups Projects
Verified Commit 7f34feee authored by Dorian Stoll's avatar Dorian Stoll
Browse files

rodinia-srad: c: Remove option to specify OMP threads

This option is
 - redundant, the OpenMP threads can be set with an environment variable
 - not portable to other threading frameworks (e.g. Julia)
 - not necessary, because we want all threads to be used
parent 6f64d72c
No related branches found
No related tags found
No related merge requests found
Usage: Usage:
srad 128 128 0 31 0 31 4 0.5 2 srad 128 128 0 31 0 31 0.5 2
128 //number of rows in the domain 128 //number of rows in the domain
128 //number of cols in the domain 128 //number of cols in the domain
...@@ -7,7 +7,6 @@ srad 128 128 0 31 0 31 4 0.5 2 ...@@ -7,7 +7,6 @@ srad 128 128 0 31 0 31 4 0.5 2
31 //y2 position of the speckle 31 //y2 position of the speckle
0 //x1 position of the speckle 0 //x1 position of the speckle
31 //x2 position of the speckle 31 //x2 position of the speckle
4 //number of threads
0.5 //Lambda value 0.5 //Lambda value
2 //number of iterations 2 //number of iterations
...@@ -11,16 +11,13 @@ ...@@ -11,16 +11,13 @@
void random_matrix(float *I, int rows, int cols); void random_matrix(float *I, int rows, int cols);
void usage(int argc, char **argv) { void usage(int argc, char **argv) {
fprintf(stderr, "Usage: %s <rows> <cols> <y1> <y2> <x1> <x2> <no. of " fprintf(stderr, "Usage: %s <rows> <cols> <y1> <y2> <x1> <x2> <lamda> <no. of iter>\n", argv[0]);
"threads><lamda> <no. of iter>\n",
argv[0]);
fprintf(stderr, "\t<rows> - number of rows\n"); fprintf(stderr, "\t<rows> - number of rows\n");
fprintf(stderr, "\t<cols> - number of cols\n"); fprintf(stderr, "\t<cols> - number of cols\n");
fprintf(stderr, "\t<y1> - y1 value of the speckle\n"); fprintf(stderr, "\t<y1> - y1 value of the speckle\n");
fprintf(stderr, "\t<y2> - y2 value of the speckle\n"); fprintf(stderr, "\t<y2> - y2 value of the speckle\n");
fprintf(stderr, "\t<x1> - x1 value of the speckle\n"); fprintf(stderr, "\t<x1> - x1 value of the speckle\n");
fprintf(stderr, "\t<x2> - x2 value of the speckle\n"); fprintf(stderr, "\t<x2> - x2 value of the speckle\n");
fprintf(stderr, "\t<no. of threads> - no. of threads\n");
fprintf(stderr, "\t<lamda> - lambda (0,1)\n"); fprintf(stderr, "\t<lamda> - lambda (0,1)\n");
fprintf(stderr, "\t<no. of iter> - number of iterations\n"); fprintf(stderr, "\t<no. of iter> - number of iterations\n");
...@@ -38,9 +35,8 @@ int main(int argc, char *argv[]) { ...@@ -38,9 +35,8 @@ int main(int argc, char *argv[]) {
float *c, D; float *c, D;
float lambda; float lambda;
int i, j; int i, j;
int nthreads;
if (argc == 10) { if (argc == 9) {
rows = atoi(argv[1]); // number of rows in the domain rows = atoi(argv[1]); // number of rows in the domain
cols = atoi(argv[2]); // number of cols in the domain cols = atoi(argv[2]); // number of cols in the domain
if ((rows % 16 != 0) || (cols % 16 != 0)) { if ((rows % 16 != 0) || (cols % 16 != 0)) {
...@@ -51,9 +47,8 @@ int main(int argc, char *argv[]) { ...@@ -51,9 +47,8 @@ int main(int argc, char *argv[]) {
r2 = atoi(argv[4]); // y2 position of the speckle r2 = atoi(argv[4]); // y2 position of the speckle
c1 = atoi(argv[5]); // x1 position of the speckle c1 = atoi(argv[5]); // x1 position of the speckle
c2 = atoi(argv[6]); // x2 position of the speckle c2 = atoi(argv[6]); // x2 position of the speckle
nthreads = atoi(argv[7]); // number of threads lambda = atof(argv[7]); // Lambda value
lambda = atof(argv[8]); // Lambda value niter = atoi(argv[8]); // number of iterations
niter = atoi(argv[9]); // number of iterations
} else { } else {
usage(argc, argv); usage(argc, argv);
} }
...@@ -116,7 +111,6 @@ int main(int argc, char *argv[]) { ...@@ -116,7 +111,6 @@ int main(int argc, char *argv[]) {
q0sqr = varROI / (meanROI * meanROI); q0sqr = varROI / (meanROI * meanROI);
omp_set_num_threads(nthreads);
#pragma omp parallel for shared(J, dN, dS, dW, dE, c, rows, cols, iN, iS, jW, \ #pragma omp parallel for shared(J, dN, dS, dW, dE, c, rows, cols, iN, iS, jW, \
jE) private(i, j, k, Jc, G2, L, num, den, \ jE) private(i, j, k, Jc, G2, L, num, den, \
qsqr) qsqr)
...@@ -155,7 +149,6 @@ int main(int argc, char *argv[]) { ...@@ -155,7 +149,6 @@ int main(int argc, char *argv[]) {
} }
} }
omp_set_num_threads(nthreads);
#pragma omp parallel for shared(J, c, rows, cols, \ #pragma omp parallel for shared(J, c, rows, cols, \
lambda) private(i, j, k, D, cS, cN, cW, cE) lambda) private(i, j, k, D, cS, cN, cW, cE)
for (int i = 0; i < rows; i++) { for (int i = 0; i < rows; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment