LCOV - code coverage report
Current view: top level - io - xmlOutput.F90 (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 56 57 98.2 %
Date: 2024-04-26 04:44:34 Functions: 1 1 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
       3             : ! This file is part of FLEUR and available as free software under the conditions
       4             : ! of the MIT license as expressed in the LICENSE file in more detail.
       5             : !--------------------------------------------------------------------------------
       6             : 
       7             : MODULE m_xmlOutput
       8             :   USE m_judft_xmlOutput !most functionality is actually there
       9             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      10             : !!!
      11             : !!!   XML output service routines
      12             : !!!
      13             : !!!   This module provides several subroutines that simplify the
      14             : !!!   generation of the out.xml file.
      15             : !!!                                         GM'16
      16             : !!!
      17             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      18             : 
      19             :    IMPLICIT NONE
      20             :  
      21             :    CONTAINS
      22             : 
      23          80 :    SUBROUTINE startfleur_XMLOutput(filename_add)
      24             :      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             : #ifdef CPP_MPI
      31             :       use mpi
      32             : #endif
      33             : !$    use omp_lib
      34             :       
      35             :       IMPLICIT NONE
      36             : 
      37             :       CHARACTER(len=100), INTENT(IN) :: filename_add
      38             : 
      39             :       INTEGER           :: err, isize
      40             :       INTEGER           :: numFlags
      41             :       INTEGER           :: nOMPThreads
      42             :       CHARACTER(LEN=8)  :: date
      43             :       CHARACTER(LEN=10) :: time
      44             :       CHARACTER(LEN=10) :: zone
      45             :       CHARACTER(LEN=10) :: dateString
      46             :       CHARACTER(LEN=10) :: timeString
      47             :       CHARACTER(LEN=6)  :: precisionString
      48             :       CHARACTER(LEN=9)  :: flags(11)
      49             :       CHARACTER(LEN=20) :: structureSpecifiers(11)
      50          80 :       CHARACTER(:), ALLOCATABLE :: gitdesc,githash,gitbranch,compile_date,compile_user,compile_host
      51          80 :       CHARACTER(:), ALLOCATABLE :: compile_flags,link_flags
      52             :       CHARACTER(LEN=1000) :: gitdescTemp,githashTemp,gitbranchTemp,compile_dateTemp,compile_userTemp,compile_hostTemp
      53             :       CHARACTER(LEN=1000) :: compile_flagsTemp,link_flagsTemp,line
      54             :       CHARACTER(LEN=20) :: attributes(7)
      55             :       
      56          80 :       CALL startxmloutput(TRIM(filename_add)//"out.xml","fleurOutput")
      57         240 :       CALL openXMLElement('programVersion',(/'version'/),(/version_const/))
      58          80 :       CALL get_compile_desc(gitdesc,githash,gitbranch,compile_date,compile_user,compile_host,compile_flags,link_flags)
      59          80 :       gitdescTemp = gitdesc
      60          80 :       githashTemp = githash
      61          80 :       CALL add_usage_data("githash", githash)
      62          80 :       gitbranchTemp = gitbranch
      63          80 :       compile_dateTemp = compile_date
      64          80 :       compile_userTemp = compile_user
      65          80 :       compile_hostTemp = compile_host
      66          80 :       compile_flagsTemp = compile_flags
      67          80 :       link_flagsTemp = link_flags
      68         880 :       CALL writeXMLElement('compilationInfo',(/'date','user','host','flag','link'/),(/compile_dateTemp,compile_userTemp,compile_hostTemp,compile_flagsTemp,link_flagsTemp/))
      69         560 :       CALL writeXMLElement('gitInfo',(/'version       ','branch        ','lastCommitHash'/),(/gitdescTemp,gitbranchTemp,githashTemp/))
      70          80 :       CALL getComputerArchitectures(flags, numFlags)
      71          80 :       IF (numFlags.EQ.0) THEN
      72          80 :          numFlags = 1
      73          80 :          flags(numFlags) = 'GEN'
      74             :       END IF
      75          80 :       CALL writeXMLElementNoAttributes('targetComputerArchitectures',flags(1:numFlags))
      76          80 :       IF (numFlags.GT.1) THEN 
      77           0 :          STOP "ERROR: Define only one system architecture! (called by xmlOutput)"
      78             :       END IF
      79          80 :       CALL getPrecision(precisionString)
      80         240 :       CALL writeXMLElement('precision',(/'type'/),(/precisionString/))
      81          80 :       CALL getTargetStructureProperties(structureSpecifiers, numFlags)
      82          80 :       CALL writeXMLElementNoAttributes('targetStructureClass',structureSpecifiers(1:numFlags))
      83          80 :       CALL getAdditionalCompilationFlags(flags, numFlags)
      84          80 :       IF (numFlags.GE.1) THEN
      85          80 :          CALL writeXMLElementNoAttributes('additionalCompilerFlags',flags(1:numFlags))
      86             :       END IF
      87          80 :       CALL closeXMLElement('programVersion')
      88             : 
      89          80 :       CALL openXMLElementNoAttributes('parallelSetup')
      90          80 :       nOMPThreads = -1
      91          80 :       !$ nOMPThreads=omp_get_max_threads()
      92          80 :       IF(nOMPThreads.NE.-1) THEN
      93          80 :          WRITE(attributes(1),'(i0)') nOMPThreads
      94             :          CALL writeXMLElementFormPoly('openMP',(/'ompThreads'/),&
      95         160 :                                       attributes(:1),reshape((/10,8/),(/1,2/)))
      96             :       END IF
      97             : 
      98             : #ifdef CPP_MPI
      99          80 :       CALL MPI_COMM_SIZE(MPI_COMM_WORLD,isize,err)
     100          80 :       WRITE(attributes(1),'(i0)') isize
     101             :       CALL writeXMLElementFormPoly('mpi',(/'mpiProcesses'/),&
     102         160 :                                    attributes(:1),reshape((/13,8/),(/1,2/)))
     103             : #endif
     104             : 
     105          80 :       line="MemTotal: unknown"
     106          80 :       OPEN(544,FILE="/proc/meminfo",status='old',action='read',iostat=err)
     107          80 :       IF (err==0) THEN
     108             :          DO
     109          80 :             READ(544,'(a)',iostat=err) line
     110          80 :             IF (err.NE.0) EXIT
     111          80 :             IF (INDEX(line,"MemTotal:")>0) EXIT
     112             :          ENDDO
     113          80 :          CLOSE(544)
     114             :       END IF
     115          80 :       IF (INDEX(line,"MemTotal:")>0) THEN
     116          80 :          attributes(1)=ADJUSTL(TRIM(line(10:)))
     117             :          CALL writeXMLElementFormPoly('mem',(/'memoryPerNode'/),&
     118         160 :                                    attributes(:1),reshape((/14,15/),(/1,2/)))
     119             :       ENDIF
     120             : 
     121          80 :       CALL closeXMLElement('parallelSetup')
     122             :       
     123          80 :       CALL DATE_AND_TIME(date,time,zone)
     124          80 :       WRITE(dateString,'(a4,a1,a2,a1,a2)') date(1:4),'/',date(5:6),'/',date(7:8)
     125          80 :       WRITE(timeString,'(a2,a1,a2,a1,a2)') time(1:2),':',time(3:4),':',time(5:6)
     126         560 :       CALL writeXMLElement('startDateAndTime',(/'date','time','zone'/),(/dateString,timeString,zone/))
     127          80 :     END SUBROUTINE startfleur_XMLOutput
     128             : 
     129             : END MODULE m_xmlOutput

Generated by: LCOV version 1.14