Skip to content

Commit

Permalink
Fix data grid dimensioning bug
Browse files Browse the repository at this point in the history
Correction d'un bug de dimensionnement detecte sur LearningTest\TestKhiops\BugsMultiTables\BugDeployedCoclustering
- le deploiement d'un petit coclustering demande etonamment beaucoup trop de RAM
- modification du jeu de test avec MemoryLimit a 500 Mb pour detecter ce probleme plus tot
- correction
  - affichage du dimensionnement selon GetPreparationTraceMode dans PLST|MTDatabaseTextFile::ComputeOpenInformation
  - KWDGAttribute::GetUsedMemory: pour tenir compte des valeurs Symbol ou VarPart
  - KWDGValueSet::GetUsedMemory: prise en compte uniquement du sizeoff de la classe, pas des valeurs

Test complets valides sur LearningTest
  • Loading branch information
marcboulle committed Oct 10, 2023
1 parent 58a4a75 commit 0ba8a7e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
16 changes: 3 additions & 13 deletions src/Learning/KWDataPreparation/KWDataGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3141,8 +3141,8 @@ longint KWDGAttribute::GetUsedMemory() const
// Prise en compte des parties et des valeurs
if (headPart != NULL)
lUsedMemory *= nPartNumber * headPart->GetUsedMemory();
if (GetAttributeType() == KWType::Symbol)
lUsedMemory += nGranularizedValueNumber * sizeof(KWDGValue);
if (KWType::IsCoclusteringGroupableType(GetAttributeType()))
lUsedMemory += nGranularizedValueNumber * headPart->GetValueSet()->GetHeadValue()->GetUsedMemory();

// Prise en compte de la structure d'indexation
lUsedMemory += oaIntervals.GetUsedMemory();
Expand Down Expand Up @@ -4448,17 +4448,7 @@ void KWDGValueSet::WriteValues(ostream& ost) const

longint KWDGValueSet::GetUsedMemory() const
{
longint lUsedMemory;
KWDGValue* value;

lUsedMemory = sizeof(KWDGValueSet);
value = GetHeadValue();
while (value != NULL)
{
lUsedMemory += value->GetUsedMemory();
GetNextValue(value);
}
return lUsedMemory;
return sizeof(KWDGValueSet);
}

const ALString KWDGValueSet::GetClassLabel() const
Expand Down
4 changes: 2 additions & 2 deletions src/Learning/KWDataPreparation/KWDataGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ class KWDGPart : public Object
// Controle d'integrite local a la partie (valeurs, cellules de la partie)
boolean Check() const override;

// Memoire utilisee
// Memoire utilisee par la partie
longint GetUsedMemory() const override;

// Affichage
Expand Down Expand Up @@ -926,7 +926,7 @@ class KWDGPartValues : public Object
// Affichage
void Write(ostream& ost) const override = 0;

// Memoire utilisee
// Memoire utilisee par la partie, sans ses valeurs
longint GetUsedMemory() const override = 0;
};

Expand Down
10 changes: 5 additions & 5 deletions src/Learning/KWDataUtils/KWDatabaseSlicerTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ longint KWDatabaseSlicerTask::GetMinOutputNecessaryMemory()
lNecessaryMemorySpace = GetEmptyOutputNecessaryMemory();

// On rajoute au minimum 64 KB par tranche plus deux tailles de buffer pour la tranche courante
lNecessaryMemorySpace += 2 * BufferedFile::nDefaultBufferSize +
shared_DataTableSliceSet.GetDataTableSliceSet()->GetSliceNumber() * 64 * lKB;
lNecessaryMemorySpace += 2 * (longint)BufferedFile::nDefaultBufferSize +
(longint)shared_DataTableSliceSet.GetDataTableSliceSet()->GetSliceNumber() * 64 * lKB;
return lNecessaryMemorySpace;
}

Expand All @@ -202,9 +202,9 @@ longint KWDatabaseSlicerTask::GetMaxOutputNecessaryMemory()

// On rajoute au maximum une taille de buffer standard par tranche plus deux tailles de buffer pour la tranche
// courante
lNecessaryMemorySpace +=
2 * BufferedFile::nDefaultBufferSize + shared_DataTableSliceSet.GetDataTableSliceSet()->GetSliceNumber() *
longint(BufferedFile::nDefaultBufferSize);
lNecessaryMemorySpace += 2 * (longint)BufferedFile::nDefaultBufferSize +
shared_DataTableSliceSet.GetDataTableSliceSet()->GetSliceNumber() *
longint(BufferedFile::nDefaultBufferSize);
return lNecessaryMemorySpace;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Learning/KWDataUtils/PLMTDatabaseTextFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ boolean PLMTDatabaseTextFile::ComputeOpenInformation(boolean bRead, boolean bInc
PLMTDatabaseTextFile* outputDatabaseTextFile)
{
boolean bOk = true;
boolean bDisplay = false;
boolean bDisplay = GetPreparationTraceMode();
boolean bCurrentVerboseMode;
KWMTDatabaseMapping* mapping;
KWMTDatabaseMapping* outputMapping;
Expand Down
2 changes: 1 addition & 1 deletion src/Learning/KWDataUtils/PLSTDatabaseTextFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ boolean PLSTDatabaseTextFile::ComputeOpenInformation(boolean bRead, boolean bInc
PLSTDatabaseTextFile* outputDatabaseTextFile)
{
boolean bOk = true;
boolean bDisplay = false;
boolean bDisplay = GetPreparationTraceMode();
boolean bCurrentVerboseMode;
KWClass* kwcUsedHeaderLineClass;
longint lDatabaseClassNecessaryMemory;
Expand Down
1 change: 1 addition & 0 deletions src/Learning/MODL/MODL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ int main(int argc, char** argv)

// Choix du repertoire de lancement pour le debugage sous Windows (a commenter apres fin du debug)
// SetWindowsDebugDir("Standard", "IrisLight");
SetWindowsDebugDir("BugsMultiTables", "BugDeployedCoclustering");

// Parametrage des logs memoires depuis les variables d'environnement, pris en compte dans KWLearningProject
// KhiopsMemStatsLogFileName, KhiopsMemStatsLogFrequency, KhiopsMemStatsLogToCollect
Expand Down

0 comments on commit 0ba8a7e

Please sign in to comment.