Skip to content

[BUG]: Build Error with CUDA 11.4-11.8.0 & Operators #4193

Closed
@ax3l

Description

@ax3l

Required prerequisites

Problem description

I am compiling pybind11 v2.10.0-38-g424ac4fe on Perlmutter at NERSC.

I use the following software modules:

module load cmake/3.22.0
module load PrgEnv-gnu
module load cudatoolkit/11.7
module load cray-python/3.9.7.1

# compiler environment hints
export CRAY_ACCEL_TARGET=nvidia80
export CC=cc #$(which gcc)
export CXX=CC #$(which g++)
export FC=ftn # $(which gfortran)
export CUDACXX=$(which nvcc)
export CUDAHOSTCXX=${CXX}

export CFLAGS="${CFLAGS} -O3 -ffast-math"
export CXXFLAGS="${CXXFLAGS} -O3 -ffast-math"
export FCLAGS="${FCFLAGS} -O3 -ffast-math"
$ CC --version
g++ (GCC) 11.2.0 20210728 (Cray Inc.)
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.

$ cc --version
gcc (GCC) 11.2.0 20210728 (Cray Inc.)
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.

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_May__3_18:49:52_PDT_2022
Cuda compilation tools, release 11.7, V11.7.64
Build cuda_11.7.r11.7/compiler.31294372_0

Reproducible example code

cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON
-- The CXX compiler identification is GNU 11.2.0
-- Cray Programming Environment 2.7.16 CXX
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/cray/pe/craype/2.7.16/bin/CC - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- pybind11 v2.11.0 dev1
-- CMake 3.22.0
-- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.15", minimum required is "3.6") 
-- Found PythonLibs: /usr/lib64/libpython3.6m.so
-- PYTHON 3.6.15
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- pybind11::lto enabled
-- pybind11::thin_lto enabled
-- Setting tests build type to MinSizeRel as none was specified
-- The CUDA compiler identification is NVIDIA 11.7.64
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /opt/nvidia/hpc_sdk/Linux_x86_64/22.5/cuda/11.7/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Skipping test_constants_and_functions due to incompatible exception specifications
-- Building tests WITHOUT Eigen, use -DDOWNLOAD_EIGEN=ON on CMake 3.11+ to download
-- Found Boost: /usr/include (found suitable version "1.66.0", minimum required is "1.56")  
CMake Warning at tools/pybind11Common.cmake:227 (message):
  Missing: pytest 3.1

  Try: /usr/bin/python3.6 -m pip install pytest
Call Stack (most recent call first):
  tests/CMakeLists.txt:476 (pybind11_find_import)


-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    DOWNLOAD_CATCH


