I am writing a simple test code to see how I could wrap a fortran code containing openacc regions and call from python. Here's the code.
module test
use iso_c_binding, only: sp => C_FLOAT, dp => C_DOUBLE, i8 => C_INT
implicit none
contains
subroutine add (a, b, n, c)
integer(kind=i8), intent(in) :: n
real(kind=dp), intent(in) :: a(n)
real(kind=dp), intent(in) :: b(n)
real(kind=dp), intent(out) :: c(n)
integer(kind=i8) :: i
!$acc enter data create(a, b, c)
do i = 1, n
c(i) = a(i) + b(i)
end do
!$acc exit data delete(a, b, c)
end subroutine add
subroutine mult (a, b, c)
real(kind=dp), intent(in) :: a
real(kind=dp), intent(in) :: b
real(kind=dp), intent(out) :: c
c = a * b
end subroutine mult
end module test
Now, if I don't use openacc, it works fine and I can use both add and mult from python. But after I put the openacc region, f2py compiles it fine, but when I try to import into python, I get the following error
ImportError: /home/vikram/Experiments/Experiments/fortran_python/hello.cpython-35m-x86_64-linux-gnu.so: undefined symbol: GOACC_enter_exit_data
This seems to tell me that Python needs to know how to find GOACC_enter_exit_data, I see that GOACC_enter_exit_data is in libgomp.so.1. How do I tell python its path.