From 150704eb56c0840714094aedaf4b378c25c4bdbf Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 6 Jul 2021 11:08:49 -0500 Subject: [PATCH] Make lm_optimizer.h compile without cuda if desired. --- libvis/src/libvis/lm_optimizer.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libvis/src/libvis/lm_optimizer.h b/libvis/src/libvis/lm_optimizer.h index a310690..1b099ff 100644 --- a/libvis/src/libvis/lm_optimizer.h +++ b/libvis/src/libvis/lm_optimizer.h @@ -31,10 +31,12 @@ #include +#ifdef LIBVIS_HAVE_CUDA // Only required for optional matrix multiplication on the GPU: #include #include #include +#endif #include @@ -1322,9 +1324,12 @@ class LMOptimizer { Matrix B_T_D_inv_B; B_T_D_inv_B.resize(m_dense_H.rows(), m_dense_H.cols()); +#ifdef LIBVIS_HAVE_CUDA if (m_compute_schur_complement_with_cuda) { MultiplyMatricesWithCuBLAS(D_inv_B, &B_T_D_inv_B); - } else { + } else +#endif // LIBVIS_HAVE_CUDA + { B_T_D_inv_B.template triangularView() = m_off_diag_H.transpose() * D_inv_B; } @@ -1368,6 +1373,7 @@ class LMOptimizer { } } +#ifdef LIBVIS_HAVE_CUDA void MultiplyMatricesWithCuBLAS( const Matrix& D_inv_B, Matrix* B_T_D_inv_B) { @@ -1428,6 +1434,7 @@ class LMOptimizer { *B_T_D_inv_B = result.cast(); } } +#endif // LIBVIS_HAVE_CUDA // void SolveWithCuSolver( // int dense_degrees_of_freedom,