-- Build files have been written to: /global/homes/a/ahuebl/src/pybind11/build
cmake --build build
[  2%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/pybind11_tests.cpp.o
[  4%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_async.cpp.o
[  6%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_buffers.cpp.o
[  8%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_builtin_casters.cpp.o
[ 10%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_call_policies.cpp.o
[ 13%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_callbacks.cpp.o
[ 15%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_chrono.cpp.o
[ 17%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_class.cpp.o
[ 19%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_const_name.cpp.o
[ 21%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_copy_move.cpp.o
[ 23%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_custom_type_casters.cpp.o
[ 26%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_custom_type_setup.cpp.o
[ 28%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_docstring_options.cpp.o
[ 30%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_enum.cpp.o
[ 32%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_eval.cpp.o
[ 34%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_exceptions.cpp.o
[ 36%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_factory_constructors.cpp.o
[ 39%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_gil_scoped.cpp.o
[ 41%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_iostream.cpp.o
[ 43%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_kwargs_and_defaults.cpp.o
[ 45%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_local_bindings.cpp.o
[ 47%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_methods_and_attributes.cpp.o
[ 50%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_modules.cpp.o
[ 52%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_multiple_inheritance.cpp.o
[ 54%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_numpy_array.cpp.o
[ 56%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_numpy_dtypes.cpp.o
[ 58%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_numpy_vectorize.cpp.o
[ 60%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_opaque_types.cpp.o
[ 63%] Building CUDA object tests/CMakeFiles/pybind11_tests.dir/test_operator_overloading.cpp.o
/global/homes/a/ahuebl/src/pybind11/tests/test_operator_overloading.cpp: In function 'void test_submodule_operators(pybind11::module_&)':
/global/homes/a/ahuebl/src/pybind11/tests/test_operator_overloading.cpp:157:78: error: no matching function for call to 'pybind11::class_<Vector2>::def(pybind11::detail::op_<pybind11::detail::op_add, pybind11::detail::op_l, pybind11::detail::self_t, pybind11::detail::self_t>)'
  157 |     py::class_<Vector2>(m, "Vector2")
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                        ^                      
/global/homes/a/ahuebl/src/pybind11/include/pybind11/pybind11.h:1557:1: note: candidate: 'template<class Func, class ... Extra> pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = Func; Extra = {Extra ...}; type_ = Vector2; options = {}]'
 1557 |     class_ &def(const char *name_, Func &&f, const Extra &...extra) {
      | ^  
/global/homes/a/ahuebl/src/pybind11/include/pybind11/pybind11.h:1557:1: note:   template argument deduction/substitution failed:
/global/homes/a/ahuebl/src/pybind11/tests/test_operator_overloading.cpp:157:78: note:   candidate expects at least 2 arguments, 1 provided
  157 |     py::class_<Vector2>(m, "Vector2")
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                        ^                      
/global/homes/a/ahuebl/src/pybind11/include/pybind11/pybind11.h:1582:1: note: candidate: 'template<pybind11::detail::op_id id, pybind11::detail::op_type ot, class L, class R, class ... Extra> pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const pybind11::detail::op_<(pybind11::detail::op_id)(id), (pybind11::detail::op_type)(ot), L, R>&, const Extra& ...) [with pybind11::detail::op_id id = id; pybind11::detail::op_type ot = ot; L = L; R = R; Extra = {Extra ...}; type_ = Vector2; options = {}]'
 1582 |     class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
      | ^  
/global/homes/a/ahuebl/src/pybind11/include/pybind11/pybind11.h:1582:1: note:   template argument deduction/substitution failed:
/global/homes/a/ahuebl/src/pybind11/tests/test_operator_overloading.cpp:157:78: note:   couldn't deduce template parameter 'id'
  157 |     py::class_<Vector2>(m, "Vector2")
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                        ^                      
/global/homes/a/ahuebl/src/pybind11/include/pybind11/pybind11.h:1594:1: note: candidate: 'template<class ... Args, class ... Extra> pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const pybind11::detail::initimpl::constructor<Args ...>&, const Extra& ...) [with Args = {Args ...}; Extra = {Extra ...}; type_ = Vector2; options = {}]'
 1594 |     class_ &def(const detail::initimpl::constructor<Args...> &init, const Extra &...extra) {
      | ^  
...

error.txt

More details

Failing compile line:

/opt/nvidia/hpc_sdk/Linux_x86_64/22.5/cuda/11.7/bin/nvcc -forward-unknown-to-host-compiler -ccbin=/opt/cray/pe/craype/2.7.16/bin/CC -DPYBIND11_TEST_BOOST -Dpybind11_tests_EXPORTS -I/global/homes/a/ahuebl/src/pybind11/include -isystem=/usr/include/python3.6m -O1 -DNDEBUG --generate-code=arch=compute_52,code=[compute_52,sm_52] -Xcompiler=-fPIC -Xcompiler=-fvisibility=hidden -Werror all-warnings -std=c++17 -MD -MT tests/CMakeFiles/pybind11_tests.dir/test_operator_overloading.cpp.o -MF CMakeFiles/pybind11_tests.dir/test_operator_overloading.cpp.o.d -x cu -c /global/homes/a/ahuebl/src/pybind11/tests/test_operator_overloading.cpp -o CMakeFiles/pybind11_tests.dir/test_operator_overloading.cpp.o

Pre-processed file from -E: test_operator_overloading.cpp.txt

Cross-References

NERSC ticket: INC0191398
Nvidia ticket: 3820295

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriageNew bug, unverified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions