- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have the following loop parallelized with openmp directives:
do jg = 1,ng
c$omp parallel shared (jg,nr,nt,in,out) private (c1,i)
c$omp do schedule(dynamic,1)
do i = 1, nr
c copying the column of the three-dimensional array to
c one-dimensional array c1 of the size nt
c1 = in(0:nt-1,i,jg)
c calling some function affecting c1
f1 (c1,nt)
c copying the transformed array to output three-
c dimensional array
out(0:nt-1,i,jg) = c1
enddo
c$omp end do nowait
c$omp end parallel
enddo
While analyzing this code region with Thread Checker the read/write error is reported in this parallel region. But as I suppose there is no conflict in read/write access becuase each parallel thread deals with its own column of in and out arrays and c1 array is private to the threads.
How can I change this code to work properly? I can not exactly understand the nature of the error: whether it is impossible to declare the whole array c1 as private to the threads or the out array is treated as the instance i have to syncronyze access to.
If anyone dealed with parallelization in terms of openmp, would you please help me?
Thank you,
Olga
I have the following loop parallelized with openmp directives:
do jg = 1,ng
c$omp parallel shared (jg,nr,nt,in,out) private (c1,i)
c$omp do schedule(dynamic,1)
do i = 1, nr
c copying the column of the three-dimensional array to
c one-dimensional array c1 of the size nt
c1 = in(0:nt-1,i,jg)
c calling some function affecting c1
f1 (c1,nt)
c copying the transformed array to output three-
c dimensional array
out(0:nt-1,i,jg) = c1
enddo
c$omp end do nowait
c$omp end parallel
enddo
While analyzing this code region with Thread Checker the read/write error is reported in this parallel region. But as I suppose there is no conflict in read/write access becuase each parallel thread deals with its own column of in and out arrays and c1 array is private to the threads.
How can I change this code to work properly? I can not exactly understand the nature of the error: whether it is impossible to declare the whole array c1 as private to the threads or the out array is treated as the instance i have to syncronyze access to.
If anyone dealed with parallelization in terms of openmp, would you please help me?
Thank you,
Olga
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Olga,
I need more of the source code to knowif your program is correct. For example, how is c1 declared? The code is incorrect if array c1 has an allocatable or pointer attribute because the private clause will only create a copy of the descriptor, not the full array.
The threads could be overflowing their stacks. How large is nt? According to the Intel compiler documentation, the stacksize for OpenMP threads is only 2 MB for IA-32 and 4 MB for Itanium. What does Thread Checker report for stack usage?
Thefunction f1might not bethreadsafe? Is f1 included in the Thread Checker analysis?
Please provide more information.
Best regards,
Henry
Message Edited by hagabb on 03-25-2005 08:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello again Olga,
If we assume that your OpenMP code is correct, it's possible that Thread Checkeris notcorrectly analyzing theFortran 90 array notation. Try replacing the array statements with explicit loops:
do j = 1, nt
c1(j) = in(0:nt-1, i, jg)
enddo
f1 (c1, nt)
do j = 1, nt
out(0:nt-1, i, jg) = c1
enddo
If the read/write conflict disappears, it's a Thread Checker bug.
Best regards,
Henry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, Henry
Thank you for your answer. My c1 array is declared as local automatic array. Maybe the problem is the stack size. I've applied the attachment with the source code of the procedure. In my example ng = 2, nt = 1024 and nr = 450. Changing implicit loops on the explicit ones didn't help, the problem remains, so I also apply the report of the thread checker in the next message.
Thanks,
Olga
Thank you for your answer. My c1 array is declared as local automatic array. Maybe the problem is the stack size. I've applied the attachment with the source code of the procedure. In my example ng = 2, nt = 1024 and nr = 450. Changing implicit loops on the explicit ones didn't help, the problem remains, so I also apply the report of the thread checker in the next message.
Thanks,
Olga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the report generated by Thread Checker.
Olga
Olga

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