Attempt to make ifort 17 work

This commit is contained in:
Kareem Sorathia
2021-02-26 11:17:51 -05:00
parent f35a877143
commit fc8bd5161a
4 changed files with 33 additions and 7 deletions

View File

@@ -25,9 +25,12 @@ endif()
#-------------
#Set minimum compiler versions
if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 18.0)
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 17.0)
message("Fortran compiler too old! What, were you gonna use punch cards?")
message(FATAL_ERROR "ifort > 18.0 required")
message(FATAL_ERROR "ifort > 17.0 required")
elseif( (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0) AND (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 18.0) )
message(WARNING "Compiler has incomplete F2008 features, Git hash/compiler information won't be saved to H5 files")
add_compile_definitions(__INTEL_COMPILER_OLD)
endif()
elseif(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0)

View File

@@ -42,10 +42,13 @@ contains
call ClearIO(IOVars)
call AddOutVar(IOVars,"GITHASH",gStr)
call AddOutVar(IOVars,"GITBRANCH",bStr)
#ifdef __INTEL_COMPILER_OLD
call AddOutVar(IOVars,"COMPILER",gStr)
call AddOutVar(IOVars,"COMPILEROPTS",gStr)
#else
call AddOutVar(IOVars,"COMPILER",compiler_version())
call AddOutVar(IOVars,"COMPILEROPTS",compiler_options())
#endif
call AddOutVar(IOVars,"DATETIME",dtStr)
call WriteVars(IOVars,.true.,fIn)

View File

@@ -63,7 +63,11 @@ module strings
write(*,*) 'Kaiju configuration'
write(*,'(2a)') 'Git branch = ', trim(bStr)
write(*,'(2a)') 'Git hash = ', trim(gStr)
#ifdef __INTEL_COMPILER_OLD
write(*,'(2a)') 'Compiler = ', trim(gStr)
#else
write(*,'(2a)') 'Compiler = ', compiler_version()
#endif
write(*,'(2a)') 'Run starting on: ', trim(dtStr)
!write(*,'(2a)') 'Compiler flags = ', compiler_options()
@@ -81,10 +85,13 @@ module strings
nOff = 16
nH = 7
#ifdef __INTEL_COMPILER_OLD
gStr = "XXXXXXX" !Avoid unavailable compiler_options
#else
cOpts = compiler_options()
n = index(cOpts,"-DGITCOMMITHASH=")
gStr = cOpts(n+nOff:n+nOff+nH)
#endif
end subroutine GitHash
!Create string with git hash if possible
@@ -95,13 +102,16 @@ module strings
integer :: n,nOff
nOff = 12
#ifdef __INTEL_COMPILER_OLD
cOpts = compiler_options()
gStr = "XXXXXXX" !Avoid unavailable compiler_options
#else
n = index(cOpts,"-DGITBRANCH=")
!Don't know length of branch name, so need to find next space
gStr = cOpts(n+nOff:)
n = index(gStr," ")
gStr = gStr(1:n-1)
#endif
end subroutine GitBranch

View File

@@ -675,6 +675,8 @@ module msphutils
B = State%Bxyz(i,j,k,:)
call Mom2Rel(Model,pW(DEN),B,Lam)
Mxyz = matmul(Lam,pCon(MOMX:MOMZ)) !semi-relativistic momentum
else
Mxyz = pCon(MOMX:MOMZ) !Classical momentum
endif
!Get timescale, taking directly from Gas0
@@ -699,7 +701,15 @@ module msphutils
call Rel2Mom(Model,pW(DEN),B,Laminv)
Vxyz = matmul(Laminv,Mxyz)/max(pW(DEN),dFloor)
pW(VELX:VELZ) = Vxyz
endif !Otherwise leave primitive state (VELX:VELZ) unchanged
else
Vxyz = Mxyz/max(pW(DEN),dFloor) !Conserve classical momentum
!Don't allow mass ingestion to speed things up
if ( norm2(Vxyz) <= norm2(pW(VELX:VELZ)) ) then
!Conserve momentum if it doesn't increase speed
pW(VELX:VELZ) = Vxyz
endif
endif
!Now put back
call CellP2C(Model,pW,pCon)