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 build
......
...@@ -24,16 +24,10 @@ elseif (${sitename} MATCHES "jrl.*") ...@@ -24,16 +24,10 @@ elseif (${sitename} MATCHES "jrl.*")
else() else()
set (configfile "cmake/cmake.jureca.config") set (configfile "cmake/cmake.jureca.config")
endif() 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.*") elseif (${sitename} MATCHES "juquee.*")
set (configfile "cmake/cmake.juqueen.config") set (configfile "cmake/cmake.juqueen.config")
elseif (${sitename} MATCHES "cluster") elseif (${sitename} MATCHES "cluster")
set (configfile "cmake/cmake.rwth.config") set (configfile "cmake/cmake.rwth.config")
elseif (${sitename} MATCHES "judge")
set (configfile "cmake/cmake.judge.config")
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin") elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
set (configfile "cmake/cmake.darwin.config") set (configfile "cmake/cmake.darwin.config")
endif () endif ()
...@@ -43,3 +37,4 @@ if (${configfile} MATCHES "NOTFOUND") ...@@ -43,3 +37,4 @@ if (${configfile} MATCHES "NOTFOUND")
else () else ()
include(${configfile}) include(${configfile})
endif () endif ()
include(cmake/compileenv.txt)
...@@ -20,4 +20,6 @@ else() ...@@ -20,4 +20,6 @@ else()
message("No MPI found for parallel compilation") message("No MPI found for parallel compilation")
endif() endif()
message("Compiler:${CMAKE_Fortran_COMPILER}") message("Compiler:${CMAKE_Fortran_COMPILER}")
message("Git describe:${git_describe}")
message("Git hash:${git_hash}")
message("************-------***************") 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 ...@@ -113,6 +113,8 @@ CONTAINS
eig_id,nk,jsp,& eig_id,nk,jsp,&
n_start=1,n_end=ne,& n_start=1,n_end=ne,&
z=z(:,:ne,jsp)) z=z(:,:ne,jsp))
write(6,*) "jspin=",jsp,",nk=",nk
write(6,"(5f12.4)") eig(:ne,jsp)
! write(*,*) 'process',irank,' reads ',nk ! write(*,*) 'process',irank,' reads ',nk
......
...@@ -10,6 +10,7 @@ MODULE m_utility ...@@ -10,6 +10,7 @@ MODULE m_utility
CONTAINS CONTAINS
SUBROUTINE getComputerArchitectures(architectures, numArchitectures) SUBROUTINE getComputerArchitectures(architectures, numArchitectures)
IMPLICIT NONE IMPLICIT NONE
INTEGER , INTENT(OUT) :: numArchitectures INTEGER , INTENT(OUT) :: numArchitectures
......
...@@ -28,6 +28,7 @@ init/strgn_dim.F ...@@ -28,6 +28,7 @@ init/strgn_dim.F
init/tetcon.f init/tetcon.f
) )
set(fleur_F90 ${fleur_F90} set(fleur_F90 ${fleur_F90}
init/compile_descr.F90
init/apws_dim.f90 init/apws_dim.f90
init/dimen7.F90 init/dimen7.F90
init/dimens.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
This diff is collapsed.
...@@ -44,7 +44,8 @@ MODULE m_xmlOutput ...@@ -44,7 +44,8 @@ MODULE m_xmlOutput
USE m_constants USE m_constants
USE m_utility USE m_utility
USE m_compile_descr
IMPLICIT NONE IMPLICIT NONE
#ifdef CPP_MPI #ifdef CPP_MPI
...@@ -60,7 +61,8 @@ MODULE m_xmlOutput ...@@ -60,7 +61,8 @@ MODULE m_xmlOutput
CHARACTER(LEN=6) :: precisionString CHARACTER(LEN=6) :: precisionString
CHARACTER(LEN=9) :: flags(11) CHARACTER(LEN=9) :: flags(11)
CHARACTER(LEN=20) :: structureSpecifiers(11) CHARACTER(LEN=20) :: structureSpecifiers(11)
CHARACTER(LEN=50) :: gitdesc,githash,compile_date,compile_user,compile_host
maxNumElements = 10 maxNumElements = 10
ALLOCATE(elementList(maxNumElements)) ALLOCATE(elementList(maxNumElements))
elementList = '' elementList = ''
...@@ -73,6 +75,9 @@ MODULE m_xmlOutput ...@@ -73,6 +75,9 @@ MODULE m_xmlOutput
WRITE (xmlOutputUnit,'(a)') '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' WRITE (xmlOutputUnit,'(a)') '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
WRITE (xmlOutputUnit,'(a)') '<fleurOutput fleurOutputVersion="0.27">' WRITE (xmlOutputUnit,'(a)') '<fleurOutput fleurOutputVersion="0.27">'
CALL openXMLElement('programVersion',(/'version'/),(/version_const/)) 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) CALL getComputerArchitectures(flags, numFlags)
IF (numFlags.EQ.0) THEN IF (numFlags.EQ.0) THEN
numFlags = 1 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