diff --git a/internal/ceres/coordinate_descent_minimizer.cc b/internal/ceres/coordinate_descent_minimizer.cc index c6b42cf15..83e0bd535 100644 --- a/internal/ceres/coordinate_descent_minimizer.cc +++ b/internal/ceres/coordinate_descent_minimizer.cc @@ -168,9 +168,9 @@ void CoordinateDescentMinimizer::Minimize( j < independent_set_offsets_[i + 1]; ++j) { #ifdef CERES_USE_OPENMP - int thread_id = omp_get_thread_num(); + const int thread_id = omp_get_thread_num(); #else - int thread_id = 0; + const int thread_id = 0; #endif ParameterBlock* parameter_block = parameter_blocks_[j]; diff --git a/internal/ceres/covariance_impl.cc b/internal/ceres/covariance_impl.cc index 1f594c101..c16e477d0 100644 --- a/internal/ceres/covariance_impl.cc +++ b/internal/ceres/covariance_impl.cc @@ -356,9 +356,9 @@ bool CovarianceImpl::GetCovarianceMatrixInTangentOrAmbientSpace( int size_i = parameter_sizes[i]; int size_j = parameter_sizes[j]; #ifdef CERES_USE_OPENMP - int thread_id = omp_get_thread_num(); + const int thread_id = omp_get_thread_num(); #else - int thread_id = 0; + const int thread_id = 0; #endif double* covariance_block = workspace.get() + @@ -705,9 +705,9 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingSuiteSparseQR() { } # ifdef CERES_USE_OPENMP - int thread_id = omp_get_thread_num(); + const int thread_id = omp_get_thread_num(); # else - int thread_id = 0; + const int thread_id = 0; # endif double* solution = workspace.get() + thread_id * num_cols; @@ -897,9 +897,9 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingEigenSparseQR() { } # ifdef CERES_USE_OPENMP - int thread_id = omp_get_thread_num(); + const int thread_id = omp_get_thread_num(); # else - int thread_id = 0; + const int thread_id = 0; # endif double* solution = workspace.get() + thread_id * num_cols; diff --git a/internal/ceres/program_evaluator.h b/internal/ceres/program_evaluator.h index 74a812ade..597ff1823 100644 --- a/internal/ceres/program_evaluator.h +++ b/internal/ceres/program_evaluator.h @@ -183,9 +183,9 @@ class ProgramEvaluator : public Evaluator { } #ifdef CERES_USE_OPENMP - int thread_id = omp_get_thread_num(); + const int thread_id = omp_get_thread_num(); #else - int thread_id = 0; + const int thread_id = 0; #endif EvaluatePreparer* preparer = &evaluate_preparers_[thread_id]; EvaluateScratch* scratch = &evaluate_scratch_[thread_id]; diff --git a/internal/ceres/schur_eliminator_impl.h b/internal/ceres/schur_eliminator_impl.h index 7ee419e72..5091b93f2 100644 --- a/internal/ceres/schur_eliminator_impl.h +++ b/internal/ceres/schur_eliminator_impl.h @@ -224,9 +224,9 @@ Eliminate(const BlockSparseMatrix* A, #pragma omp parallel for num_threads(num_threads_) schedule(dynamic) for (int i = 0; i < chunks_.size(); ++i) { #ifdef CERES_USE_OPENMP - int thread_id = omp_get_thread_num(); + const int thread_id = omp_get_thread_num(); #else - int thread_id = 0; + const int thread_id = 0; #endif double* buffer = buffer_.get() + thread_id * buffer_size_; const Chunk& chunk = chunks_[i]; @@ -509,9 +509,9 @@ ChunkOuterProduct(const CompressedRowBlockStructure* bs, BufferLayoutType::const_iterator it1 = buffer_layout.begin(); #ifdef CERES_USE_OPENMP - int thread_id = omp_get_thread_num(); + const int thread_id = omp_get_thread_num(); #else - int thread_id = 0; + const int thread_id = 0; #endif double* b1_transpose_inverse_ete = chunk_outer_product_buffer_.get() + thread_id * buffer_size_;