Skip to content

Commit a5e78c2

Browse files
committed
Speed up getf2
The idea is to be slightly more cache friendly when accessing the a array. As jj and ii are always > j we can extract access to the a array to occur of the jj and ii loops. This should minimise the number of cache lines that need to be constantly re-read in when doing the ii loop. Testing agaisnt split_burn_big_net didnt show any improvement (or worsening) but using the MESA's one zone burner in a standalone mode showed 30% speed up. While also showing no difference in final results.
1 parent c0cf2b8 commit a5e78c2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mtx/public/mtx_solve_routines.inc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
subroutine my_getf2(m, a, lda, ipiv, info)
44
integer :: info, lda, m
55
integer :: ipiv(:)
6-
real(dp) :: a(:,:)
6+
real(dp) :: a(:,:),aj(m)
77
real(dp), parameter :: one=1, zero=0
88
integer :: i, j, jp, ii, jj, n, mm
9-
real(dp) :: tmp, da
9+
real(dp) :: tmp, da, ajjj
1010
do j = 1, m
1111
info = 0
1212
jp = j - 1 + maxloc(abs(a(j:lda,j)),dim=1)
@@ -31,11 +31,13 @@
3131
info = j
3232
end if
3333
if( j.lt.m ) then
34+
aj = a(:,j)
3435
!call dger( m-j, m-j, -one, a( j+1, j ), 1, a( j, j+1 ), lda, a( j+1, j+1 ), lda )
3536
do jj = j+1, m
37+
ajjj = a(j,jj)
3638
!$omp simd
3739
do ii = j+1, m
38-
a(ii,jj) = a(ii,jj) - a(ii,j)*a(j,jj)
40+
a(ii,jj) = a(ii,jj) - aj(ii)*ajjj
3941
end do
4042
end do
4143
end if

0 commit comments

Comments
 (0)