[OpenACC, f2py] Importing OpenACC code in python gives me __offload_func_table error

Vikram Singh vikramsingh001@gmail.com
Fri Nov 18 17:29:00 GMT 2016


On Mon, Oct 31, 2016 at 2:04 PM, Vikram Singh <vikramsingh001@gmail.com> wrote:
> I am trying to test how I can use fortran codes using openacc from python.
>
> I wrote a simple test code

>
> I have to compile the code using
>
> f2py -c -m --f90flags='-fopenmp -fopenacc -foffload=nvptx-none -foffload=-O3
> -O3 -fPIC' hello hello.f90 -L/usr/local/cuda/lib64 -lcublas -lcudart
> -lgomp
>
> It compiles fine and makes the .so file but when I try to import in
> python, I get the error,
>
> /home/Experiments/fortran_python/hello.cpython-35m-x86_64-linux-gnu.so:
> undefined symbol: __offload_func_table
>
> I tried to search where __offload_func_table is defined but I only got
> crtoffloadtable.o, but no library where it is defined and I can link
> to.

So, now I copy crtoffloadbegin.o crtoffloadend.o from gcc directory
and then compile using

 f2py -c -m --verbose --f90flags=' -fopenmp  -fopenacc
-foffload=nvptx-none  -O3' hello hello.f90 crtoffloadbegin.o
crtoffloadend.o crtoffloadtable.o -L/usr/local/cuda/lib64 -lcublas
-lcudart -lgomp

It compiles fine as before and now I can even import hello in python.
But as soon as I execute the subroutine with openacc, I get the error

libgomp: target function wasn't mapped

I searched on the net and there was some errors related to crtoffload
previously.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68463

Is it possible the two problems are related?


>
> Any pointers?



More information about the Fortran mailing list