STDIO : Standard Input/Output module written by Son, Sang-Kil in Mar. 2005 This module requires two intrinsic subroutines: getarg() and getenv()
Data type - Argument : for command-line & input file options
Functions(F) and subroutines(SR) - SR error_message( string ) : print error messages and stop
SR show_input( ARG ) : show options from input file and command line
SR footnote() : print out CPU_time, current time, and hostname
SR check_time( counter ) : check elapsed time
F job_time() : return job time converted from counter with hostname . F job_time_integer( counter ) : integer value from check_time() . F job_time_real( CPU_time ) : real value from CPU_time()
F today() : return the date string of today
returns job time
return the time string converted from counter ex) counter=100000000 with integer(8) --> 100 sec --> 1 minute 40.00 seconds
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=8), | intent(in) | :: | counter |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | time |
get one option value or string from ARG The first chracter of ARG%option(i) should be + or -. That's why it is taken by ARG%option(i)(2:).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(argument), | intent(in) | :: | arg | |||
character(len=*), | intent(in) | :: | option_name | |||
character(len=*), | intent(out) | :: | string |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(argument), | intent(in) | :: | arg | |||
character(len=*), | intent(in) | :: | option_name | |||
real(kind=long), | intent(out) | :: | value | |||
real(kind=long), | intent(out), | optional | :: | value2 |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(argument), | intent(in) | :: | arg | |||
character(len=*), | intent(in) | :: | option_name | |||
integer, | intent(out) | :: | value | |||
integer, | intent(out), | optional | :: | value2 |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(argument), | intent(in) | :: | arg | |||
character(len=*), | intent(in) | :: | option_name | |||
logical, | intent(inout) | :: | yes |
returns current memory
returns peak memory
general command line argument
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | n | ||||
character(len=2048), | public, | dimension(:), allocatable | :: | option | |||
character(len=2048), | public, | dimension(:), allocatable | :: | string | |||
real(kind=long), | public, | dimension(:), allocatable | :: | value | |||
real(kind=long), | public, | dimension(:), allocatable | :: | value2 | |||
logical, | public, | dimension(:), allocatable | :: | yes |
parses a string array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | buffer | |||
character(len=1), | intent(in) | :: | delim |
parses an integer array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | buffer | |||
character(len=1), | intent(in) | :: | delim | |||
character(len=1), | intent(in), | optional | :: | rangedelim |
parses a float array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | buffer | |||
character(len=1), | intent(in) | :: | delim |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | time |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(argument), | intent(inout) | :: | arg |
show error message and stop the program
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | optional | :: | s |
if filename2 is specified, override reading of command line options. instead only read from filename2
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(argument), | intent(out) | :: | arg | |||
character(len=*), | intent(in), | optional | :: | filename2 |
convert string into lowercase
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | string |
convert string into uppercase
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | string |
Use this procedure when you want a check point. But, for initilization, you must put this without counter at the very begining of your program. ex) check_time() ... check_time( c, t ) print *, job_time( c )
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=8), | intent(out), | optional | :: | c | ||
real, | intent(out), | optional | :: | t |
checkpoint(): more convenient procedure than check_time() An array time(0:) is a table containing all checkpoint times - time(0) : reference time stamp - time(1) : elapsed time for the first checkpoint - time(2) : elapsed time for the second checkpoint - ... ex) call init_checkpoint( time ) : initialize a time array ... (do some calculations) ... call checkpoint( time ) : make a checkpoint with the time array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(inout) | :: | time(0:) | |||
integer, | intent(in), | optional | :: | counter |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(inout) | :: | time(0:) |
print out CPU_time, current time, and hostname With PGI compiler, CPU_time gives real time instead of CPU time. What can I do for it? Huh? USAGE) call init_time() ... call footnote()
prints footnote
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | optional | :: | iout |
converts a c_char pointer array cStrPtr to a fortran string fStr
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(c_ptr), | intent(in) | :: | cstrptr |
c pointer to a char* array |
||
character(len=*), | intent(out) | :: | fstr |
fortan string |