Skip to content

Runtime error on causal_product_cpu on GCC/G++ 11 #110

Description

@lsisoft

I've build pytorch fast transformers on Ubuntu 21.10, CUDA 11.6, GCC/G++ 11. Build worked fine. On:

import fast_transformers.causal_product.causal_product_cpu

from an init file, it throws the following error:
[...]
File "python3.8/site-packages/fast_transformers/builders/init.py", line 42, in
from ..attention import
File "python3.8/site-packages/fast_transformers/attention/init.py", line 13, in
from .causal_linear_attention import CausalLinearAttention
File "python3.8/site-packages/fast_transformers/attention/causal_linear_attention.py", line 15, in
from ..causal_product import causal_dot_product
File "python3.8/site-packages/fast_transformers/causal_product/init.py", line 9, in
from .causal_product_cpu import causal_dot_product as causal_dot_product_cpu,
ImportError: python3.8/site-packages/fast_transformers/causal_product/causal_product_cpu.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNSt15__exception_ptr13exception_ptr9_M_addrefEv

used update-alternatives and pointed to GCC/G++ 10, the runtime error is gone.

More versions, in verbose format. Due to the update-alternatives, I'm calling g++-11 and gcc-11 specifically, they were the default in Ubuntu 21.10:

✗ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Fri_Dec_17_18:16:03_PST_2021
Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0

✗ gcc-11 --version
gcc-11 (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

✗ g++-11 --version
g++-11 (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

Activity

  1. li-car-fei commented on Sep 10, 2022

    @li-car-fei

    I've build pytorch fast transformers on Ubuntu 21.10, CUDA 11.6, GCC/G++ 11. Build worked fine. On:

    import fast_transformers.causal_product.causal_product_cpu

    from an init file, it throws the following error: [...] File "python3.8/site-packages/fast_transformers/builders/init.py", line 42, in from ..attention import File "python3.8/site-packages/fast_transformers/attention/init.py", line 13, in from .causal_linear_attention import CausalLinearAttention File "python3.8/site-packages/fast_transformers/attention/causal_linear_attention.py", line 15, in from ..causal_product import causal_dot_product File "python3.8/site-packages/fast_transformers/causal_product/init.py", line 9, in from .causal_product_cpu import causal_dot_product as causal_dot_product_cpu, ImportError: python3.8/site-packages/fast_transformers/causal_product/causal_product_cpu.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNSt15__exception_ptr13exception_ptr9_M_addrefEv

    used update-alternatives and pointed to GCC/G++ 10, the runtime error is gone.

    More versions, in verbose format. Due to the update-alternatives, I'm calling g++-11 and gcc-11 specifically, they were the default in Ubuntu 21.10:

    ✗ nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2021 NVIDIA Corporation Built on Fri_Dec_17_18:16:03_PST_2021 Cuda compilation tools, release 11.6, V11.6.55 Build cuda_11.6.r11.6/compiler.30794723_0

    ✗ gcc-11 --version gcc-11 (Ubuntu 11.2.0-7ubuntu2) 11.2.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    ✗ g++-11 --version g++-11 (Ubuntu 11.2.0-7ubuntu2) 11.2.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

    I meet the same problem, have you solved it ?

  2. lsisoft commented on Sep 22, 2022

    @lsisoft
    Author

    My solution was to use ubuntu 'update-alternatives' to set GCC and G++ to the earlier version that works, for the duration of the compile time. The possibly proper solution would be to make it compile on the latest version.

  3. li-car-fei commented on Oct 9, 2022

    @li-car-fei

    maybe the question is from conda dependence

    I have found the solution like this: https://github.com/li-car-fei/fast-transformers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions