Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debug compilation #800

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -fp-model precise")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check -check noarg_temp_created -check nopointer -fp-stack-check -fstack-protector-all -fpe0 -debug -ftrapuv")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check all -ftrapuv")
if(APPLE)
# The linker on macOS does not include `common symbols` by default.
# Passing the -c flag includes them and fixes an error with undefined symbols.
Expand All @@ -77,9 +77,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz")
endif()
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
# set(CMAKE_Fortran_FLAGS_DEBUG "-ggdb -Wall")
set(CMAKE_Fortran_FLAGS_DEBUG "-O1 -ggdb -Wall -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check -fno-omit-frame-pointer -fno-optimize-sibling-calls")
# set(CMAKE_Fortran_FLAGS_DEBUG "-ggdb -Wall -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check -fno-omit-frame-pointer -fno-optimize-sibling-calls")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -Wall -fcheck=all")
endif()

if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$")
Expand Down
5 changes: 3 additions & 2 deletions sorc/grid_tools.fd/regional_esg_grid.fd/pesg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,14 @@ subroutine xmtoxc_vak1(ak,xm,xc,xcd,xc1,xcd1,ff)! [xmtoxc_ak]
logical, intent(out):: ff
real(dp),dimension(3,2,2):: xcdd
real(dp),dimension(2,2,2):: xsd1,xsdd
real(dp),dimension(2,2) :: xtd,xsd,xs1,xtd1,xsdk
real(dp),dimension(2,2) :: xtd,xsd,xs1,xtd1,xsdk,mat22
real(dp),dimension(2) :: xt,xt1,xs,xsk
integer(spi) :: i
call xmtoxt1(ak(1),xm,xt,xtd,xt1,xtd1,ff); if(ff)return
call xttoxs1(ak(2),xt,xs,xsd,xsdd,xsk,xsdk,ff); if(ff)return
xs1(:,2)=xsk; xs1(:,1)=matmul(xsd,xt1)
xsd1(:,:,1)=matmul(xsd,xtd1)+matmul(xsdd(:,:,1)*xt1(1)+xsdd(:,:,2)*xt1(2),xtd)
mat22=xsdd(:,:,1)*xt1(1)+xsdd(:,:,2)*xt1(2)
xsd1(:,:,1)=matmul(xsd,xtd1)+matmul(mat22,xtd)
xsd1(:,:,2)=matmul(xsdk,xtd)
xsd=matmul(xsd,xtd)
call xstoxc(xs,xc,xcd,xcdd)
Expand Down
11 changes: 7 additions & 4 deletions sorc/grid_tools.fd/regional_esg_grid.fd/psym2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ subroutine logsym2d(x,z,zd)! [logsym2]
real(dp),dimension(2,2), intent(in ):: x
real(dp),dimension(2,2), intent(out):: z
real(dp),dimension(2,2,2,2),intent(out):: zd
real(dp),dimension(2,2):: vv,oo,d11,d12,d22,pqr
real(dp),dimension(2,2):: vv,oo,d11,d12,d22,pqr,d11pqr,d12pqr,d22pqr
real(dp) :: c,s,cc,cs,ss,c2h,p,q,r,lp,lq,L
integer(spi) :: i
call eigensym2(x,vv,oo)
Expand All @@ -424,9 +424,12 @@ subroutine logsym2d(x,z,zd)! [logsym2]
d12(1,:)=(/-cs,c2h/); d12(2,:)=(/c2h,cs/)
d22(1,:)=(/ ss,-cs/); d22(2,:)=(/-cs,cc/)
pqr(1,:)=(/p,r/) ; pqr(2,:)=(/r,q/)
zd(:,:,1,1)=matmul(vv,matmul(d11*pqr,transpose(vv)))
zd(:,:,1,2)=matmul(vv,matmul(d12*pqr,transpose(vv)))
zd(:,:,2,2)=matmul(vv,matmul(d22*pqr,transpose(vv)))
d11pqr=d11*pqr
d12pqr=d12*pqr
d22pqr=d22*pqr
zd(:,:,1,1)=matmul(vv,matmul(d11pqr,transpose(vv)))
zd(:,:,1,2)=matmul(vv,matmul(d12pqr,transpose(vv)))
zd(:,:,2,2)=matmul(vv,matmul(d22pqr,transpose(vv)))
zd(:,:,2,1)=zd(:,:,1,2)
end subroutine logsym2d

Expand Down