- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm building a vector-parallelized Fortran code. Looking at hot spots and waits, I found that
x_sum=SUM(X) and
x_sum = zero
Do i 1,n
x_sum = x_sum + X(i)
ENDDO
X is a real.
preform differently. In my code the do-loop is ~30% faster. Note there are a number of summations involved so that reflects an overall result for a test case.
Must be my error but please point it out to me.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You did not post an entire program, so this is a guess. What is the size of X? Is is possible that SIZE(X) > n , and when you do x_sum=SUM(X) , you are summing over more elements?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Roman,
Program is BIG with a number of subroutines and why I didn't post. The SUMs in question are in the routine that handles much of the computations.
n ~ 12500

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