Fix the 'Below is the bug' bug in Phagen

This commit is contained in:
Sylvain Tricot 2020-11-26 09:50:57 +01:00
parent 13593b8870
commit b8047274ed
2 changed files with 12 additions and 8 deletions

View File

@ -20,7 +20,7 @@ def f2py_generator(source, target, env, for_signature):
modulefile = str(target[0]) modulefile = str(target[0])
modulename = modulefile.replace(suffix, '').replace('/', '.') modulename = modulefile.replace(suffix, '').replace('/', '.')
compiler = env['FORTRAN'] compiler = env['FORTRAN']
cmd = f"$F2PY --fcompiler={compiler} " cmd = f"$F2PY --fcompiler={compiler} "
cmd += f" $F2PY_OPTS -m {modulename} -c {objects} {main}" cmd += f" $F2PY_OPTS -m {modulename} -c {objects} {main}"
cmd += f" && cp {'/'.join(modulename.split('.'))}.*.so {modulefile}" cmd += f" && cp {'/'.join(modulename.split('.'))}.*.so {modulefile}"
@ -86,14 +86,15 @@ AddOption('--f2py_path',
# define environments # define environments
gfortran_env = std.Clone(tools=['gfortran']) 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']) ifort_env = std.Clone(tools=['ifort'])
# parse options # parse options
if GetOption('compiler') == 'gfortran': if GetOption('compiler') == 'gfortran':
env = gfortran_env env = gfortran_env
env.Append(F2PY_OPTS='--opt=-O2') #env.Append(F2PY_OPTS='--opt=-O2')
elif GetOption('compiler') == 'ifort': elif GetOption('compiler') == 'ifort':
env = ifort_env env = ifort_env
@ -107,9 +108,9 @@ else:
if GetOption('dbg'): if GetOption('dbg'):
gfortran_env.Append(FORTRANFLAGS = ['-g', '-Wall', '-Wextra', '-Warray-temporaries', gfortran_env.Append(FORTRANFLAGS = ['-g', '-Wall', '-Wextra', '-Warray-temporaries',
'-Wconversion', '-fbacktrace', '-ffree-line-length-0', '-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'], '-finit-real=nan'],
F2PY_OPTS = ['--debug-capi', '--debug']) F2PY_OPTS = ['--noopt', '--debug-capi', '--debug'])
if GetOption('verbose'): if GetOption('verbose'):
env.Replace(FORTRANCOMSTR = "") env.Replace(FORTRANCOMSTR = "")

View File

@ -14802,13 +14802,16 @@ c check = .true.
! !
! MPI ! MPI
! !
if ( .not. do_r_in ) then CST if ( .not. do_r_in ) then
! if ( do_r_in ) then CST! if ( do_r_in ) then
if ( do_r_in ) then
i = 1 i = 1
! !
write(6,*) 'Below is the bug!' CST write(6,*) 'Below is the bug!'
CST write(6,*) 'r_in=', r_in
do do
CST write(6,*) 'r_real(',i,')=', r_real(i)
! !
if ( r_real ( i ) > r_in ) then if ( r_real ( i ) > r_in ) then