- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have been using Sun's f95 to do a value function iteration (economics problem). V_new(x)=max f(x,y)+V_old(y) where, maximization is over y such that y \in B(x) . The point is to find V_new=V_old.
I split the range of x's in eigth parts, and let OpenMP distribute the maximixation problem over 8 cores.
I have been now evaluation ifort on VS 2008 on Vista 32 and where my code always converged (and still converges) using sun's f95 OpenMP directives, ifort executable seem to linger forever.
Could you suggest which documentation should be on the top of my reading list?
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would hope that adding RECURSIVE to all subroutines which are called in a parallel region would cause the compiler to flag any explicit use of SAVE or DATA, as well as over-riding any implicit SAVE.
Although the RECUSIVE keyword will correct the anomaly, this (these) subroutines are NOT being called recursively. The proper term is REENTRANT(ly) or alternatly you could call the routine as being required to run CONCURRENT(ly).
Regardless of if the routine isRECUSIVE, REENTRANT or CONCURRENT there is not an explicit statement or attribute (other than AUTOMATIC) that says this array (or array discriptor) must reside on the stack. SAVE means static, absense of SAVE means, well, the intentions are inconclusive.
The use of RECURSIVE, when not required, also has some unintended consequences (overhead).
Per IVF documentation
An automatic array (the array is a local variable)
However elsewhere
Automatic Arrays
An automatic array is an explicit-shape array that is a local variable. Automatic arrays are only allowed in function and subroutine subprograms, and are declared in the specification part of the subprogram. At least one bound of an automatic array must be a nonconstant specification expression. The bounds are determined when the subprogram is called.
However, in practice, IVF permits all bounds of automatic arrays to be constant. (hooray for IVF)
AUTOMATIC explicitly states and requires the array is a local variable.
My 2 cents worth.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would hope that adding RECURSIVE to all subroutines which are called in a parallel region would cause the compiler to flag any explicit use of SAVE or DATA, as well as over-riding any implicit SAVE.
Although the RECUSIVE keyword will correct the anomaly, this (these) subroutines are NOT being called recursively. The proper term is REENTRANT(ly) or alternatly you could call the routine as being required to run CONCURRENT(ly).
Regardless of if the routine isRECUSIVE, REENTRANT or CONCURRENT there is not an explicit statement or attribute (other than AUTOMATIC) that says this array (or array discriptor) must reside on the stack. SAVE means static, absense of SAVE means, well, the intentions are inconclusive.
The use of RECURSIVE, when not required, also has some unintended consequences (overhead).
Per IVF documentation
An automatic array (the array is a local variable)
However elsewhere
Automatic Arrays
An automatic array is an explicit-shape array that is a local variable. Automatic arrays are only allowed in function and subroutine subprograms, and are declared in the specification part of the subprogram. At least one bound of an automatic array must be a nonconstant specification expression. The bounds are determined when the subprogram is called.
However, in practice, IVF permits all bounds of automatic arrays to be constant. (hooray for IVF)
AUTOMATIC explicitly states and requires the array is a local variable.
My 2 cents worth.
Jim Dempsey
Before breaking out for dinner; I just wanted to add, that I added RECURSIVE infront of all subroutines in my code and the problem *prevails". that is, ifort linux 11.082 and sun's f95 generate an executable that converge to the same solution and windows ifort's diverges.
I will try the automatic array idea next.
PS I have learned more fortran in the last 24 hours than in the last year...thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Although the RECUSIVE keyword will correct the anomaly, this (these) subroutines are NOT being called recursively. The proper term is REENTRANT(ly) or alternatly you could call the routine as being required to run CONCURRENT(ly).
Regardless of if the routine isRECUSIVE, REENTRANT or CONCURRENT there is not an explicit statement or attribute (other than AUTOMATIC) that says this array (or array discriptor) must reside on the stack. SAVE means static, absense of SAVE means, well, the intentions are inconclusive.
The use of RECURSIVE, when not required, also has some unintended consequences (overhead).
Per IVF documentation
An automatic array (the array is a local variable)
However elsewhere
Automatic Arrays
An automatic array is an explicit-shape array that is a local variable. Automatic arrays are only allowed in function and subroutine subprograms, and are declared in the specification part of the subprogram. At least one bound of an automatic array must be a nonconstant specification expression. The bounds are determined when the subprogram is called.
However, in practice, IVF permits all bounds of automatic arrays to be constant. (hooray for IVF)
AUTOMATIC explicitly states and requires the array is a local variable.
My 2 cents worth.
Jim Dempsey
As a follow up:
Bad news.
I added the AUTOMATIC reference to all three local arrays within the procedure being used concurrantly. No luck.
I added recursive to all procedures first, no luck. then I simply on top of that, added the flag -recursive at compilation time. No luck.
Noob question. Is the same OMP API being used in intel fortran linux and windows? I seem to remember, Sun's f95 uses OMP 2.5. is intel visual fortran compiler using 3.0 ? could that affect my code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried Intel Thread Checker?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried Intel Thread Checker?
Thanks, I will look into it.
Something I am still puzzled about is why the "same" compiler Intel's generate one solution under Windows and other if I use Intel's Compiler for Linux.
Could you tell me what would be the most likely -or at least, one that comes to mind- factor behind this differential behavior?
- 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
If you can accept that Fortran is as vulnerable to races as C++, here is a good article:
http://developers.sun.com/solaris/articles/cpp_race.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Race conditions are generally not a compilers fault, rather a programming fault. Uninitialized variables, shared written variables that are not atomic, shared read variable that are read before written, etc...
Thread Checker can find some of these as can adding uninitializedvariable runtime checking. Sometimes you may need to fall back on adding debug traps into your code (conditional compiled).
Assume you have an array in which portions of the array are to be exclusively written by seperate threads, and then read some time later after being written
real, allocatable:: foo(:,:,:)
Consider adding (conditional compiled)
integer, allocatable :: fooDEBUG(:,:,:)
...
fooDEBUG = -1
Where -1 in the cell indicates never been written.
And n means written by OpenMP team member number n
In the sections of code where you write to a cell, call a subroutine to verify ownership
if(fooDEBUG(i,j,k) .ne. myThreadNum) then
if(fooDEBUG(i,j,k) .ne. -1) then
write(*,*) 'bug' ! break here
else
iTemp = InterlockedExchange(fooDEBUG(i,j,k), myThreadNum)
if(iTemp .ne. -1) then
write(*,*) 'bug' ! break here
endif
endif
endif
In places where you read a cell under the assumption that it was written by another thread
if(fooDEBUG(i,j,k) .eq. -1) then
write(*,*) 'bug' ! break here
endif
Jim Dempsey
![](/skins/images/06022F5BB6D2F28C8F102671A0F06E85/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »