Skip to content

Commit 513ecbc

Browse files
committed
Profile model_hessian
Signed-off-by: Igor S. Gerasimov <foxtranigor@gmail.com>
1 parent 8eeded2 commit 513ecbc

File tree

3 files changed

+118
-2
lines changed

3 files changed

+118
-2
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ list(APPEND srcs
108108
"${dir}/mdoptim.f90"
109109
"${dir}/metadynamic.f90"
110110
"${dir}/modef.f90"
111-
"${dir}/model_hessian.f90"
111+
"${dir}/model_hessian.F90"
112112
"${dir}/neighbor.f90"
113113
"${dir}/onetri.f90"
114114
"${dir}/oniom.f90"

src/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ srcs += files(
106106
'mdoptim.f90',
107107
'metadynamic.f90',
108108
'modef.f90',
109-
'model_hessian.f90',
109+
'model_hessian.F90',
110110
'neighbor.f90',
111111
'onetri.f90',
112112
'oniom.f90',

src/model_hessian.f90 renamed to src/model_hessian.F90

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ module xtb_modelhessian
9797
! factor somewhere hidden in the implementation below.
9898
!! ------------------------------------------------------------------------
9999
subroutine mh_swart(xyz,n,hess,at,modh)
100+
101+
#ifdef WITH_TRACY
102+
use tracy
103+
use iso_c_binding, only: c_int64_t
104+
#endif
105+
100106
use xtb_mctc_constants
101107
use xtb_mctc_convert
102108
use xtb_mctc_param, only: rad => covalent_radius_2009
@@ -118,6 +124,16 @@ subroutine mh_swart(xyz,n,hess,at,modh)
118124
type(chrg_parameter) :: chrgeq
119125
real(wp) :: kd
120126

127+
#ifdef WITH_TRACY
128+
type(tracy_zone_context) :: ctx
129+
integer(c_int64_t) :: srcloc_id
130+
#endif
131+
132+
#ifdef WITH_TRACY
133+
srcloc_id = tracy_alloc_srcloc(__LINE__, "src/model_hessian.F90", "mh_swart", color=TracyColors%HotPink2)
134+
ctx = tracy_zone_begin(srcloc_id)
135+
#endif
136+
121137
allocate( lcutoff(n,n), source=.false.)
122138

123139
n3=3*n
@@ -138,6 +154,10 @@ subroutine mh_swart(xyz,n,hess,at,modh)
138154
call mh_eeq(n,at,xyz,0.0_wp,chrgeq,modh%kq,hess)
139155
endif
140156

157+
#ifdef WITH_TRACY
158+
call tracy_zone_end(ctx)
159+
#endif
160+
141161
end subroutine mh_swart
142162

143163
pure subroutine mh_swart_stretch(n,at,xyz,hess,kr,kd,s6,rcov,rvdw,lcutoff,rcut)
@@ -716,6 +736,10 @@ end subroutine mh_swart_outofp
716736
! factor somewhere hidden in the implementation below.
717737
!! ------------------------------------------------------------------------
718738
subroutine mh_lindh_d2(xyz,n,hess,at,modh)
739+
#ifdef WITH_TRACY
740+
use tracy
741+
use iso_c_binding, only: c_int64_t
742+
#endif
719743
use xtb_mctc_constants
720744
use xtb_mctc_convert
721745

@@ -748,6 +772,16 @@ subroutine mh_lindh_d2(xyz,n,hess,at,modh)
748772
logical, allocatable :: lcutoff(:,:)
749773
type(chrg_parameter) :: chrgeq
750774

775+
#ifdef WITH_TRACY
776+
type(tracy_zone_context) :: ctx
777+
integer(c_int64_t) :: srcloc_id
778+
#endif
779+
780+
#ifdef WITH_TRACY
781+
srcloc_id = tracy_alloc_srcloc(__LINE__, "src/model_hessian.F90", "mh_lindh_d2", color=TracyColors%HotPink2)
782+
ctx = tracy_zone_begin(srcloc_id)
783+
#endif
784+
751785
allocate( lcutoff(n,n), source=.false.)
752786

753787
n3=3*n
@@ -768,6 +802,10 @@ subroutine mh_lindh_d2(xyz,n,hess,at,modh)
768802
call mh_eeq(n,at,xyz,0.0_wp,chrgeq,modh%kq,hess)
769803
endif
770804

805+
#ifdef WITH_TRACY
806+
call tracy_zone_end(ctx)
807+
#endif
808+
771809
end subroutine mh_lindh_d2
772810

773811
!! ========================================================================
@@ -797,6 +835,10 @@ end subroutine mh_lindh_d2
797835
!
798836
!! ------------------------------------------------------------------------
799837
subroutine mh_lindh(xyz,n,hess,at,modh)
838+
#ifdef WITH_TRACY
839+
use tracy
840+
use iso_c_binding, only: c_int64_t
841+
#endif
800842
use xtb_mctc_constants
801843
use xtb_mctc_convert
802844

@@ -829,6 +871,16 @@ subroutine mh_lindh(xyz,n,hess,at,modh)
829871
logical, allocatable :: lcutoff(:,:)
830872
type(chrg_parameter) :: chrgeq
831873

874+
#ifdef WITH_TRACY
875+
type(tracy_zone_context) :: ctx
876+
integer(c_int64_t) :: srcloc_id
877+
#endif
878+
879+
#ifdef WITH_TRACY
880+
srcloc_id = tracy_alloc_srcloc(__LINE__, "src/model_hessian.F90", "mh_lindh", color=TracyColors%HotPink2)
881+
ctx = tracy_zone_begin(srcloc_id)
882+
#endif
883+
832884
allocate( lcutoff(n,n), source=.false.)
833885

834886
n3=3*n
@@ -849,6 +901,10 @@ subroutine mh_lindh(xyz,n,hess,at,modh)
849901
call mh_eeq(n,at,xyz,0.0_wp,chrgeq,modh%kq,hess)
850902
endif
851903

904+
#ifdef WITH_TRACY
905+
call tracy_zone_end(ctx)
906+
#endif
907+
852908
end subroutine mh_lindh
853909

854910
pure subroutine mh_lindh_stretch(n,at,xyz,hess,kr,kd,s6,aav,rav,dav,lcutoff,rcut)
@@ -1772,6 +1828,10 @@ pure elemental function fk_vdw(alpha,r0,r2) result(gmm)
17721828
end function fk_vdw
17731829

17741830
subroutine mh_eeq(n,at,xyz,chrg,chrgeq,kq,hess)
1831+
#ifdef WITH_TRACY
1832+
use tracy
1833+
use iso_c_binding, only: c_int64_t
1834+
#endif
17751835
use xtb_type_param
17761836
implicit none
17771837

@@ -1836,6 +1896,19 @@ subroutine mh_eeq(n,at,xyz,chrg,chrgeq,kq,hess)
18361896
integer :: info
18371897
real(wp) :: test(1)
18381898

1899+
!!
1900+
! Tracy profiler
1901+
!!
1902+
#ifdef WITH_TRACY
1903+
type(tracy_zone_context) :: ctx
1904+
integer(c_int64_t) :: srcloc_id
1905+
#endif
1906+
1907+
#ifdef WITH_TRACY
1908+
srcloc_id = tracy_alloc_srcloc(__LINE__, "src/model_hessian.F90", "mh_eeq", color=TracyColors%HotPink2)
1909+
ctx = tracy_zone_begin(srcloc_id)
1910+
#endif
1911+
18391912
!! ------------------------------------------------------------------------
18401913
! initizialization
18411914
!! ------------------------------------------------------------------------
@@ -2078,11 +2151,19 @@ subroutine mh_eeq(n,at,xyz,chrg,chrgeq,kq,hess)
20782151
!call dgemm('n','t',3*n,m,3*n,+1.0_wp,dqdr,3*n,dAmat,3*n,1.0_wp,hessian,3*n)
20792152
!call dgemm('n','t',3*n,m,3*n,+1.0_wp,dAmat,3*n,dqdr,3*n,1.0_wp,hessian,3*n)
20802153

2154+
#ifdef WITH_TRACY
2155+
call tracy_zone_end(ctx)
2156+
#endif
2157+
20812158
end subroutine mh_eeq
20822159

20832160
end module xtb_modelhessian
20842161

20852162
subroutine ddvopt(Cart,nAtoms,Hess,iANr,s6)
2163+
#ifdef WITH_TRACY
2164+
use tracy
2165+
use iso_c_binding, only: c_int64_t
2166+
#endif
20862167
Implicit Integer(i-n)
20872168
Implicit Real*8 (a-h, o-z)
20882169
! include "common/real.inc" (molpro 2002.6)
@@ -2158,6 +2239,11 @@ subroutine ddvopt(Cart,nAtoms,Hess,iANr,s6)
21582239
& 46*2.d0/
21592240
!cc End: VDWx ccccccccccccccccc
21602241

2242+
#ifdef WITH_TRACY
2243+
type(tracy_zone_context) :: ctx
2244+
integer(c_int64_t) :: srcloc_id
2245+
#endif
2246+
21612247
!
21622248
!------- Statement functions
21632249
!
@@ -2167,6 +2253,11 @@ subroutine ddvopt(Cart,nAtoms,Hess,iANr,s6)
21672253
& Min(ixyz(i,iAtom),ixyz(j,jAtom)))
21682254
!end
21692255

2256+
#ifdef WITH_TRACY
2257+
srcloc_id = tracy_alloc_srcloc(__LINE__, "src/model_hessian.F90", "ddvopt", color=TracyColors%HotPink2)
2258+
ctx = tracy_zone_begin(srcloc_id)
2259+
#endif
2260+
21702261
!cc VDWx cccccccccccccccccccc
21712262
c6 = 50.0
21722263
c6( 1)=0.14
@@ -2646,10 +2737,19 @@ subroutine ddvopt(Cart,nAtoms,Hess,iANr,s6)
26462737
End Do ! iAtom
26472738
End Do ! kAtom
26482739
End Do ! jAtom
2740+
2741+
#ifdef WITH_TRACY
2742+
call tracy_zone_end(ctx)
2743+
#endif
2744+
26492745
Return
26502746
End
26512747

26522748
subroutine gff_ddvopt(Cart,nAtoms,Hess,at,s6,param,topo,neigh)
2749+
#ifdef WITH_TRACY
2750+
use tracy
2751+
use iso_c_binding, only: c_int64_t
2752+
#endif
26532753
use xtb_gfnff_data, only : TGFFData
26542754
use xtb_gfnff_topology, only : TGFFTopology
26552755
use xtb_gfnff_neighbor, only : TNeigh
@@ -2721,13 +2821,24 @@ subroutine gff_ddvopt(Cart,nAtoms,Hess,at,s6,param,topo,neigh)
27212821
& One2C2=0.2662567690426443D-04)
27222822

27232823
type(tb_timer) :: timer
2824+
2825+
#ifdef WITH_TRACY
2826+
type(tracy_zone_context) :: ctx
2827+
integer(c_int64_t) :: srcloc_id
2828+
#endif
2829+
27242830
! inline fct
27252831
lina(i,j)=min(i,j)+max(i,j)*(max(i,j)-1)/2
27262832
ixyz(i,iAtom) = (iAtom-1)*3 + i
27272833
Jnd(i,j) = i*(i-1)/2 +j
27282834
Ind(i,iAtom,j,jAtom)=Jnd(Max(ixyz(i,iAtom),ixyz(j,jAtom)),&
27292835
& Min(ixyz(i,iAtom),ixyz(j,jAtom)))
27302836

2837+
#ifdef WITH_TRACY
2838+
srcloc_id = tracy_alloc_srcloc(__LINE__, "src/model_hessian.F90", "gff_ddvopt", color=TracyColors%HotPink2)
2839+
ctx = tracy_zone_begin(srcloc_id)
2840+
#endif
2841+
27312842
! map heavy atoms to Z<=54
27322843
do i=1,nAtoms
27332844
iANr(i)=at(i)
@@ -3128,6 +3239,11 @@ subroutine gff_ddvopt(Cart,nAtoms,Hess,at,s6,param,topo,neigh)
31283239

31293240
if (profile) call timer%measure(3)
31303241
if (profile) call timer%write(6,'modhes')
3242+
3243+
#ifdef WITH_TRACY
3244+
call tracy_zone_end(ctx)
3245+
#endif
3246+
31313247
Return
31323248
End
31333249

0 commit comments

Comments
 (0)