[OpenACC, f2py] Importing OpenACC code in python gives me __offload_func_table error
Vikram Singh
vikramsingh001@gmail.com
Mon Nov 7 17:23:00 GMT 2016
On Mon, Nov 7, 2016 at 7:04 PM, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> On Mon, Nov 07, 2016 at 05:31:20PM +0200, Vikram Singh wrote:
>> Anyone?
>
> Please, do not top post. It loses context
>
Hi. Sorry for that.
>
>> On Mon, Oct 31, 2016 at 2:04 PM, Vikram Singh <vikramsingh001@gmail.com> wrote:
>> >
>> > 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.
>
> fortran@gcc is a list for the discussion of the development
> of gfortran. It is not a phython user support forum. Have
> asked the f2py developers or on a f2py forum for help?
>
Yes, I did, did not get any response.
> Instead of using f2py, have you considered using gfortran?
>
I am actually using gfortran, 6.2 with offloading to nvptx enabled,
that is why I am posting here. f2py is just a kind of wrapper so that
python understand modules written in fortran. When I call
f2py -c -m --f90flags='-fopenmp -fopenacc -foffload=nvptx-none -foffload=-O3
-O3 -fPIC' hello hello.f90 -L/usr/local/cuda/lib64 -lcublas -lcudart
basically I am telling f2py what flags to send to gfortran so
basically the compilation it does is
gfortran -Wall -g -fopenmp -fopenacc -foffload=nvptx-none
-foffload=-O3 -O3 -fPIC
So using this it compiles and makes a shared object. Then I import
this shared object into python and I get the error.
> Does 'nm crtoffloadtable.o' show the symbol __offload_func_table?
> If yes, then the answer is obvious.
>
Yes, nm does show that symbol. But my problem is shouldn't the symbol
be in one of the libraries, for eg, in libgomp-plugin-nvptx.so.1. What
is the purpose of crtoffloadtable.o separately.
> --
> Steve
Thanks.
More information about the Fortran
mailing list