meng-tang / rloss

Regularized Losses (rloss) for Weakly-supervised CNN Segmentation
MIT License
207 stars 47 forks source link

undefined symbol: GOMP_parallel #7

Open yzou2 opened 5 years ago

yzou2 commented 5 years ago

Thanks for sharing the pytorch code. But when I import the bilateralfilter, I get the following error:

from bilateralfilter import bilateralfilter, bilateralfilter_batch

Traceback (most recent call last): File "", line 1, in File "../wrapper/bilateralfilter/build/lib.linux-x86_64-3.6/bilateralfilter.py", line 28, in _bilateralfilter = swig_import_helper() File "../wrapper/bilateralfilter/build/lib.linux-x86_64-3.6/bilateralfilter.py", line 24, in swig_import_helper _mod = imp.load_module('_bilateralfilter', fp, pathname, description) File "/usr/lib/python3.6/imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic return _load(spec) ImportError: ../wrapper/bilateralfilter/build/lib.linux-x86_64-3.6/_bilateralfilter.cpython-36m-x86_64-linux-gnu.so: undefined symbol: GOMP_parallel

Would you kindly give me some suggestions for solving this problem? Any suggestions will be appreciated. And can you post your version of libraries? Mine is as follows:

python 3.6.8 gcc 5.4.0 Ubuntu 16.04

meng-tang commented 5 years ago

Seems like sth. wrong with OpenMP, which is used to parallelize the loss layer. Try if you can build an OpenMP program. I'm using the same python, gcc, and Ubuntu.

ZhanghexuanJi commented 5 years ago

Hi, thanks for the pytorch code, but I encountered the similar issue as yzou2, with the undefined symbol: omp_get_thread_num

and actually, when I run "python3 setup.py build", I get some warning as: _running build running build_py copying bilateralfilter.py -> build/lib.linux-x86_64-3.7 running build_ext building '_bilateralfilter' extension gcc -pthread -B /media/MyDataStor2/zhanghex/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/media/MyDataStor2/zhanghex/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/media/MyDataStor2/zhanghex/anaconda3/include/python3.7m -c bilateralfilter_wrap.cxx -o build/temp.linux-x86_64-3.7/bilateralfilter_wrap.o -fopenmp cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /media/MyDataStor2/zhanghex/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/media/MyDataStor2/zhanghex/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/media/MyDataStor2/zhanghex/anaconda3/include/python3.7m -c bilateralfilter.cpp -o build/temp.linux-x86_64-3.7/bilateralfilter.o -fopenmp cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /media/MyDataStor2/zhanghex/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/media/MyDataStor2/zhanghex/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/media/MyDataStor2/zhanghex/anaconda3/include/python3.7m -c permutohedral.cpp -o build/temp.linux-x86_64-3.7/permutohedral.o -fopenmp cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ g++ -pthread -shared -B /media/MyDataStor2/zhanghex/anaconda3/compiler_compat -L/media/MyDataStor2/zhanghex/anaconda3/lib -Wl,-rpath=/media/MyDataStor2/zhanghex/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/bilateralfilter_wrap.o build/temp.linux-x86_64-3.7/bilateralfilter.o build/temp.linux-x86_64-3.7/permutohedral.o -o build/lib.linux-x86_64-3.7/_bilateralfilter.cpython-37m-x8664-linux-gnu.so

I don't know if this warning is the cause of the above issue. Could you provide any suggestion about it? Maybe it's due to some prerequisite packages, but I have no idea which one I'm missing.

Version of my libraries: python 3.6.7 (anaconda) gcc 5.4.0 Ubuntu 16.04 swig 2.0.12

ningscapr commented 4 years ago

I have the same problem here. Did any of you have a solution? I can build OpenMP program, but still have the ' undefined symbol: GOMP_parallel' probelm.

meng-tang commented 4 years ago

You can build a docker image from pytorch/Dockerfile.

Max-Manning commented 3 years ago

In case anyone is still struggling with this, I was able to solve the above issue by adding extra_link_args=['-lgomp'] to line 20 of pytorch/wrapper/bilateralfilter/setup.py.

HKervadec commented 1 year ago

Somehow I had a similar issue, for OpenMP, the solution was similar to the one of @Max-Manning : extra_link_args=['-lomp']