Go to the documentation of this file.
26 character(len=*),
parameter :: LIBVERSION = version_macro
54 character(len=9),
public,
parameter ::
io_nullfile =
"/dev/null"
55 character(len=6),
public,
parameter ::
io_stdout =
"STDOUT"
63 logical,
public ::
io_l = .false.
71 character(len=6),
public ::
io_jobid =
"UNKNWN"
85 integer,
private,
parameter :: io_minfid = 10
86 integer,
private,
parameter :: io_maxfid = 256
88 character(len=H_LONG),
private :: io_prefix
102 namelist / param_io / &
112 character(len=*),
intent(in) :: appname
113 character(len=*),
intent(in),
optional :: conf_name
114 character(len=*),
intent(in),
optional :: prefix
115 logical,
intent(in),
optional :: allow_noconf
117 character(len=H_LONG) :: fname
122 if (
present(conf_name) )
then
129 if (
present(prefix) )
then
140 h_libname =
'SCALE Library ver. '//trim(libversion)
148 log_error(
'IO_setup',*)
'Not appropriate names in namelist PARAM_IO . Check!'
163 integer,
intent(in) :: myrank
164 logical,
intent(in) :: is_master
166 namelist / param_io / &
175 character(len=H_LONG) :: fname
183 if ( is_master )
then
205 file = trim(fname), &
206 form =
'formatted', &
208 if ( ierr /= 0 )
then
209 log_error(
'IO_LOG_setup',*)
'File open error! :', trim(fname)
220 write(
io_fid_log,*)
' .+++++++++++++++++++++++ '
221 write(
io_fid_log,*)
' +++++++++++++++++++++++++ '
222 write(
io_fid_log,*)
' +++++++++++++++++++++++++++ '
223 write(
io_fid_log,*)
' =++++++=x######+++++++++++++; '
224 write(
io_fid_log,*)
' .++++++X####XX####++++++++++++ '
225 write(
io_fid_log,*)
' =+xxx=, ++++ +++++=##+ .###++++++++++- '
226 write(
io_fid_log,*)
' ,xxxxxxxxxx- +++++.+++++=## .##++++++++++ '
227 write(
io_fid_log,*)
' xxxxxxxxxxxxx -+++x#;+++++#+ ##+++++++++. '
228 write(
io_fid_log,*)
' xxxxxxxx##xxxx, ++++# +++++XX #+++++++++- '
229 write(
io_fid_log,*)
' xxxxxxx####+xx+x ++++#.++++++# #+++++++++ '
230 write(
io_fid_log,*)
' +xxxxxX#X #Xx#= =+++#x=++++=#. x=++++++++ '
231 write(
io_fid_log,*)
' xxxxxx#, x### .++++#,+++++#= x++++++++ '
232 write(
io_fid_log,*)
' xxxxxx#. ++++# +++++x# #++++++++ '
233 write(
io_fid_log,*)
' xxxxxx+ ++++#-+++++=# #++++++++ '
234 write(
io_fid_log,*)
',xxxxxX -+++XX-+++++#, +++++++++ '
235 write(
io_fid_log,*)
'=xxxxxX .++++#.+++++#x -++++++++ '
236 write(
io_fid_log,*)
'+xxxxx= ++++#.++++++# ++++++++# '
237 write(
io_fid_log,*)
'xxxxxx; ++++#+=++++=# ++++++++# '
238 write(
io_fid_log,*)
'xxxxxxx ,+++x#,+++++#- ;++++++++- '
239 write(
io_fid_log,*)
'#xxxxxx +++=# +++++xX ++++++++# '
240 write(
io_fid_log,*)
'xxxxxxxx ++++#-+++++=# +++++++++X '
241 write(
io_fid_log,*)
'-+xxxxxx+ ++++X#-++++=#. -++; =++++++++# '
242 write(
io_fid_log,*)
' #xxxxxxxx. .+++++# +++++#x =++++- +++++++++XX '
243 write(
io_fid_log,*)
' #xxxxxxxxxx=--=++++++#.++++++# ++++++ -+++++++++x# '
244 write(
io_fid_log,*)
' #+xxxxxxxxxx+++++++#x=++++=# ++++++;=+++++++++++x# '
245 write(
io_fid_log,*)
' =#+xxxxxxxx+++++++##,+++++#= =++++++++++++++++++##. '
246 write(
io_fid_log,*)
' X#xxxxxxxx++++++## +++++x# ;x++++++++++++++++##. '
247 write(
io_fid_log,*)
' x##+xxxx+++++x## +++++=# ##++++++++++++x##X '
248 write(
io_fid_log,*)
' ,###Xx+++x###x -++++=#, .####x+++++X####. '
249 write(
io_fid_log,*)
' -########+ -#####x .X#########+. '
252 write(
io_fid_log,*)
' .X####### +###- =###+ ###x x######## '
253 write(
io_fid_log,*)
' .######### ######X ####### #### .#########x '
254 write(
io_fid_log,*)
' ####+++++= X#######. -#######x .###; ####x+++++. '
255 write(
io_fid_log,*)
' ### ###= #### #### x### #### -###. '
256 write(
io_fid_log,*)
' .### #### ###+ X### ###X =###. #### '
257 write(
io_fid_log,*)
' ###- ;###, .###+ -### #### x##########+ '
258 write(
io_fid_log,*)
' +####x #### #### #### #### ###########. '
259 write(
io_fid_log,*)
' x######. =### ###, .###- ###+ x###-------- '
260 write(
io_fid_log,*)
' =##### X### -### #### ,### #### '
261 write(
io_fid_log,*)
' .###=x###; .###+ ###X ###X ####. '
262 write(
io_fid_log,*)
' ###########; ###########+ ########### ########### ,##########. '
263 write(
io_fid_log,*)
'-########### ,##########, #########X ########## +######### '
264 write(
io_fid_log,*)
',,,,,,,,,,. ,,,,,,,,, .,,,,,,,. .,,,,,,,, ,,,,,,,, '
266 write(
io_fid_log,*)
' SCALE : Scalable Computing by Advanced Library and Environment '
273 log_info(
"IO_LOG_setup",*)
'Setup'
275 log_info(
'IO_LOG_setup',
'(1x,A,I3)')
'Open config file, FID = ',
io_fid_conf
276 log_info(
'IO_LOG_setup',
'(1x,A,I3)')
'Open log file, FID = ',
io_fid_log
277 log_info(
'IO_LOG_setup',
'(1x,2A)')
'basename of log file = ', trim(
io_log_basename)
282 if( is_master )
write(*,*)
'*** Log report is suppressed.'
287 log_info(
"IO_LOG_setup",*)
'The used configurations are output to the file.'
288 log_info(
"IO_LOG_setup",*)
'filename of used config file = ', trim(fname)
290 if ( is_master )
then
295 form =
'formatted', &
297 if ( ierr /= 0 )
then
298 log_error(
'IO_LOG_setup',*)
'File open error! :', trim(fname)
302 log_info(
"IO_LOG_setup",
'(1x,A,I3)')
'Open file to output used config, FID = ',
io_fid_nml
304 write(
io_fid_nml,
'(A)')
'################################################################################'
308 write(
io_fid_nml,
'(A)')
'################################################################################'
314 log_info(
"IO_LOG_setup",*)
'The file for used config is open by the master rank'
320 log_info(
"IO_LOG_setup",*)
'The used config is output to the log.'
322 log_info(
"IO_LOG_setup",*)
'The used config is not output.'
341 log_progress(*)
'Closing LOG file'
358 do fid = io_minfid, io_maxfid
359 inquire(fid,opened=i_opened)
360 if ( i_opened )
close(fid)
379 do fid = io_minfid, io_maxfid
380 inquire(fid,opened=i_opened)
381 if ( .NOT. i_opened )
return
384 if ( fid >= io_maxfid )
then
385 log_error(
"IO_get_available_fid",*)
'Used I/O unit number reached to the limit! STOP'
399 integer,
intent(in) :: myrank
400 integer,
intent(in) :: jobid
401 integer,
intent(in) :: domainid
423 character(len=*),
intent(out) :: outstr
424 character(len=*),
intent(in) :: instr
425 integer,
intent(in),
optional :: rank
426 character(len=*),
intent(in),
optional :: ext
427 integer,
intent(in),
optional :: len
430 character(len=H_SHORT) :: ext_
431 character(len=8) :: srank
432 character(len=6) :: fmt
435 if (
present(rank) )
then
436 if (
present(ext) )
then
441 if ( rank >= 0 )
then
442 if (
present(len) )
then
447 write(fmt,
'(A,I1,A,I1,A)')
'(I', len_,
'.', len_,
')'
448 write(srank, fmt) rank
449 outstr = trim(instr)//
'.'//trim(ext_)//trim(srank)
451 outstr = trim(instr)//
'.'//trim(ext_)//
"all"
457 if ( io_prefix /=
"" .and. outstr(1:1) /=
"/" )
then
458 outstr = trim(io_prefix) // trim(outstr)
469 logical,
intent(in) :: is_master
470 logical,
intent(in),
optional :: allow_noconf
472 character(len=H_LONG) :: fname
473 logical :: allow_noconf_
476 if ( command_argument_count() < 1 )
then
477 allow_noconf_ = .false.
478 if (
present(allow_noconf) ) allow_noconf_ = allow_noconf
479 if ( .not. allow_noconf_ )
then
481 log_error(
"IO_ARG_getfname",*)
'Program needs config file from argument! STOP.'
488 call get_command_argument(1,fname)
502 character(len=*),
intent(in) :: fname
503 logical,
intent(in) :: is_master
512 file = trim(fname), &
513 form =
'formatted', &
517 if ( ierr /= 0 )
then
519 log_error(
"IO_CNF_open",*)
'Failed to open config file! STOP.'
520 log_error(
"IO_CNF_open",*)
'filename : ', trim(fname)
character(len=6), public io_universalrank
universal rank for error log
character(len=6), public io_domainid
nesting domain id for error log
character(len=h_long), public io_log_basename
basename of logfile
subroutine, public io_set_universalrank(myrank, jobid, domainid)
Put for error log.
integer, parameter, public file_hlong
character(len=6), public io_jobid
bulk job id for error log
integer, parameter, public file_hmid
integer, public io_step_to_stdout
interval for output current step to STDOUT (negative is off)
integer function, public io_get_available_fid()
search & get available file ID
character(len=h_mid), public h_institute
for file header
character(len=h_mid), public h_source
for file header
integer, parameter, public file_hshort
character(len=h_long), public io_nml_filename
filename of logfile (only for output namelist)
integer, parameter, public h_mid
Character length (short=64)
subroutine, public io_get_fname(outstr, instr, rank, ext, len)
generate process specific filename
character(len=9), parameter, public io_nullfile
character(len=h_mid), public h_appname
name of the application
integer, public io_fid_log
Log file ID.
integer, parameter, public h_short
Character length (short=16)
subroutine, public io_finalize
integer, parameter, public h_long
Character length (short=256)
logical, public io_log_nml_suppress
suppress all of log output? (for namelist)
logical, public io_log_suppress
suppress all of log output?
character(len=6), parameter, public io_stdout
character(len=h_mid), public h_libname
name and version of the library
logical, public io_l
output log or not? (this process)
integer, public io_fid_nml
Log file ID (only for output namelist)
logical, public io_nml
output log or not? (for namelist, this process)
integer, parameter, public io_fid_stdout
logical, public io_log_allnode
output log for each node?
subroutine, public io_log_setup(myrank, is_master)
Setup LOG.
character(len=h_long) function, public io_arg_getfname(is_master, allow_noconf)
get config filename from argument
integer function, public io_cnf_open(fname, is_master)
open config file
integer, public io_fid_conf
Config file ID.
subroutine, public io_setup(APPNAME, conf_name, prefix, allow_noconf)
Setup.
character(len=6), public io_localrank
local rank for error log