You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to wrap fortran code with f2py. The fortran code includes some MPI calls and is compiled with the PGI compiler.
When importing the wrapped module in python I get this error: undefined symbol: mpi_comm_rank_
Reproducing code example:
1 ! file: helloworld.f90
2 subroutine sayhello(comm)
3 use mpi
4 implicit none
5 integer :: comm, rank, size, ierr
6 call MPI_Comm_size(comm, size, ierr)
7 call MPI_Comm_rank(comm, rank, ierr)
8 print *, 'Hello, World! I am process ',rank,' of ',size,'.'
9 end subroutine sayhello
The "linker_so" executable is chosen to be the pgfortran executable, whereas I would like to use the mpif90 executable instead.
This leads to the following error when importing the wrapped module from python:
An other possible workaround is to define LDSHARED environment variable: LDSHARED=mpif90 CC=gcc f2py --verbose --f90exec=mpif90 --fcompiler=pg -c helloworld.f90 -m helloworld
Uh oh!
There was an error while loading. Please reload this page.
I am trying to wrap fortran code with f2py. The fortran code includes some MPI calls and is compiled with the PGI compiler.
When importing the wrapped module in python I get this error:
undefined symbol: mpi_comm_rank_
Reproducing code example:
Compilation
CC=gcc f2py --verbose --f90exec=mpif90 --fcompiler=pg -c helloworld.f90 -m helloworld
Partial output
The "linker_so" executable is chosen to be the pgfortran executable, whereas I would like to use the mpif90 executable instead.
This leads to the following error when importing the wrapped module from python:
System informations
Workarround
This solves the problem in my case:
In file numpy/distutils/fcompiler/pg.py - line 36 (numpy installed version)
The executable supplied with the
--f90exec
option is then the one picked to be the linker executable and the ImportError does not occur.The text was updated successfully, but these errors were encountered: