- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I need some help to speed up a small portion of my fortran code.
Following code is inside several loops.
ix1 and iy1 variables are assigned in outer loops
ij = 0
do i = 1,4
ix1pi = ix1+i
do j = 1,4
ij = ij+1
q(ij,:) = dcube(:,ix1pi,iy1+j)
uxuy(ij,:) = ux(i)*uy(j)
enddo
enddo
sig2 = sum(q*uxuy,dim=1)
"dcube" is allocatable array.
My question is how to avoid copying columns or any other way of speeding this portion of code.
Thanks,
Shukur
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For one, I'd suggest reversing the bounds of q and uxuy (if you can), as the array sections you are assigning to are discontiguous and this is going to require an extra loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve!!! 2.3 faster. I think this is the case because this portion of the code is within 3 outer loops.
I am HAPPY.
Shukur

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