NVIDIA / MinkowskiEngine

Minkowski Engine is an auto-diff neural network library for high-dimensional sparse tensors
https://nvidia.github.io/MinkowskiEngine
Other
2.43k stars 360 forks source link

Installation error for pybind11: no matching function for op_eq #414

Closed chrischoy closed 2 years ago

chrischoy commented 2 years ago

During the installation, pybind11 does not recognize the equality operator and fails on a very rare case.

.../MinkowskiEngine/pybind/extern.hpp:744:887: error: no matching function for call to pybind11::class::def(pybind11::detail::op_<pybind11::detail::op_eq, pybind11::detail::op_l, pybind11::detail::self_t, pybind11::detail::selft>)

744 |   py::class_(m, "CoordinateMapKey")


Desktop (please complete the following information):

==========System==========
Linux-5.4.0-88-generic-x86_64-with-glibc2.10
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:57:06) 
[GCC 9.4.0]
==========Pytorch==========
1.9.1
torch.cuda.is_available(): True
==========NVIDIA-SMI==========
/usr/bin/nvidia-smi
Driver Version 450.119.04
CUDA Version 11.4
VBIOS Version 88.00.72.00.03
Image Version G503.0280.00.02
==========NVCC==========
/usr/local/cuda/bin/nvcc
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Aug_15_21:14:11_PDT_2021
Cuda compilation tools, release 11.4, V11.4.120
Build cuda_11.4.r11.4/compiler.30300941_0
==========CC==========
/usr/bin/c++
c++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 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.

==========MinkowskiEngine==========
0.5.4
MinkowskiEngine compiled with CUDA Support: True
NVCC version MinkowskiEngine is compiled: 11040
CUDART version MinkowskiEngine is compiled: 11040
chrischoy commented 2 years ago

Patch for this error

From 7d14735d025a7e50b954cdefa56985f7d41c3532 Mon Sep 17 00:00:00 2001
From: Chris Choy <cchoy@nvidia.com>
Date: Wed, 27 Oct 2021 03:06:17 +0000
Subject: [PATCH] fix

---
 pybind/extern.hpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pybind/extern.hpp b/pybind/extern.hpp
index b9f9247..8af002b 100644
--- a/pybind/extern.hpp
+++ b/pybind/extern.hpp
@@ -757,7 +757,11 @@ void initialize_non_templated_classes(py::module &m) {
                           minkowski::coordinate_map_key_type const &)) &
                           minkowski::CoordinateMapKey::set_key)
       .def("get_tensor_stride", &minkowski::CoordinateMapKey::get_tensor_stride)
-      .def(py::self == py::self);
+      .def("__eq__", [](const minkowski::CoordinateMapKey &self, const minkowski::CoordinateMapKey &other)
+                     {
+                       return self == other;
+                     });
+      //.def(py::self == py::self);
 }

 template <typename manager_type>
-- 
2.25.1

Save the above text into fix.patch. Then, apply this patch to the Minkowski Engine

git am < fix.patch