GCS: Improve documentation about debug

======================================

Explicitly indicate that if parameter diagnosis must be silent=false in order to debug,
then the lauch policy during the debug must be set to deferred in order to avoid concurrent
access to Base::Console which is not thread-safe.
This commit is contained in:
Abdullah Tahiri
2020-12-24 05:10:11 +01:00
committed by abdullahtahiriyo
parent 19be9767fc
commit 5d8172e190

View File

@@ -3923,6 +3923,12 @@ SolverReportingManager::Manager().LogToFile("GCS::System::diagnose()\n");
// questions remain open:
// https://stackoverflow.com/questions/49009771/getting-rows-transpositions-with-sparse-qr
// https://forum.kde.org/viewtopic.php?f=74&t=151239
//
//
// Implementation below:
//
// Two QR decompositions are used below. One for diagnosis of constraints and a second one for diagnosis of parameters, i.e.
// to identify whether the parameter is fully constraint (independent) or not (i.e. it is dependent).
// QR decomposition method selection: SparseQR vs DenseQR
@@ -3946,9 +3952,11 @@ SolverReportingManager::Manager().LogToFile("GCS::System::diagnose()\n");
// nows if it can run the task in parallel or is oversubscribed and should deferred it.
// Care to wait() for the future before any prospective detection of conflicting/redundant, because the redundant solve
// modifies pdiagnoselist and it would NOT be thread-safe. Care to call the thread with silent=true, unless the present thread
// does not use Base::Console, as it is not thread-safe to use them in both at the same time.
// does not use Base::Console, or the lauch policy is set to std::lauch::deferred policy,, as it is not thread-safe to use them
// in both at the same time.
//
// identifyDependentParametersDenseQR(J, jacobianconstraintmap, pdiagnoselist, true)
//
auto fut = std::async(&System::identifyDependentParametersDenseQR,this,J,jacobianconstraintmap, pdiagnoselist, true);
makeDenseQRDecomposition( J, jacobianconstraintmap, qrJT, rank, R);
@@ -3999,10 +4007,14 @@ SolverReportingManager::Manager().LogToFile("GCS::System::diagnose()\n");
// nows if it can run the task in parallel or is oversubscribed and should deferred it.
// Care to wait() for the future before any prospective detection of conflicting/redundant, because the redundant solve
// modifies pdiagnoselist and it would NOT be thread-safe. Care to call the thread with silent=true, unless the present thread
// does not use Base::Console, as it is not thread-safe to use them in both at the same time.
// does not use Base::Console, or the lauch policy is set to std::lauch::deferred policy,, as it is not thread-safe to use them
// in both at the same time.
//
// identifyDependentParametersSparseQR(J, jacobianconstraintmap, pdiagnoselist, true)
auto fut = std::async(&System::identifyDependentParametersSparseQR,this,J,jacobianconstraintmap, pdiagnoselist, true);
//
// Debug:
// auto fut = std::async(std::launch::deferred,&System::identifyDependentParametersSparseQR,this,J,jacobianconstraintmap, pdiagnoselist, false);
auto fut = std::async(&System::identifyDependentParametersSparseQR,this,J,jacobianconstraintmap, pdiagnoselist, false);
makeSparseQRDecomposition( J, jacobianconstraintmap, SqrJT, rank, R);
@@ -4243,7 +4255,7 @@ void System::identifyDependentParameters( T & qrJ,
#ifdef _GCS_DEBUG
if(!silent)
SolverReportingManager::Manager().LogMatrix("Rparams", Rparams);
SolverReportingManager::Manager().LogMatrix("Rparams_nonzeros_over_pilot", Rparams);
#endif
pDependentParametersGroups.resize(qrJ.cols()-rank);
for (int j=rank; j < qrJ.cols(); j++) {