- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am compiling my project with /Qopenmp to process some simple do loops without any reduction. I get vastly different results in terms of accuracy with and without openmp. Any suggestions to overcome this ?
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
Your program has a bug. Disprove this last statement.
- 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
Sergey Kostrov wrote:
The question in the Initial Post was too generic and the MiB1980 user did not provide any sources.
That is precisely what Tony Richards hinted, but he employed sardonic humor instead of making direct statements!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a lot of DO statements. The calls where I find some precision change looks something like this
[fortran]
complex*16 a
integer*4 iarray,jarray
allocatable a(:),iarray(:),jarray(:)
allocate (a(1:n2),iarray(1:n2),jarray(1:n2))
!$OMP PARALLEL DO
do k=1,n2
i=iarray(k)
j=jarray(k)
call calculatexij(i,j,a(i))
enddo
!$OMP END PARALLEL DO
[/fortran]
Above is just an extract. The actual code is more complex than this with logic to populate the iarray, jarray etc. The main change is in the precision of the calculation of a(i).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For that specific example, you need to declare i and j as private.
- 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
When i and j are not declared as private(i,j), the default declaration is public(i,j)
Public(i,j) means all threads share i and j
The first thread to issue i=iarray(k), will have its result variable i overwritten by the next thread to issue i=iarray(k), and so on.
This results in some i,j combinations being evaluated twice, and
some combinations of i,j not being evaluated at all
Private(i,j) means each thread has separate variables i and j.
This results in all intended combinations of i,j to be evaluated once.
Jim Dempsey

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