xmlOutput.F90 4.61 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! 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.
!--------------------------------------------------------------------------------

7
MODULE m_xmlOutput
8
  USE m_judft_xmlOutput !most functionality is actually there
9 10 11 12 13 14 15 16 17 18 19
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!
!!!   XML output service routines
!!!
!!!   This module provides several subroutines that simplify the
!!!   generation of the out.xml file.
!!!                                         GM'16
!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

   IMPLICIT NONE
20
 
21 22
   CONTAINS

23 24
   SUBROUTINE startfleur_XMLOutput()
     USE m_judft_xmloutput
25
      USE m_juDFT_args
26
      USE m_juDFT_usage
27
      USE m_constants
28
      USE m_utility
29
      USE m_compile_descr
30
!$    use omp_lib
31
      
32
      IMPLICIT NONE
33

34 35
#ifdef CPP_MPI
      include "mpif.h"
36
      INTEGER           :: err, isize
37
#endif
38
      INTEGER           :: numFlags
39
      INTEGER           :: nOMPThreads
40 41
      CHARACTER(LEN=8)  :: date
      CHARACTER(LEN=10) :: time
42
      CHARACTER(LEN=10) :: zone
43
      CHARACTER(LEN=10) :: dateString
44 45 46 47
      CHARACTER(LEN=10) :: timeString
      CHARACTER(LEN=6)  :: precisionString
      CHARACTER(LEN=9)  :: flags(11)
      CHARACTER(LEN=20) :: structureSpecifiers(11)
48 49
      CHARACTER(:), ALLOCATABLE :: gitdesc,githash,gitbranch,compile_date,compile_user,compile_host
      CHARACTER(:), ALLOCATABLE :: compile_flags,link_flags
50 51
      CHARACTER(LEN=1000) :: gitdescTemp,githashTemp,gitbranchTemp,compile_dateTemp,compile_userTemp,compile_hostTemp
      CHARACTER(LEN=1000) :: compile_flagsTemp,link_flagsTemp
52
      CHARACTER(LEN=20) :: attributes(7)
53
      
54
      CALL startxmloutput("out.xml","FLEURoutput")
55
      CALL openXMLElement('programVersion',(/'version'/),(/version_const/))
56
      CALL get_compile_desc(gitdesc,githash,gitbranch,compile_date,compile_user,compile_host,compile_flags,link_flags)
57 58
      gitdescTemp = gitdesc
      githashTemp = githash
59
      CALL add_usage_data("githash", githash)
60 61 62 63 64 65 66 67
      gitbranchTemp = gitbranch
      compile_dateTemp = compile_date
      compile_userTemp = compile_user
      compile_hostTemp = compile_host
      compile_flagsTemp = compile_flags
      link_flagsTemp = link_flags
      CALL writeXMLElement('compilationInfo',(/'date','user','host','flag','link'/),(/compile_dateTemp,compile_userTemp,compile_hostTemp,compile_flagsTemp,link_flagsTemp/))
      CALL writeXMLElement('gitInfo',(/'version       ','branch        ','lastCommitHash'/),(/gitdescTemp,gitbranchTemp,githashTemp/))
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
      CALL getComputerArchitectures(flags, numFlags)
      IF (numFlags.EQ.0) THEN
         numFlags = 1
         flags(numFlags) = 'GEN'
      END IF
      CALL writeXMLElementNoAttributes('targetComputerArchitectures',flags(1:numFlags))
      IF (numFlags.GT.1) THEN 
         STOP "ERROR: Define only one system architecture! (called by xmlOutput)"
      END IF
      CALL getPrecision(precisionString)
      CALL writeXMLElement('precision',(/'type'/),(/precisionString/))
      CALL getTargetStructureProperties(structureSpecifiers, numFlags)
      CALL writeXMLElementNoAttributes('targetStructureClass',structureSpecifiers(1:numFlags))
      CALL getAdditionalCompilationFlags(flags, numFlags)
      IF (numFlags.GE.1) THEN
         CALL writeXMLElementNoAttributes('additionalCompilerFlags',flags(1:numFlags))
      END IF
      CALL closeXMLElement('programVersion')
86 87 88 89 90 91 92 93 94 95

      CALL openXMLElementNoAttributes('parallelSetup')
      nOMPThreads = -1
      !$ nOMPThreads=omp_get_max_threads()
      IF(nOMPThreads.NE.-1) THEN
         WRITE(attributes(1),'(i0)') nOMPThreads
         CALL writeXMLElementFormPoly('openMP',(/'ompThreads'/),&
                                      attributes(:1),reshape((/10,8/),(/1,2/)))
      END IF

96 97
#ifdef CPP_MPI
      CALL MPI_COMM_SIZE(MPI_COMM_WORLD,isize,err)
98 99 100
      WRITE(attributes(1),'(i0)') isize
      CALL writeXMLElementFormPoly('mpi',(/'mpiProcesses'/),&
                                   attributes(:1),reshape((/13,8/),(/1,2/)))
101
#endif
102
      CALL closeXMLElement('parallelSetup')
103 104 105 106
      
      CALL DATE_AND_TIME(date,time,zone)
      WRITE(dateString,'(a4,a1,a2,a1,a2)') date(1:4),'/',date(5:6),'/',date(7:8)
      WRITE(timeString,'(a2,a1,a2,a1,a2)') time(1:2),':',time(3:4),':',time(5:6)
107
      CALL writeXMLElement('startDateAndTime',(/'date','time','zone'/),(/dateString,timeString,zone/))
108
    END SUBROUTINE startfleur_XMLOutput
109

110
END MODULE m_xmlOutput