Commit 6a73f16b authored by Daniel Wortmann's avatar Daniel Wortmann

Added code to include the compile time/user/host and the

git version to the executable. This is done by cmake generating a file
init/compileinfo.h with the required data. This file is included in init/compile_descr.F90 and
ignored by git.
parent 99795d38
init/compileinfo.h
*~
#*
build
......
......@@ -24,16 +24,10 @@ elseif (${sitename} MATCHES "jrl.*")
else()
set (configfile "cmake/cmake.jureca.config")
endif()
elseif (${sitename} MATCHES "jj2.*")
set (configfile "cmake/cmake.juropa.config")
elseif (${sitename} MATCHES "j3.*")
set (configfile "cmake/cmake.juropatest.config")
elseif (${sitename} MATCHES "juquee.*")
set (configfile "cmake/cmake.juqueen.config")
elseif (${sitename} MATCHES "cluster")
set (configfile "cmake/cmake.rwth.config")
elseif (${sitename} MATCHES "judge")
set (configfile "cmake/cmake.judge.config")
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
set (configfile "cmake/cmake.darwin.config")
endif ()
......@@ -43,3 +37,4 @@ if (${configfile} MATCHES "NOTFOUND")
else ()
include(${configfile})
endif ()
include(cmake/compileenv.txt)
......@@ -20,4 +20,6 @@ else()
message("No MPI found for parallel compilation")
endif()
message("Compiler:${CMAKE_Fortran_COMPILER}")
message("Git describe:${git_describe}")
message("Git hash:${git_hash}")
message("************-------***************")
#this file sets some preprocessor variables that are used in
#init/compile_descr.F90 to determine the programm version and
#some compilation environment description
set(compile_host $ENV{HOSTNAME})
set(compile_user $ENV{USER})
string(TIMESTAMP compile_time)
set(git_hash unkown)
if (EXISTS ${CMAKE_SOURCE_DIR}/.git)
execute_process(COMMAND git -C ${CMAKE_SOURCE_DIR} describe --tags OUTPUT_VARIABLE git_describe)
if (${git_describe})
message("GIT DESCRIBE:${git_describe}")
else()
set(git_describe unkown)
endif()
execute_process(COMMAND git -C ${CMAKE_SOURCE_DIR} rev-parse HEAD OUTPUT_VARIABLE git_hash)
elseif (EXISTS ${CMAKE_SOURCE_DIR}/version)
file(READ ${CMAKE_SOURCE_DIR}/version git_describe)
else()
set(git_describe unknown)
endif()
#normalize the strings
string(STRIP ${git_hash} git_hash)
string(STRIP ${git_describe} git_describe)
file(GENERATE OUTPUT ${CMAKE_SOURCE_DIR}/init/compileinfo.h CONTENT "gitdesc=\"${git_describe}\"\ncompile_date=\"${compile_time}\"\ncompile_user=\"${compile_user}\"\ncompile_host=\"${compile_host}\"\ngithash=\"${git_hash}\"\n")
......@@ -113,6 +113,8 @@ CONTAINS
eig_id,nk,jsp,&
n_start=1,n_end=ne,&
z=z(:,:ne,jsp))
write(6,*) "jspin=",jsp,",nk=",nk
write(6,"(5f12.4)") eig(:ne,jsp)
! write(*,*) 'process',irank,' reads ',nk
......
......@@ -10,6 +10,7 @@ MODULE m_utility
CONTAINS
SUBROUTINE getComputerArchitectures(architectures, numArchitectures)
IMPLICIT NONE
INTEGER , INTENT(OUT) :: numArchitectures
......
......@@ -28,6 +28,7 @@ init/strgn_dim.F
init/tetcon.f
)
set(fleur_F90 ${fleur_F90}
init/compile_descr.F90
init/apws_dim.f90
init/dimen7.F90
init/dimens.F90
......
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_compile_descr
IMPLICIT NONE
!Use the Preprocessor variables to determine compile environment
CONTAINS
SUBROUTINE get_compile_desc(gitdesc,githash,compile_date,compile_user,compile_host)
IMPLICIT NONE
CHARACTER(LEN=*),INTENT(OUT)::gitdesc,githash,compile_date,compile_user,compile_host
#include "compileinfo.h"
END subroutine get_compile_desc
end MODULE m_compile_descr
......@@ -4,12 +4,12 @@
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_dimens
MODULE m_dimens
USE m_juDFT
USE m_utility
private
public :: dimens
CONTAINS
CONTAINS
SUBROUTINE dimens(&
& mpi,input,sym,stars,&
& atoms,sphhar,dimension,vacuum,&
......@@ -241,11 +241,14 @@
SUBROUTINE priv_hello(ivers)
USE m_compile_descr
IMPLICIT NONE
CHARACTER(len=9), INTENT (IN) :: ivers
CHARACTER(len=9) :: cppflag(11)
CHARACTER(LEN=50):: gitdesc,githash,compile_date,compile_user,compile_host
INTEGER :: i,j
WRITE (6,*) 'This output is generated by ',ivers,' * * '
WRITE (6,*) 'This output is generated by ',ivers
WRITE (6,*) ' * * '
#if ( defined(CPP_AIX) )
WRITE (6,*) ' * \\:/ *'
#else
......@@ -255,6 +258,10 @@
WRITE (6,*) ' * * '
WRITE (6,*)
CALL get_compile_desc(gitdesc,githash,compile_date,compile_user,compile_host)
write (6,*) "FLEUR was compiled at ",trim(compile_date)," by ",trim(compile_user)," on ",trim(compile_host)
write (6,*) "Its git version is ",trim(gitdesc)," with hash: ",trim(githash)
CALL getComputerArchitectures(cppflag,i) ! First determine the architecture
IF (i.GT.1) THEN
WRITE (6,*) 'You set compiler flags for more than one'
......@@ -267,9 +274,9 @@
WRITE (6,*) 'No system architecture specified in Makefile'
cppflag(1) = 'GEN'
ENDIF
!
! check for double precision etc.
!
!
! check for double precision etc.
!
CALL getPrecision(cppflag(2))
WRITE (6,'(16a,4a,5a,7a,11a)') 'You compiled for ',&
& trim(cppflag(1)),' with ',trim(cppflag(2)),' precision,'
......@@ -291,6 +298,6 @@
WRITE (6,*) 'Additional flags are: ', (cppflag(j),j=1,i)
ENDIF
END SUBROUTINE
END SUBROUTINE priv_hello
END MODULE m_dimens
......@@ -44,6 +44,7 @@ MODULE m_xmlOutput
USE m_constants
USE m_utility
USE m_compile_descr
IMPLICIT NONE
......@@ -60,6 +61,7 @@ MODULE m_xmlOutput
CHARACTER(LEN=6) :: precisionString
CHARACTER(LEN=9) :: flags(11)
CHARACTER(LEN=20) :: structureSpecifiers(11)
CHARACTER(LEN=50) :: gitdesc,githash,compile_date,compile_user,compile_host
maxNumElements = 10
ALLOCATE(elementList(maxNumElements))
......@@ -73,6 +75,9 @@ MODULE m_xmlOutput
WRITE (xmlOutputUnit,'(a)') '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
WRITE (xmlOutputUnit,'(a)') '<fleurOutput fleurOutputVersion="0.27">'
CALL openXMLElement('programVersion',(/'version'/),(/version_const/))
CALL get_compile_desc(gitdesc,githash,compile_date,compile_user,compile_host)
CALL writeXMLElement('Compiled',(/'date','user','host'/),(/compile_date,compile_user,compile_host/))
CALL writeXMLElement('Git',(/'version','hash '/),(/gitdesc,githash/))
CALL getComputerArchitectures(flags, numFlags)
IF (numFlags.EQ.0) THEN
numFlags = 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment