8000 f2py and OpenMP linking · Issue #11908 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

f2py and OpenMP linking #11908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wtjones1 opened this issue Sep 8, 2018 · 5 comments
Closed

f2py and OpenMP linking #11908

wtjones1 opened this issue Sep 8, 2018 · 5 comments

Comments

@wtjones1
Copy link
wtjones1 commented Sep 8, 2018

When building an extension module with f2py from numpy as late as 1.15.1, the link command fails to include the OpenMP compiler flag (gfortran: -fopenmp, ifort: -qopenmp, etc.). Therefore, the extension module is not linked against the required Offloading and Multi Processing Runtime Library and possibly other dependent libraries which vary by compiler.

While there may be another method of specifying the appropriate linker option (which I would be interested in knowing), it would appear that this option should be passed to the linker as part of the linker_so options or equivalent.

Note that, at least with gfortran and ifort, a compiler command line option instructs the linker to include the Offloading and Multi Processing Runtime Library (which is dependent on the compiler used). Therefore, adding the library(s) in a generic way that supports multiple Fortran compilers in a build environment prevents the explicit listing of these libraries when invoking f2py.

Numpy/Python version information: 1.15.1

@charris
Copy link
Member
charris commented Sep 8, 2018

We don't currently have any maintainers dedicated to f2py. If you or someone else would like to work on this we would welcome a PR.

@Koushikphy
Copy link
Koushikphy commented Mar 18, 2019

I usually do this for gfortran
f2py -c file.f90 -m file_module --f90flags='-fopenmp' -lgomp
and for ifort
f2py -c file.f90 -m file_module --fcompiler=intelem --f90flags='-qopenmp' -liomp5

@carlkl
Copy link
Member
carlkl commented Jun 15, 2022

Isn't this solved since numpy-1.16.0 and defining: export NPY_DISTUTILS_APPEND_FLAGS=1?

See also: https://stackoverflow.com/questions/54201961/how-to-tell-f2py-module-to-look-in-current-directory-for-shared-object-dependenc

@HaoZeke HaoZeke removed their assignment Jun 16, 2022
@HaoZeke
Copy link
Member
HaoZeke commented Jun 16, 2022

Isn't this solved since numpy-1.16.0 and defining: export NPY_DISTUTILS_APPEND_FLAGS=1?

See also: https://stackoverflow.com/questions/54201961/how-to-tell-f2py-module-to-look-in-current-directory-for-shared-object-dependenc

Yup it does look like it, would be fantastic to have a docs PR close this :)

@HaoZeke
Copy link
Member
HaoZeke commented Sep 5, 2023

Should be fixed (replaced / deprecated) by #24532.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

5 participants
0