Skip to content

Commit

Permalink
Removed NAG library; added support for GNU compiler using -DCOMPILER=gnu
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesmg committed Aug 5, 2021
1 parent e2f967a commit eb08c80
Show file tree
Hide file tree
Showing 10 changed files with 188 additions and 449 deletions.
253 changes: 157 additions & 96 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Minimum required Version
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 2.9 FATAL_ERROR)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Projects name
Expand Down Expand Up @@ -104,6 +104,28 @@ else()
set(CMAKE_Fortran_COMPILER mpiifort)
endif()

if(DEBUG)
set(DEBUGSUFFIX _debug)
execute_process(COMMAND echo "DEBUG on")
else()
set(DEBUGSUFFIX)
endif()

if(SUFFIX)
set(SUFFIX _${SUFFIX})
else()
set(SUFFIX)
endif()

if(COMPILER MATCHES gfortran OR COMPILER MATCHES gcc OR COMPILER MATCHES gfort OR COMPILER MATCHES gnu)
set(COMPILER gnu)
set(CMAKE_Fortran_COMPILER mpif90)
set(SUFFIX ${SUFFIX}_gnu)
execute_process(COMMAND echo "Using GCC Compiler")
endif()

set(TITAN_EXE titan_${PLATFORM}${DEBUGSUFFIX}${SUFFIX}.exe)

add_executable(${TITAN_EXE} ${SOURCE_TITAN})

set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
Expand All @@ -112,100 +134,139 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})

execute_process(COMMAND git describe --abbrev=4 --dirty --always --tags OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)

if(PLATFORM MATCHES jureca)
target_link_libraries(${TITAN_EXE} -mkl -lnag -qopenmp)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-qopenmp
-mkl
-xHost)
elseif(PLATFORM MATCHES osx)
target_link_libraries(${TITAN_EXE} -mkl -L$ENV{HOME}/lib -lkibe)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-D_OSX
-fpp
-DVERSION="${GIT_VERSION}"
-qopenmp
-mkl
-xHost)
elseif(PLATFORM MATCHES booster)
link_directories($ENV{HOME}/BoosterNAG)
target_link_libraries(${TITAN_EXE} -mkl
-qopenmp
-I$ENV{HOME}/BoosterNAG/nag_interface_blocks
-L$ENV{HOME}/BoosterNAG
-lnag )
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-mkl
-I$ENV{HOME}/BoosterNAG/nag_interface_blocks
-xMIC-AVX512
-qopenmp)
elseif(PLATFORM MATCHES RWTH)
target_link_libraries(${TITAN_EXE} -mkl $ENV{FLAGS_MATH_LINKER} -qopenmp)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-g
-qopenmp
-mkl -$ENV{FLAGS_MATH_INCLUDE}
-xHost)
elseif(PLATFORM MATCHES iff)
target_link_libraries(${TITAN_EXE} -mkl -L/usr/local/nag/lib -lnag)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-DVERSION="${GIT_VERSION}"
-fpp
-static-intel
-mkl
-xHost)
elseif(PLATFORM MATCHES hh)
target_link_libraries(${TITAN_EXE} -mkl -L$ENV{HOME}/lib -lnag -qopenmp)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-D_OSX
-DVERSION="${GIT_VERSION}"
-qopenmp
-mkl
-xCORE-AVX2)
else()
target_link_libraries(${TITAN_EXE} -mkl -qopenmp /opt/NAG/fll6i26dcl/lib/libnag_nag.a)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-qopenmp
-mkl
#-ipo
#-qopt-report=5
-g
-xHost)
endif()
if(NOT COMPILER MATCHES gnu)
if(PLATFORM MATCHES jureca)
target_link_libraries(${TITAN_EXE} -mkl -qopenmp)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-qopenmp
-mkl
-xHost)
elseif(PLATFORM MATCHES osx)
target_link_libraries(${TITAN_EXE} -mkl -L$ENV{HOME}/lib)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-qopenmp
-mkl
-xHost)
elseif(PLATFORM MATCHES booster)
link_directories($ENV{HOME}/BoosterNAG)
target_link_libraries(${TITAN_EXE} -mkl
-qopenmp )
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-mkl
-xMIC-AVX512
-qopenmp)
elseif(PLATFORM MATCHES RWTH)
target_link_libraries(${TITAN_EXE} -mkl $ENV{FLAGS_MATH_LINKER} -qopenmp)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-g
-qopenmp
-mkl -$ENV{FLAGS_MATH_INCLUDE}
-xHost)
elseif(PLATFORM MATCHES iff)
target_link_libraries(${TITAN_EXE} -mkl)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-DVERSION="${GIT_VERSION}"
-fpp
-static-intel
-mkl
-xHost)
elseif(PLATFORM MATCHES hh)
target_link_libraries(${TITAN_EXE} -mkl -L$ENV{HOME}/lib -qopenmp)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-qopenmp
-mkl
-xCORE-AVX2)
else()
target_link_libraries(${TITAN_EXE} -mkl -qopenmp)
target_compile_options(${TITAN_EXE} PRIVATE -no-wrap-margin
-fpp
-DVERSION="${GIT_VERSION}"
-qopenmp
-mkl
#-ipo
#-qopt-report=5
-g
-xHost)
endif()

