- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Colleagues:
I'm upgrading some legacy engineering code to take advantage of Coarray Fortran. In the routine I've started with there is only one coarray. It executes correctly with eight images and generates the same values as before. I can see the basic speedup in all the work done until, at the very end, I need to sum across the coarray that each image has contributed to. The array is ~ 3000 x 400, with 8 images. The basic work in each image that manipulates the local copy of this array is done in < 1 sec. But the summation performed at the very end of the code (in only the 1st image) takes 10 seconds.
sync all
if( this_image() == 1 ) then
do I = 2,num_images()
flux = flux + flux
end do
end if
Is coarray summing that inefficient? But I reserved the right to be doing this improperly! It is actually faster (by an order of magnitude) to have each image write out the local copy of the array, and have the 1st image read the files into local array(s) and perform the sum.
Any suggestions?
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
David,
It's Jim by the way.
Untested code
i=2
do while(i .lt. num_images())
sync all
if(mod(ImageNum-1,i) .eq. 0) then
array = array + array
endif
i = i * 2
end do
The idea is to double a stride each iteration with the summation performed by fewer and fewer images.
If you only have 2-8 systems then write it inline without the mod test as this will be clearer to the casual reader of the code.
Jim Dempsey
It's Jim by the way.
Untested code
i=2
do while(i .lt. num_images())
sync all
if(mod(ImageNum-1,i) .eq. 0) then
array = array + array
endif
i = i * 2
end do
The idea is to double a stride each iteration with the summation performed by fewer and fewer images.
If you only have 2-8 systems then write it inline without the mod test as this will be clearer to the casual reader of the code.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even better. Thanks.
(I guess I was thinking about the prize fighter!)
D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When your code is working, please report the runtimes (before and after). This may help others decide the value of the efforts to finish up respectibly.
Jim Dempsey
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
David,
The last untested code is in error. I think the first while test should be .LE. not .LT.
Sorry about the error. I am slipping (two programming errors this week).
Jim
The last untested code is in error. I think the first while test should be .LE. not .LT.
Sorry about the error. I am slipping (two programming errors this week).
Jim
Not applicable
09-20-2012
10:36 PM
1,115 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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