Whenever any model encounters functions like functional.generalized_spmm() or functional.generalized_rspmm() it crashes with a long stack trace saying that there are problems when JIT compiling the C++ code:
RuntimeError: Error building extension 'spmm': [1/3] c++ -MMD -MF spmm.o.d -DTORCH_EXTENSION_NAME=spmm -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_clang\" -DPYBIND11_STDLIB=\"_libcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1002\" -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/TH -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/THC -isystem /Users/migalkin/opt/miniconda3/envs/nbf/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -g -Ofast -fopenmp -c /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torchdrug/layers/functional/extension/spmm.cpp -o spmm.o
FAILED: spmm.o
c++ -MMD -MF spmm.o.d -DTORCH_EXTENSION_NAME=spmm -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_clang\" -DPYBIND11_STDLIB=\"_libcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1002\" -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/TH -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/THC -isystem /Users/migalkin/opt/miniconda3/envs/nbf/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -g -Ofast -fopenmp -c /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torchdrug/layers/functional/extension/spmm.cpp -o spmm.o
clang: error: unsupported option '-fopenmp'
[2/3] c++ -MMD -MF rspmm.o.d -DTORCH_EXTENSION_NAME=spmm -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_clang\" -DPYBIND11_STDLIB=\"_libcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1002\" -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/TH -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/THC -isystem /Users/migalkin/opt/miniconda3/envs/nbf/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -g -Ofast -fopenmp -c /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torchdrug/layers/functional/extension/rspmm.cpp -o rspmm.o
FAILED: rspmm.o
c++ -MMD -MF rspmm.o.d -DTORCH_EXTENSION_NAME=spmm -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_clang\" -DPYBIND11_STDLIB=\"_libcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1002\" -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/TH -isystem /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torch/include/THC -isystem /Users/migalkin/opt/miniconda3/envs/nbf/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -g -Ofast -fopenmp -c /Users/migalkin/opt/miniconda3/envs/nbf/lib/python3.8/site-packages/torchdrug/layers/functional/extension/rspmm.cpp -o rspmm.o
clang: error: unsupported option '-fopenmp'
ninja: build stopped: subcommand failed.
It seems that the problem is in the unsupported -fopenmp compiler flag for clang.
Torchdrug version is 0.1.0 h6151fa9. Python 3.8, torch 1.8.1.
I am running the code on macOS 11.2.1 (M1 CPU in the x86 compatibility mode, but it shouldn't matter I guess). clang version is:
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
The conda environment has the following packages:
attrs 21.2.0 pyhd8ed1ab_0 conda-forge
boost 1.74.0 py38h692b87f_3 conda-forge
boost-cpp 1.74.0 hff03dee_4 conda-forge
bzip2 1.0.8 h0d85af4_4 conda-forge
ca-certificates 2021.5.30 h033912b_0 conda-forge
cairo 1.16.0 he43a7df_1008 conda-forge
certifi 2021.5.30 py38h50d1736_0 conda-forge
cffi 1.14.6 py38h9688ba1_0 conda-forge
colorama 0.4.4 pyh9f0ad1d_0 conda-forge
coverage 5.5 py38h96a0964_0 conda-forge
cycler 0.10.0 py_2 conda-forge
decorator 4.4.2 py_0 conda-forge
easydict 1.9 pypi_0 pypi
fontconfig 2.13.1 h10f422b_1005 conda-forge
freetype 2.10.4 h4cff582_1 conda-forge
future 0.18.2 py38h50d1736_3 conda-forge
gettext 0.19.8.1 h7937167_1005 conda-forge
greenlet 1.1.1 py38ha048514_0 conda-forge
icu 68.1 h74dc148_0 conda-forge
iniconfig 1.1.1 pyh9f0ad1d_0 conda-forge
jbig 2.1 h0d85af4_2003 conda-forge
jinja2 3.0.1 pyhd8ed1ab_0 conda-forge
jpeg 9d hbcb3906_0 conda-forge
kiwisolver 1.3.2 py38h12bbefe_0 conda-forge
lcms2 2.12 h577c468_0 conda-forge
lerc 2.2.1 h046ec9c_0 conda-forge
libblas 3.9.0 11_osx64_mkl conda-forge
libcblas 3.9.0 11_osx64_mkl conda-forge
libcxx 12.0.1 habf9029_0 conda-forge
libdeflate 1.7 h35c211d_5 conda-forge
libffi 3.3 h046ec9c_2 conda-forge
libgfortran 5.0.0 9_3_0_h6c81a4c_23 conda-forge
libgfortran5 9.3.0 h6c81a4c_23 conda-forge
libglib 2.68.4 hd556434_0 conda-forge
libiconv 1.16 haf1e3a3_0 conda-forge
liblapack 3.9.0 11_osx64_mkl conda-forge
libpng 1.6.37 h7cec526_2 conda-forge
libprotobuf 3.16.0 hcf210ce_0 conda-forge
libtiff 4.3.0 h1167814_1 conda-forge
libwebp-base 1.2.1 h0d85af4_0 conda-forge
libxml2 2.9.12 h93ec3fd_0 conda-forge
llvm-openmp 12.0.1 hda6cdc1_1 conda-forge
lz4-c 1.9.3 he49afe7_1 conda-forge
markupsafe 2.0.1 py38h96a0964_0 conda-forge
matplotlib 3.4.3 py38h50d1736_0 conda-forge
matplotlib-base 3.4.3 py38hc7d2367_0 conda-forge
mkl 2021.3.0 h08c4f10_555 conda-forge
more-itertools 8.8.0 pyhd8ed1ab_0 conda-forge
ncurses 6.2 h2e338ed_4 conda-forge
networkx 2.6.2 pyhd8ed1ab_0 conda-forge
ninja 1.10.2 h9a9d8cb_0 conda-forge
numpy 1.21.2 py38h49b9922_0 conda-forge
olefile 0.46 pyh9f0ad1d_1 conda-forge
openjpeg 2.4.0 h6e7aa92_1 conda-forge
openssl 1.1.1l h0d85af4_0 conda-forge
packaging 21.0 pyhd8ed1ab_0 conda-forge
pandas 1.3.2 py38ha53d530_0 conda-forge
pcre 8.45 he49afe7_0 conda-forge
pillow 8.3.1 py38hee640a0_0 conda-forge
pip 21.2.4 pyhd8ed1ab_0 conda-forge
pixman 0.40.0 hbcb3906_0 conda-forge
pluggy 0.13.1 py38h50d1736_4 conda-forge
py 1.10.0 pyhd3deb0d_0 conda-forge
pycairo 1.20.1 py38h53d24c6_0 conda-forge
pycparser 2.20 pyh9f0ad1d_2 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pytest 6.2.5 py38h50d1736_0 conda-forge
pytest-cov 2.12.1 pyhd8ed1ab_0 conda-forge
python 3.8.11 h88f2d9e_1
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python_abi 3.8 2_cp38 conda-forge
pytorch 1.9.0 cpu_py38h0529baa_2 conda-forge
pytorch-cpu 1.9.0 cpu_py38he781eb1_2 conda-forge
pytz 2021.1 pyhd8ed1ab_0 conda-forge
pyyaml 5.4.1 pypi_0 pypi
rdkit 2021.03.5 py38h0bd8f9b_0 conda-forge
readline 8.1 h05e3726_0 conda-forge
reportlab 3.5.68 py38hf6ac518_0 conda-forge
scipy 1.7.1 py38hd329d04_0 conda-forge
setuptools 57.4.0 py38h50d1736_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
sleef 3.5.1 h35c211d_1 conda-forge
sqlalchemy 1.4.23 py38h96a0964_0 conda-forge
sqlite 3.36.0 h23a322b_0 conda-forge
tbb 2021.3.0 h940c156_0 conda-forge
tk 8.6.11 h5dbffcc_1 conda-forge
toml 0.10.2 pyhd8ed1ab_0 conda-forge
torch 1.8.1 pypi_0 pypi
torch-scatter 2.0.8 pypi_0 pypi
torchdrug 0.1.0 h6151fa9 milagraph
tornado 6.1 py38h96a0964_1 conda-forge
tqdm 4.62.2 pyhd8ed1ab_0 conda-forge
typing_extensions 3.10.0.0 pyha770c72_0 conda-forge
wheel 0.37.0 pyhd8ed1ab_1 conda-forge
xz 5.2.5 haf1e3a3_1 conda-forge
zlib 1.2.11 h7795811_1010 conda-forge
zstd 1.5.0 h582d3a0_0 conda-forge
What would be the way to fix this?
Thanks!
Whenever any model encounters functions like
functional.generalized_spmm()orfunctional.generalized_rspmm()it crashes with a long stack trace saying that there are problems when JIT compiling the C++ code:It seems that the problem is in the unsupported
-fopenmpcompiler flag forclang.Torchdrug version is
0.1.0 h6151fa9. Python 3.8, torch 1.8.1.I am running the code on macOS 11.2.1 (M1 CPU in the x86 compatibility mode, but it shouldn't matter I guess).
clangversion is:The conda environment has the following packages:
What would be the way to fix this?
Thanks!