#target_compile_options(${EXEC_NAME} PRIVATE -no-wrap-margin
# -fpp
# -D _LINUX
# -O3
## -I${NAG}/c_headers#
# -qopenmp
# -mkl
# -xHost
#)
#target_compile_options(${EXEC_NAME} PRIVATE -no-wrap-margin
# -fpp
# -D _LINUX
# -O3
## -I${NAG}/c_headers#
# -qopenmp
# -mkl
# -xHost
#)

if(DEBUG)
target_compile_options(${TITAN_EXE} PRIVATE -C
-CB
-check uninit
-debug all
-warn all
-ftrapuv
-traceback
-qopenmp
-fpp
-DVERSION="${GIT_VERSION}"
-g
-O0)
else()
target_compile_options(${TITAN_EXE} PRIVATE -O3)
endif(DEBUG)
#target_link_libraries(${EXEC_NAME} ${NAG}/lib/libnag_nag.a -qopenmp)
if(DEBUG)
target_compile_options(${TITAN_EXE} PRIVATE -C
-CB
-check uninit
-debug all
-warn all
-ftrapuv
-traceback
-qopenmp
-fpp
-DVERSION="${GIT_VERSION}"
-g
-O0)
else()
target_compile_options(${TITAN_EXE} PRIVATE -O3)
endif(DEBUG)
else() # GFORTRAN:
target_link_libraries(${TITAN_EXE} -L$ENV{MKLROOT}/lib -Wl,-rpath,$ENV{MKLROOT}/lib -static-libgfortran -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl -fopenmp)
if(NOT DEBUG)
target_compile_options(${TITAN_EXE} PRIVATE -cpp
-DVERSION="${GIT_VERSION}"
-I$ENV{MKLROOT}/include
-fopenmp
-ffree-form
-fallow-argument-mismatch
-ffree-line-length-0
-g
-O3
-march=native
)

else(NOT DEBUG)
target_compile_definitions(${TITAN_EXE} PRIVATE DEBUG)
target_compile_options(${TITAN_EXE} PRIVATE -C
-Wall
-Wextra
-Wconversion
-Wline-truncation
-Wcharacter-truncation
-Wsurprising
-Waliasing
-Wunused-parameter
-fwhole-file
-fimplicit-none
-fbacktrace
-fallow-argument-mismatch
-ffree-form
-ffree-line-length-0
-fcheck=all
-ffpe-trap=zero,overflow,underflow
-finit-real=nan
-ftrapv
-fopenmp
-cpp
-DVERSION="${GIT_VERSION}"
-I$ENV{MKLROOT}/include
-g
-O0
)
endif(NOT DEBUG)
endif()
2 changes: 1 addition & 1 deletion source/TorqueTorqueResponse.F90
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ subroutine calcTTResponse(e)
call open_TTR_files()
do i = 1, s%nAtoms
do j = 1, s%nAtoms
write(unit=555+s%nAtoms*(i-1)+j, fmt="(es16.9,2x,i0,2x,i0,2x,18(es16.9,2x))") e, i,j,(((real(TTResponse(n,m,j,i)), aimag(TTResponse(n,m,j,i))), n=1,3), m = 1,3)
write(unit=555+s%nAtoms*(i-1)+j, fmt="(es16.9,2x,i0,2x,i0,2x,9(es16.9,2x))") e, i,j,(((real(TTResponse(n,m,j,i))), n=1,3), m = 1,3)
end do
end do

Expand Down
2 changes: 1 addition & 1 deletion source/band_structure.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ subroutine band_structure(s)
use mod_io, only: write_header
implicit none
type(System), intent(in) :: s
integer :: i, j, info, count, f_unit=666
integer :: j, info, count, f_unit=666
integer :: lwork,dimbs
real(double), dimension(:), allocatable :: rwork,eval
complex(double), allocatable :: work(:),hk(:,:)
Expand Down
10 changes: 5 additions & 5 deletions source/calculate_all.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
! currents, disturbances, torques, effective fields and susceptibilities
subroutine calculate_all()
use mod_f90_kind, only: double
use mod_constants, only: cZero, cOne, cI, levi_civita
use mod_parameters, only: lnodiag, renorm, U, offset, output, laddresults, skip_steps, count, lhfresponses, sigmaimunu2i, emin, emax, deltae, nQvec1, kpoints, dim, sigmai2i, dimspinAtoms
use mod_magnet, only: lfield, hhw, lxp, lyp, lzp, lx, ly, lz, mvec_cartesian, mvec_spherical, total_hw_npt1, lrot
use mod_constants, only: cZero, cOne, cI
use mod_parameters, only: lnodiag, U, offset, output, laddresults, skip_steps, count, lhfresponses, sigmaimunu2i, emin, deltae, nQvec1, kpoints, dim, sigmai2i, dimspinAtoms
use mod_magnet, only: lfield, hhw, lxp, lyp, lzp, lx, ly, lz, mvec_cartesian, mvec_spherical, lrot
use mod_SOC, only: llinearsoc
use mod_System, only: s => sys
use mod_BrillouinZone, only: realBZ
Expand Down Expand Up @@ -39,8 +39,8 @@ subroutine calculate_all()
implicit none
character(len=50) :: time
integer :: mcount,qcount
integer :: i,j,iw,sigma,sigmap,mu,nu,neighbor
real(double) :: e,q(3),Icabs
integer :: i,j,sigma,sigmap,mu,nu
real(double) :: e,q(3)

call allocate_prefactors()
call allocate_susceptibilities()
Expand Down
6 changes: 3 additions & 3 deletions source/calculate_dc_limit.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
! (in particular, the dc-limit) response functions
subroutine calculate_dc_limit()
use mod_mpi_pars
use mod_constants, only: cZero, cOne, cI, levi_civita, tpi
use mod_constants, only: cZero, cOne, cI
use mod_parameters, only: sigmaimunu2i, sigmai2i, dimspinAtoms, U, offset, lnodiag, output, count, emin, deltae, nQvec1, kpoints, laddresults, lhfresponses, dim, skip_steps
use mod_magnet, only: lfield, dcfield_dependence, dc_count, dcfield, hw_count, lxp, lyp, lzp, lx, ly, lz, mvec_cartesian, mvec_spherical, hhw, lrot
use mod_SOC, only: llinearsoc
Expand Down Expand Up @@ -34,8 +34,8 @@ subroutine calculate_dc_limit()
implicit none
character(len=50) :: time
integer :: mcount,qcount
integer :: i,j,iw,sigma,sigmap,mu,nu,neighbor,hw_count_temp,count_temp,mpitag2
real(double) :: e,q(3),Icabs,mvec_spherical_temp(3,s%nAtoms)
integer :: i,j,sigma,sigmap,mu,nu,hw_count_temp,count_temp
real(double) :: e,q(3),mvec_spherical_temp(3,s%nAtoms)

dc_count = dc_count + 1

Expand Down
11 changes: 5 additions & 6 deletions source/eintshe.F90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! ---------- Parallel spin current: Energy integration ---------
subroutine eintshe(q,e)
use mod_f90_kind, only: double
use mod_constants, only: cZero, cOne, cI, tpi
use mod_constants, only: cZero, cI, tpi
use mod_parameters, only: nOrb, nOrb2, dim, sigmaimunu2i, eta, etap, sigmai2i, offset
use mod_SOC, only: llineargfsoc
use EnergyIntegration, only: y, wght, x2, p2, generate_real_epoints, pn2
Expand Down Expand Up @@ -44,7 +44,6 @@ subroutine eintshe(q,e)
! Generating energy points in the real axis for third integration
call generate_real_epoints(e)


real_points = 0
if(abs(e) >= 1.d-10) real_points = int(pn2,8) * int(realBZ%workload,8)

Expand Down Expand Up @@ -88,7 +87,7 @@ subroutine eintshe(q,e)
do ix = 1, local_points
ep = y( E_k_imag_mesh(1,ix) )
kp = bzs( E_k_imag_mesh(1,ix) ) % kp(1:3,E_k_imag_mesh(2,ix))
wkbzc = cmplx(wght(E_k_imag_mesh(1,ix)) * bzs(E_k_imag_mesh(1,ix))%w(E_k_imag_mesh(2,ix)),0.d0)
wkbzc = cmplx(wght(E_k_imag_mesh(1,ix)) * bzs(E_k_imag_mesh(1,ix))%w(E_k_imag_mesh(2,ix)),0.d0,double)

df1iikl = cZero

Expand Down Expand Up @@ -206,7 +205,7 @@ subroutine eintshe(q,e)
nkp = mod(ix2-1, int(realBZ % workload,8))+1
ep = x2(nep)
kp = realBZ % kp(:,nkp)
wkbzc = cmplx(p2(nep) * realBZ % w(nkp), 0.d0)
wkbzc = cmplx(p2(nep) * realBZ % w(nkp), 0.d0,double)

df1iikl = cZero

Expand Down Expand Up @@ -445,7 +444,7 @@ subroutine eintshelinearsoc(q,e)
do ix = 1, local_points
ep = y( E_k_imag_mesh(1,ix) )
kp = bzs( E_k_imag_mesh(1,ix) ) % kp(1:3,E_k_imag_mesh(2,ix))
wkbzc = cmplx(wght(E_k_imag_mesh(1,ix)) * bzs(E_k_imag_mesh(1,ix))%w(E_k_imag_mesh(2,ix)),0.d0)
wkbzc = cmplx(wght(E_k_imag_mesh(1,ix)) * bzs(E_k_imag_mesh(1,ix))%w(E_k_imag_mesh(2,ix)),0.d0,double)

df1iikl = cZero
df1lsoc = cZero
Expand Down Expand Up @@ -589,7 +588,7 @@ subroutine eintshelinearsoc(q,e)
nkp = mod(ix2-1, int(realBZ % workload,8))+1
ep = x2(nep)
kp = realBZ % kp(:,nkp)
wkbzc = cmplx(p2(nep) * realBZ % w(nkp),0.d0)
wkbzc = cmplx(p2(nep) * realBZ % w(nkp),0.d0,double)

df1iikl = cZero
df1lsoc = cZero
Expand Down
Loading

0 comments on commit eb08c80

Please sign in to comment.