Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7838 Discussions

Possible bug in ICC 12.1.0 on 64bit Linux within openMP parallel-for directive

torbjornk
Beginner
255 Views
For teaching myself OpenMP I wrote a small program multiplying a sparse matrix (in CRS) with a vector. It compiles perfectly fine with different versions of GCC but fails with ICC 12.1.0 on 64bit Linux.

Globally I defined

int default_n_row = 4;
int *n_row = &default_n_row;


and use this within the multiplication function as follows

#pragma omp parallel \\
default(none) \\
shared(n_row, aval, acolind, arowpt, vval, yval) \\
private(x, y)
{
#pragma omp for \\
schedule(static)
for ( x = 0; x < *n_row; x++ ) {
yval = 0;
for ( y = arowpt; y < arowpt[x+1]; y++ ) {
yval += aval * vval[ acolind ];
}
}
} /* end PARALLEL */


I compiled with

icc -openmp -O0 -g -std=c++0x -Wall -restrict -o matxvec_sparse matxvec_sparse.cpp

and get the following error:

matxvec_sparse.cpp(79): error: "default_n_row" must be specified in a variable list at enclosing OpenMP parallel pragma
#pragma omp parallel \\
^


In the OpenMP forum, one assumed that's a bug in ICC. [1] Can anybode here confirm this?

A workaround of this error is to add "default_n_row" to the list of shared variables. But according to the specs of OpenMP it should work without it as far as I understand them correctly.

[1] http://openmp.org/forum/viewtopic.php?p=5463&sid=44b15aaa327eb93c383e753008f83be0#p5463
0 Kudos
1 Reply
TimP
Black Belt
255 Views
Why not simply copy the loop length to a local shared variable value before entering the parallel region? You appear to be skirting unnecessarily close to the limits of what might be permissible or workable. As to whether presence of a shared clause implies default(none), it looks like better form to make such a restriction, even though it may not be specified where I can see it in the standard.
0 Kudos
Reply