Commit 4c545f63 authored by Marco Govoni's avatar Marco Govoni
Browse files

Changed logfile

parent 7197d7b9
......@@ -86,7 +86,7 @@ MODULE westin
CHARACTER(LEN=512) :: qe_prefix
CHARACTER(LEN=512) :: savedir ! outdir/west_prefix.code.save
CHARACTER(LEN=512) :: main_input_file ! input file
CHARACTER(LEN=512) :: logfile ! savedir/logfile.json
CHARACTER(LEN=:), ALLOCATABLE :: logfile ! savedir/logfile.xml
!
END MODULE
!
......
......@@ -15,6 +15,7 @@ IFLAGS=
TOOLS_OBJS = \
io_push.o \
logfile.o \
fetch_input.o \
set_dirs.o \
west_print_clocks.o \
......
#!/usr/bin/python
#!/usr/bin/python3
# File: fetch_input.py
# Test: python3 fetch_input.py
......
......@@ -38,6 +38,7 @@ CONTAINS
USE base64_module, ONLY : base64_init
USE json_string_utilities, ONLY : lowercase_string
USE west_version, ONLY : start_forpy
USE logfile_mod, ONLY : clear_log
!
CHARACTER(LEN=*), INTENT(IN) :: code
!
......@@ -61,7 +62,7 @@ CONTAINS
!
savedir = TRIM(outdir) // trim(west_prefix) // "." // TRIM(lowercase_string(code)) // ".save/"
CALL my_mkdir( savedir )
logfile = TRIM(savedir) // TRIM(lowercase_string(code))//".json"
logfile = TRIM(savedir) // TRIM(lowercase_string(code))//".log.xml"
!
! ... use ".FALSE." to disable all clocks except the total cpu time clock
! ... use ".TRUE." to enable clocks
......@@ -117,6 +118,7 @@ CONTAINS
CALL base64_init()
CALL start_forpy()
!
CALL clear_log()
CALL west_opening_message( code )
#if defined(__MPI)
CALL report_parallel_status ( )
......@@ -194,13 +196,15 @@ CONTAINS
!
SUBROUTINE west_opening_message( code )
!
USE json_module, ONLY : json_file
!USE json_module, ONLY : json_file
USE io_global, ONLY : stdout
USE global_version, ONLY : version_number, svn_revision
USE west_version, ONLY : west_version_number, west_git_revision
USE mp_world, ONLY : mpime,root
USE westcom, ONLY : logfile
USE base64_module, ONLY : islittleendian
USE forpy_mod, ONLY : dict, dict_create
USE logfile_mod, ONLY : append_log, itoa, ltoa, dtoa
!
! I/O
!
......@@ -208,10 +212,14 @@ CONTAINS
!
! Workspace
!
TYPE(json_file) :: json
INTEGER :: iunit
!TYPE(json_file) :: json
!INTEGER :: iunit
CHARACTER(LEN=9) :: cdate, ctime
!
INTEGER :: IERR
CHARACTER(LEN=:),ALLOCATABLE :: s
TYPE(dict) :: attr
!
CALL date_and_tim( cdate, ctime )
!
IF ( TRIM (west_git_revision) /= "unknown" ) THEN
......@@ -242,27 +250,50 @@ CONTAINS
!
IF( mpime == root ) THEN
!
CALL json%initialize()
!
CALL json%add('runjob.startdate', TRIM(cdate) )
CALL json%add('runjob.starttime', TRIM(ctime) )
CALL json%add('runjob.completed', .FALSE. )
CALL json%add('software.package', "WEST" )
CALL json%add('software.program', TRIM(code) )
CALL json%add('software.version', TRIM(west_version_number) )
IF( TRIM (west_git_revision) /= "unknown" ) CALL json%add('software.westgit', TRIM(west_git_revision) )
CALL json%add('software.website',"http://www.west-code.org")
CALL json%add('software.citation',"M. Govoni et al., J. Chem. Theory Comput. 11, 2680 (2015).")
CALL json%add('software.qeversion', TRIM(version_number) )
IF( TRIM (svn_revision) /= "unknown" ) CALL json%add('software.qesvn', TRIM(svn_revision) )
CALL json%add('config.io.islittleendian', islittleendian() )
!
OPEN( NEWUNIT=iunit, FILE=TRIM(logfile) )
CALL json%print_file( iunit )
CLOSE( iunit )
!
CALL json%destroy()
!
!CALL json%initialize()
!!
!CALL json%add('runjob.startdate', TRIM(cdate) )
!CALL json%add('runjob.starttime', TRIM(ctime) )
!CALL json%add('runjob.completed', .FALSE. )
!CALL json%add('software.package', "WEST" )
!CALL json%add('software.program', TRIM(code) )
!CALL json%add('software.version', TRIM(west_version_number) )
!IF( TRIM (west_git_revision) /= "unknown" ) CALL json%add('software.westgit', TRIM(west_git_revision) )
!CALL json%add('software.website',"http://www.west-code.org")
!CALL json%add('software.citation',"M. Govoni et al., J. Chem. Theory Comput. 11, 2680 (2015).")
!CALL json%add('software.qeversion', TRIM(version_number) )
!IF( TRIM (svn_revision) /= "unknown" ) CALL json%add('software.qesvn', TRIM(svn_revision) )
!CALL json%add('config.io.islittleendian', islittleendian() )
!!
!OPEN( NEWUNIT=iunit, FILE=TRIM(logfile) )
!CALL json%print_file( iunit )
!CLOSE( iunit )
!!
!CALL json%destroy()
!
s = '{ '
s = s // '"startdate" : ' //'"'//TRIM(cdate) //'" , '
s = s // '"startime" : ' //'"'//TRIM(ctime) //'" , '
s = s // '"package" : ' //'"WEST"' //' , '
s = s // '"program" : ' //'"'//TRIM(code) //'" , '
s = s // '"version" : ' //'"'//TRIM(west_version_number) //'" , '
IF( TRIM (west_git_revision) /= "unknown" ) THEN
s = s // '"git_version" : ' //'"'//TRIM(west_git_revision) //'" , '
ENDIF
s = s // '"website" : ' //'"http://www.west-code.org"' //' , '
s = s // '"citation" : ' //'"M. Govoni et al., J. Chem. Theory Comput. 11, 2680 (2015)."' //' , '
s = s // '"website" : ' //'"http://www.west-code.org"' //' , '
s = s // '"qeversion" : ' //'"'//TRIM(version_number) //'" , '
s = s // '"islittleendian" : ' //ltoa(islittleendian()) //' '
s = s // '}'
!
IERR = dict_create(attr)
IERR = attr%setitem("type", "intro" )
!
CALL append_log( s, attr )
!
CALL attr%destroy
!
ENDIF
!
END SUBROUTINE
......@@ -274,12 +305,12 @@ CONTAINS
!
! ... Report the mpi/openmp status
!
USE json_module, ONLY : json_file
USE io_global, ONLY : stdout
USE mp_global, ONLY : nimage,npool,nbgrp,nproc_image,nproc_pool,nproc_bgrp
USE mp_world, ONLY : nproc,mpime,root
USE io_push, ONLY : io_push_title,io_push_bar
USE westcom, ONLY : logfile
USE forpy_mod, ONLY : dict, dict_create
USE logfile_mod, ONLY : append_log, itoa
!
IMPLICIT NONE
!
......@@ -288,8 +319,10 @@ CONTAINS
#endif
!
INTEGER :: nth, ncores
TYPE(json_file) :: json
INTEGER :: iunit
!
INTEGER :: IERR
CHARACTER(LEN=:),ALLOCATABLE :: s
TYPE(dict) :: attr
!
#if defined(__OPENMP)
nth = omp_get_max_threads()
......@@ -324,25 +357,25 @@ CONTAINS
!
IF( mpime == root ) THEN
!
CALL json%initialize()
!
CALL json%load_file(filename=TRIM(logfile))
!
CALL json%add('parallel.nranks', nproc )
CALL json%add('parallel.nimage', nimage )
CALL json%add('parallel.npool', npool )
CALL json%add('parallel.nbgrp', nbgrp )
CALL json%add('parallel.nrg', nproc_bgrp )
CALL json%add('parallel.nproc', ncores )
s = '{ '
s = s // '"nranks" : ' //ITOA(nproc) //' , '
s = s // '"nimage" : ' //ITOA(nimage) //' , '
s = s // '"nimage" : ' //ITOA(nimage) //' , '
s = s // '"npool" : ' //ITOA(npool) //' , '
s = s // '"nbgrp" : ' //ITOA(nbgrp) //' , '
s = s // '"nrg" : ' //ITOA(nproc_bgrp) //' , '
#if defined(__OPENMP)
CALL json%add('parallel.nthreads', nth )
s = s // '"nthreads" : ' //ITOA(nth) //' , '
#endif
s = s // '"nproc" : ' //ITOA(ncores) //' '
s = s // '}'
!
IERR = dict_create(attr)
IERR = attr%setitem("type", "parallel" )
!
OPEN( NEWUNIT=iunit,FILE=TRIM(logfile) )
CALL json%print_file( iunit )
CLOSE( iunit )
CALL append_log( s, attr )
!
CALL json%destroy()
CALL attr%destroy
!
ENDIF
!
......
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