Quantcast
Viewing all articles
Browse latest Browse all 22102

f2py: how to set gcc compiler options

I am using Python 2.7.17 and Numpy 1.16.5 to wrap a Fortran 77 code using f2py. Wrapping works well on several local machines but I get a segmentation fault at runtime on a remote server. I have similar environments, compilers and options**.

The main difference I observe so far comes from the C compilation in stdout of f2py compilation I get different optimization levels.

FCFLAGS = -I/appli/gcc/gcc-7.4.0__7.2.0/bin/ \
          --f77exec=gfortran \
          --f90exec=gfortran \
          --f77flags="-O0 -g -C" \
          --f90flags="-O0 -g -C " \
          --debug \
          --noopt

f2py $(FCFLAGS) -c -m module $(FSRC)

FSRC being F77 source files

during compilation the only notable difference is :

local:

C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-5Z483E/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC

remote:

C compiler: gcc -pthread -B /home2/datahome/jcollin/.conda/envs/mt3d_stochopy/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC

Therefore I wonder if there is a way to specify C compiler options in order to avoid having difference between local and remote ?

Thanks in advance for your help

** Exact environnements: local:

  • Python 2.7.15rc1
  • Numpy 1.16.3
  • Linux kernel 4.15.0-74-generic
  • gcc 7.4.0
  • Architecture: x86-64

remote:

  • Python 2.7.17
  • Numpy 1.16.5
  • Kernel: Linux 3.12.53-60.30-default
  • gcc (GCC) 7.4.0
  • Architecture: x86-64

Also a slight difference is that I used virtualenv 15.1.0 on local and anaconda (version 1.7.2) on remote


Viewing all articles
Browse latest Browse all 22102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>