getkeops / keops

KErnel OPerationS, on CPUs and GPUs, with autodiff and without memory overflows
https://www.kernel-operations.io
MIT License
1.03k stars 65 forks source link

KeOps CPU backend 'g++ not found' #302

Open JCBrouwer opened 1 year ago

JCBrouwer commented 1 year ago

Hello, I'm running into this issue when compiling a Genred for the CPU backend. I assume it's a simple environment issue. I have g++ installed (as well as build-essential etc.).

How can I make sure that KeOps can find the compiler? Is there a good way to make this portable and search as widely as possible on unknown systems as well?

Stack trace:

/root/build/env/lib/python3.10/site-packages/pykeops/torch/generic/generic_red.py:627: in __call__
    out = GenredAutograd.apply(
/root/build/env/lib/python3.10/site-packages/torch/autograd/function.py:506: in apply
    return super().apply(*args, **kwargs)  # type: ignore[misc]
/root/build/env/lib/python3.10/site-packages/pykeops/torch/generic/generic_red.py:78: in forward
    myconv = keops_binder["nvrtc" if tagCPUGPU else "cpp"](
/root/build/env/lib/python3.10/site-packages/keopscore/utils/Cache.py:68: in __call__
    obj = self.cls(*args)
/root/build/env/lib/python3.10/site-packages/pykeops/common/keops_io/LoadKeOps_cpp.py:15: in __init__
    super().__init__(*args, fast_init=fast_init)
/root/build/env/lib/python3.10/site-packages/pykeops/common/keops_io/LoadKeOps.py:31: in __init__
    self.init_phase2()
/root/build/env/lib/python3.10/site-packages/pykeops/common/keops_io/LoadKeOps_cpp.py:40: in init_phase2
    mylib = importlib.import_module(
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'pykeops_cpp_b5f6bb40b3', import_ = <function _gcd_import at 0x7f0774023400>

>   ???
E   ModuleNotFoundError: No module named 'pykeops_cpp_b5f6bb40b3'

<frozen importlib._bootstrap>:1004: ModuleNotFoundError
---------------------------------------------------------------------------------------------- Captured stdout setup -----------------------------------------------------------------------------------------------
Loaded tests/data/timeseries/gaussian.parquet, timeseries shape: (256, 4096)
----------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------
[KeOps] Generating code for formula Sum_Reduction(ComplexMult(Real2Complex(1/ComplexSquareAbs(ComplexMult(Var(1,2,0)-Var(2,2,1),Var(1,2,0)-Conj(Var(2,2,1))))),ComplexMult(Var(1,2,0)*ComplexReal(Var(0,2,1))-Real2Complex(Sum(Var(0,2,1)*Var(2,2,1))),Conj(ComplexMult(Var(1,2,0)-Var(2,2,1),Var(1,2,0)-Conj(Var(2,2,1)))))),0) ... OK
[pyKeOps] Compiling pykeops cpp b5f6bb40b3 module ... 
[KeOps] Warning : There were warnings or errors compiling formula :
/bin/sh: 1: g++: not found

g++ -v:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) 

Thanks!