Compilation Bug with `Eigen::AMDOrdering` and CUDA
Summary
There is a compilation error that occurs when using Eigen::SimplicialLDLT with Eigen::AMDOrdering on CUDA, even if the code does not execute anything on the GPU. The following code snippet:
Eigen::SparseMatrix<float> A;
Eigen::SimplicialLDLT<Eigen::SparseMatrix<float>,
Eigen::UpLoType::Lower,
Eigen::AMDOrdering<int>> solver;
solver.compute(A);
produces the following error in Visual Studio 2022 (using CUDA 12.5):
Error: function "Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::operator=(const Eigen::Block<Eigen::Matrix<int, -1, 1, 0, -1, 1>, -1, -1, false> &) [with XprType=Eigen::Matrix<int, -1, 1, 0, -1, 1>, BlockRows=-1, BlockCols=-1, InnerPanel=false]" (declared implicitly) cannot be referenced -- it is a deleted function
However, the same code compiles successfully when included in a .cpp file. This repository provides examples showing that the code compiles correctly with a.cpp file but fails to compile with .cu file.
Environment
- Operating System : Windows
- Eigen Version : master
- Compiler Version : Visual Studio 2022 + CUDA 12.5
Minimal Example
The full code is here https://github.com/Ahdhn/EigenBug with both pure C++ and CUDA. The error can be seen here on Github Action log https://github.com/Ahdhn/EigenBug/actions/runs/10087925951/job/27892843797#step:7:41
Steps to reproduce
Just clone this code and follow the simple build instruction in there.
Anything else that might help
The error points to this line in PlainObjectBase.h. It seems that the issue originates from this line in the Amd.h file where the permutation matrix (perm) gets is resized.
Note that this problem does not occur if the Eigen::COLAMDOrdering reordering method is used.
I would like to help fixing this bug if someone could give me pointers.
-
Have a plan to fix this issue.