Discussion:
[Numpy-discussion] Including .f2py_f2cmap in numpy.distutils?
Eric Hermes
2015-09-25 19:04:40 UTC
Permalink
Hello,

I am attempting to set up a numpy.distutils setup.py for a small python program that uses a Fortran module. Currently, the setup is able to compile and install the program seemingly successfully, but the f2py script erroneously maps the data types I am using to float, rather than double. I have the proper mapping set up in a .f2py_f2cmap in the source directory, but it does not seem to be copied to the build directory at compile time, and I cannot figure out how to make it get copied. Is there a simple way to do what I am trying to do? Alternatively, is there a way to specify the mapping in my setup.py scripts?

Here's a github repo with the project:

https://github.com/ehermes/ased3

Thanks,
Eric Hermes
Pearu Peterson
2015-09-28 13:28:09 UTC
Permalink
Hi,

Currently, .f2py_f2cmap must be located in a directory where setup.py or
f2py.py is called (to be exact, where numpy.f2py.capi_maps is imported).
This location is hardcoded and there is no way to specify the file location
within setup.py scripts.

However, you don't need to use .f2py_f2cmap file for specifying the correct
mapping. Read the code in numpy/f2py/capi_maps.py and you'll find that
inserting the following codelet to setup.py file might work (untested code):

from numpy.f2py.capi_maps import f2c_map
f2c_map['real'].update(sp='float', dp='double', qp='long_double')

HTH,
Pearu
Post by Eric Hermes
Hello,
I am attempting to set up a numpy.distutils setup.py for a small python
program that uses a Fortran module. Currently, the setup is able to compile
and install the program seemingly successfully, but the f2py script
erroneously maps the data types I am using to float, rather than double. I
have the proper mapping set up in a .f2py_f2cmap in the source directory,
but it does not seem to be copied to the build directory at compile time,
and I cannot figure out how to make it get copied. Is there a simple way to
do what I am trying to do? Alternatively, is there a way to specify the
mapping in my setup.py scripts?
https://github.com/ehermes/ased3
Thanks,
Eric Hermes
_______________________________________________
NumPy-Discussion mailing list
https://mail.scipy.org/mailman/listinfo/numpy-discussion
Loading...