[Numpy-discussion] F2PY problems with PGI compilers

Ralf Gommers ralf.gommers at gmail.com
Sat Aug 12 00:34:48 EDT 2017


On Sat, Aug 5, 2017 at 7:24 AM, Jeff Layton <laytonjb at att.net> wrote:

> Good afternoon!
>
> I'm trying to build a Python module using F2PY on a simple Fortran code
> using the PGI 17.4 community compilers.
>
> I'm using Conda 4.3.21 with Python 2.7.13 and F2PY 2. The command line I'm
> using is,
>
>
> f2py --compiler=pg --fcompiler=pg -c -m mdevice mdevice.f90
>
>
> The output from f2py is at the end of the email. Any suggestions are
> greatly appreciated.
>

--compiler=pg seems wrong, that specifies the C/C++ compiler to use not the
Fortran compiler. Hence you get the error "don't know how to compile C/C++
code on platform 'posix' with 'pg' compiler". Try just leaving that off
(thereby using the default C compiler you have installed, probably gcc).

Ralf




> Thanks!
>
> Jeff
>
>
> Output from f2py:
>
>
>
> 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
> build_src
> building extension "mdevice" sources
> f2py options: []
> f2py:> /tmp/tmptN1fdp/src.linux-x86_64-2.7/mdevicemodule.c
> creating /tmp/tmptN1fdp/src.linux-x86_64-2.7
> Reading fortran codes...
>         Reading file 'mdevice.f90' (format:free)
> Post-processing...
>         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"...
>                   devicequery()
>         Wrote C/API module "mdevice" to file "/tmp/tmptN1fdp/src.linux-x86_
> 64-2.7/mdevicemodule.c"
>   adding '/tmp/tmptN1fdp/src.linux-x86_64-2.7/fortranobject.c' to sources.
>   adding '/tmp/tmptN1fdp/src.linux-x86_64-2.7' to include_dirs.
> copying /home/laytonjb/anaconda2/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c
> -> /tmp/tmptN1fdp/src.linux-x86_64-2.7
> copying /home/laytonjb/anaconda2/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.h
> -> /tmp/tmptN1fdp/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
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20170812/165e1ceb/attachment.html>


More information about the NumPy-Discussion mailing list