Break IF, Fortran doesn't support shortcut

This commit is contained in:
alazzaro 2021-09-10 09:43:21 -05:00 committed by Alfio Lazzaro
parent cc47dde2a6
commit ca5cdc8c53
2 changed files with 28 additions and 19 deletions

View file

@ -109,7 +109,7 @@ CONTAINS
INTEGER :: bcast_output_unit, handle, i, ierr, &
output_unit
LOGICAL :: success
LOGICAL :: init_rng, success
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: init_rng_seed
TYPE(cp_logger_type), POINTER :: logger, logger_sub
TYPE(section_vals_type), POINTER :: tmc_ana_section
@ -166,23 +166,27 @@ CONTAINS
!CALL init_move_types(tmc_params=tmc_env%params)
! init random number generator: use determistic random numbers
IF (tmc_env%tmc_comp_set%group_nr .EQ. 0 .AND. &
tmc_env%m_env%rnd_init .GT. 0) THEN
ALLOCATE (init_rng_seed(3, 2))
init_rng_seed(:, :) = &
RESHAPE((/tmc_env%m_env%rnd_init*42.0_dp, &
tmc_env%m_env%rnd_init*54.0_dp, &
tmc_env%m_env%rnd_init*63.0_dp, &
tmc_env%m_env%rnd_init*98.0_dp, &
tmc_env%m_env%rnd_init*10.0_dp, &
tmc_env%m_env%rnd_init*2.0_dp/), &
(/3, 2/))
tmc_env%rng_stream = rng_stream_type( &
name="TMC_deterministic_rng_stream", &
seed=init_rng_seed(:, :), &
distribution_type=UNIFORM)
DEALLOCATE (init_rng_seed)
ELSE
init_rng = .TRUE.
IF (tmc_env%tmc_comp_set%group_nr .EQ. 0) THEN
IF (tmc_env%m_env%rnd_init .GT. 0) THEN
init_rng = .FALSE.
ALLOCATE (init_rng_seed(3, 2))
init_rng_seed(:, :) = &
RESHAPE((/tmc_env%m_env%rnd_init*42.0_dp, &
tmc_env%m_env%rnd_init*54.0_dp, &
tmc_env%m_env%rnd_init*63.0_dp, &
tmc_env%m_env%rnd_init*98.0_dp, &
tmc_env%m_env%rnd_init*10.0_dp, &
tmc_env%m_env%rnd_init*2.0_dp/), &
(/3, 2/))
tmc_env%rng_stream = rng_stream_type( &
name="TMC_deterministic_rng_stream", &
seed=init_rng_seed(:, :), &
distribution_type=UNIFORM)
DEALLOCATE (init_rng_seed)
ENDIF
ENDIF
IF (init_rng) THEN
tmc_env%rng_stream = rng_stream_type( &
name="TMC_rng_stream", &
distribution_type=UNIFORM)

View file

@ -72,6 +72,7 @@ import operator
import os
import imp
def read_file(filename, field, special_keys, stats_keys):
try:
nline = 0
@ -129,6 +130,7 @@ def read_file(filename, field, special_keys, stats_keys):
print("Exit")
sys.exit(-1)
def print_value(ref, value, show_comp):
if ref > 0:
comp = (value - ref) / ref * 100
@ -147,10 +149,12 @@ def print_value(ref, value, show_comp):
else:
sys.stdout.write(color + "%10.3f" % value + endc)
#################
# Main function #
#################
def main():
parser = argparse.ArgumentParser(description="Comparison of CP2K output timings.")
parser.add_argument("file_lists", nargs="+", help="list of files")
@ -271,7 +275,7 @@ def main():
color = "\033[0m"
endc = "\033[0m"
for filename in args.file_lists:
if len(files[filename][1]) > 0 and ref !=0:
if len(files[filename][1]) > 0 and ref != 0:
comp = (float(files[filename][1]) - ref) / ref
if abs(comp) > 1e-14:
color = "\033[91m"
@ -330,5 +334,6 @@ def main():
print("")
# ===============================================================================
main()