Community version 17.4 and F2PY


I posted this question before in the forums, but the answer didn’t solve the problem and I can’t reply to posts (seems kind of silly).

Anyway, I’m trying to use F2PY version 2 to use the Community PGI compilers version 17.4 to build a Fortran code into a Python module. I can do it with the GCC compilers but not with the PGI compilers.

The command line I use is,

f2py --compiler=pg --fcompiler=pg -c -m mdevice mdevice.f90

The output from F2PY is the following:

running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
building extension “mdevice” sources
f2py options:
f2py:> /tmp/tmpirC8jC/src.linux-x86_64-2.7/mdevicemodule.c
creating /tmp/tmpirC8jC/src.linux-x86_64-2.7
Reading fortran codes…
Reading file ‘mdevice.f90’ (format:free)
Block: mdevice
Block: devicequery
In: :mdevice:mdevice.f90:devicequery
get_useparameters: no module cudafor info used by devicequery
Post-processing (stage 2)…
Building modules…
Building module “mdevice”…
Constructing wrapper function “devicequery”…
Wrote C/API module “mdevice” to file “/tmp/tmpirC8jC/src.linux-x86_64-2.7/mdevicemodule.c”
adding ‘/tmp/tmpirC8jC/src.linux-x86_64-2.7/fortranobject.c’ to sources.
adding ‘/tmp/tmpirC8jC/src.linux-x86_64-2.7’ to include_dirs.
copying /home/laytonjb/anaconda2/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmpirC8jC/src.linux-x86_64-2.7
copying /home/laytonjb/anaconda2/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmpirC8jC/src.linux-x86_64-2.7
build_src: building npy-pkg config files
running build_ext
error: don’t know how to compile C/C++ code on platform ‘posix’ with ‘pg’ compiler

I have no clue what the output means. Adding “–verbose” to the f2py command line doesn’t provide any more output.



Hi Jeff,

Sorry but I don’t have experience with f2py. Though from the output, it looks like a configuration problem with f2py not configuring the PGI C/C++ compilers correctly. Can the f2py folks help you with this one?

It’s unclear why you couldn’t reply to the older posts. You should have been able to.