- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The example from the specification for the taskq directive is running OK when the list pointer is argument of the function, but if it is a global variable I get the following error during compilation
icc -openmp -o main.o -c main.c
(0): internal error: backend signals
compilation aborted for main.c (code 4)
make[1]: *** [main.o] Error 4
This is the code I used to test this:
#include
#include
typedef struct list_s
{
struct list_s *next;
char data;
} list;
list *myp;
void do_work1(list *node)
{
printf("Thread %d - %c ", omp_get_thread_num(), node->data);
}
void test1()
{
#pragma intel omp parallel taskq shared(myp)
{
while (myp != NULL)
{
#pragma intel omp task captureprivate(myp)
{
do_work1(myp);
}
myp = myp->next;
}
}
}
int main()
{
list a, b, c;
omp_set_num_threads(3);
c.next = NULL;
c.data = 'c';
b.next = &c;
b.data = 'b';
a.next = &b;
a.data = 'a';myp = &a;
test1();
return 1;
}
What I figured out so far is that the problem is in captureprivate clause. For example if i just put myp in firstprivate clause of taskq, and remove the captureprivate clause from task directive, the program compiles and runs well.
Also if I keep captureprivate clause, but use private instead of shared clause in the taskq directive, the program will compile, but the results will be incorect, as expected.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This looks to me like a problem with the Intel work queueing extension, which was introduced at a time when the OpenMP standard did not support tasking. However, that has since changed, and the OpenMP 3.0 standard supports a task construct with comparable functionality but different syntax. This is in turn supported by version 11 of the Intel compiler. I'm not expert in this area, but I think this is how you would rewrite your test1 function for OpenMP 3.0:
void test1()
{
#pragma omp parallel shared(myp)
{
#pragma omp single
{
while (myp != NULL)
{
#pragma omp task firstprivate(myp)
{
do_work1(myp);
}
myp = myp->next;
}
}
}
}
Note the use of firstprivate instead of captureprivate, and of the single construct (to ensure that each task is submitted once only) instead of taskq. When I tried it, it seemed to work.
Because there is now a standard way to do tasking, I'm somewhat doubtful whether more work will be done on the Intel-specific extension. I see that you are using an older version 10.0 compiler - I'd encourage you to try the latest version (11.1) if possible, you can download an evaluation version from http://software.intel.com/en-us/intel-compilers/ (click on evaluate). With this compiler, the OpenMP 3.0 tasking model is the default; if you want to go back to the older Intel extension, you need to use the switch -openmp-task intel .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And just to be clear, in addition, latest compiler (11.1) doesn't crash compiling this :-)
Dale
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page