NVC++-F-0000-Internal compiler error. msz_dtype, bad value 775

NVC++ goes wrong when compiling below template intensive function.
I’m using Eigen version 3.3.7.

template<typename MatType>
using PseudoInverseType = Eigen::Matrix<typename MatType::Scalar, MatType::ColsAtCompileTime, MatType::RowsAtCompileTime>;
PseudoInverseType pseudoInverse(const MatType &a, double epsilon = std::numeric_limits::epsilon())
using WorkingMatType = Eigen::Matrix<typename MatType::Scalar, Eigen::Dynamic, Eigen::Dynamic, 0,
MatType::MaxRowsAtCompileTime, MatType::MaxColsAtCompileTime>;
Eigen::BDCSVD svd(a, Eigen::ComputeThinU | Eigen::ComputeThinV);
svd.setThreshold(epsilon*std::max(a.cols(), a.rows()));
Eigen::Index rank = svd.rank();
Eigen::Matrix<typename MatType::Scalar, Eigen::Dynamic, MatType::RowsAtCompileTime,
0, Eigen::BDCSVD::MaxDiagSizeAtCompileTime, MatType::MaxRowsAtCompileTime>
tmp = svd.matrixU().leftCols(rank).adjoint();
tmp = svd.singularValues().head(rank).asDiagonal().inverse() * tmp;
return svd.matrixV().leftCols(rank) * tmp;

Here is the error message

NVC++-F-0000-Internal compiler error. msz_dtype, bad value 775 (/home/swchoi/codes/matlab_to_c++/structure-mesh-Tool-C++/src/pca_funcs.cpp: 464)
NVC++/x86-64 Linux 20.5-0: compilation aborted
CMakeFiles/test.out.dir/build.make:65: recipe for target ‘CMakeFiles/test.out.dir/src/pca_funcs.cpp.o’ failed

While this does look like a compiler issue, we’ll need a reproducing example in order to investigate it further. Can you please provide one? Also please include any relevant information needed to reproduce the error such as compiler flags or configuration options for Eigen.


Since nvc++ won’t compile Eigen at all, I unsetted “EIGEN_COMP_PGI” macro at line 99 of “Eigen/src/Core/util/Macros.h”.


/// \internal EIGEN_COMP_PGI set to 1 if the compiler is Portland Group Compiler
#if defined(__PGI)
#define EIGEN_COMP_PGI 1 <<< changed this to 0
#define EIGEN_COMP_PGI 0

I tried to compile below code with g++ and nvc++.

#include <iostream>
#include <Eigen/QR>

int main(){
Eigen::Matrix3d mat;
std::cout << mat << std::endl;
Eigen::Matrix3d pinv = mat.completeOrthogonalDecomposition().pseudoInverse();
std::cout << pinv << std::endl;
return 0;

g++ works well with the code, while nvc++ shows internal compiler error.

$g++ -I/usr/include/eigen3/ -o a.out pca_funcs.cpp
0.680375 0.59688 -0.329554
-0.211234 0.823295 0.536459
0.566198 -0.604897 -0.444451
-0.198521 2.22739 2.8357
1.00605 -0.555135 -1.41603
-1.62213 3.59308 3.28973

$/opt/nvidia/hpcsdk/Linux_x86_64/20.5/compilers/bin/nvc++ -I/usr/include/eigen3/ -o a.out pca_funcs.cpp
NVC++-F-0000-Internal compiler error. msz_dtype, bad value 767 (pca_funcs.cpp: 184)
NVC++/x86-64 Linux 20.5-0: compilation aborted

That’s what I needed. I’ve recreated the error and have added a problem report (TPR #28668).

The work around is to add back in the “#define EIGEN_COMP_PGI 1” since the code compiles fine with it enabled. As I noted in the PGI User Forum, disabling this was just to work around that particular problem and that I did not know if it would cause other issues. Though the correct path forward is to fix the problem so the work arounds are no longer needed.