From b8047274ed9ddc7c45d8a63142d218cd5da9e7c1 Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Thu, 26 Nov 2020 09:50:57 +0100 Subject: [PATCH] Fix the 'Below is the bug' bug in Phagen --- src/SConstruct | 11 ++++++----- src/msspec/phagen/fortran/phagen_scf_2.1_dp.f | 9 ++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/SConstruct b/src/SConstruct index d9d91fd..45dae48 100644 --- a/src/SConstruct +++ b/src/SConstruct @@ -20,7 +20,7 @@ def f2py_generator(source, target, env, for_signature): modulefile = str(target[0]) modulename = modulefile.replace(suffix, '').replace('/', '.') compiler = env['FORTRAN'] - + cmd = f"$F2PY --fcompiler={compiler} " cmd += f" $F2PY_OPTS -m {modulename} -c {objects} {main}" cmd += f" && cp {'/'.join(modulename.split('.'))}.*.so {modulefile}" @@ -86,14 +86,15 @@ AddOption('--f2py_path', # define environments gfortran_env = std.Clone(tools=['gfortran']) -gfortran_env.Replace(FORTRANFLAGS=['-fPIC', '-O2', '-ffast-math']) +#gfortran_env.Replace(FORTRANFLAGS=['-fPIC', '-O2', '-ffast-math', '-mcmodel=large', '-fdefault-real-8', '-fdefault-double-8']) +gfortran_env.Replace(FORTRANFLAGS=['-fPIC', '-mcmodel=large']) ifort_env = std.Clone(tools=['ifort']) # parse options if GetOption('compiler') == 'gfortran': env = gfortran_env - env.Append(F2PY_OPTS='--opt=-O2') + #env.Append(F2PY_OPTS='--opt=-O2') elif GetOption('compiler') == 'ifort': env = ifort_env @@ -107,9 +108,9 @@ else: if GetOption('dbg'): gfortran_env.Append(FORTRANFLAGS = ['-g', '-Wall', '-Wextra', '-Warray-temporaries', '-Wconversion', '-fbacktrace', '-ffree-line-length-0', - '-fcheck=all', '-ffpe-trap=zero,overflow,underflow', + '-fcheck=all', '-ffpe-trap=zero,overflow,underflow,invalid,denormal', '-finit-real=nan'], - F2PY_OPTS = ['--debug-capi', '--debug']) + F2PY_OPTS = ['--noopt', '--debug-capi', '--debug']) if GetOption('verbose'): env.Replace(FORTRANCOMSTR = "") diff --git a/src/msspec/phagen/fortran/phagen_scf_2.1_dp.f b/src/msspec/phagen/fortran/phagen_scf_2.1_dp.f index deb8bef..9201cec 100644 --- a/src/msspec/phagen/fortran/phagen_scf_2.1_dp.f +++ b/src/msspec/phagen/fortran/phagen_scf_2.1_dp.f @@ -14802,13 +14802,16 @@ c check = .true. ! ! MPI ! - if ( .not. do_r_in ) then -! if ( do_r_in ) then +CST if ( .not. do_r_in ) then +CST! if ( do_r_in ) then + if ( do_r_in ) then i = 1 ! - write(6,*) 'Below is the bug!' +CST write(6,*) 'Below is the bug!' +CST write(6,*) 'r_in=', r_in do +CST write(6,*) 'r_real(',i,')=', r_real(i) ! if ( r_real ( i ) > r_in ) then