- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
and use this within the multiplication function as follows
I compiled with
and get the following error:
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 "
[1] http://openmp.org/forum/viewtopic.php?p=5463&sid=44b15aaa327eb93c383e753008f83be0#p5463
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page