Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force gcc optimization to O1 in KWDGPODiscretizer #238

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pack-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
khiops -v
khiops_coclustering -v
- name: Test Khiops installation
continue-on-error: ${{ matrix.os == 'debian:11' || matrix.os == 'debian:12' }}
continue-on-error: ${{ matrix.os == 'debian:11' }}
uses: ./.github/actions/test-khiops-install
test-kni:
needs: build
Expand Down
34 changes: 34 additions & 0 deletions src/Learning/KWDataPreparation/KWDataGridPostOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,19 @@ void KWDGPODiscretizer::InitializeCellFrequencyVector(KWDGPOCellFrequencyVector*
// Index de l'attribut a post-optimiser (et donc a ignorer pour le calcul de la signature exogene
static int nKWDGPODiscretizerPostOptimizationAttributeIndex = -1;

// Bug detecte sur debian 12 avec la version 12.2.0 de gcc. Ce bug apparait en release mais pas en debug.
// On force la compilation en O1 car il doit y avoir une sur-optimisation de gcc en mode 02 :
// il y a un segmentation fault, gdb indique que cell1 est a NULL.
// En ajoutant la ligne suivante (inutile) apres les cast, le bug disparait
// if (cell1==NULL or cell2==NULL) exit(1);
// Bug similaire dans KWSortableIndex.h, classe KWIntVectorSorter
#if defined NDEBUG && defined __GNUC__ && !defined __clang__
#if __GNUC__ >= 12
#pragma GCC push_options
#pragma GCC optimize("O1")
#endif
#endif

// Fonction de comparaison de deux cellules basee sur leur signature exogene
int KWDGPODiscretizerCompareCell(const void* elem1, const void* elem2)
{
Expand Down Expand Up @@ -596,6 +609,12 @@ int KWDGPODiscretizerCompareCell(const void* elem1, const void* elem2)
return 0;
}

#if defined NDEBUG && defined __GNUC__ && !defined __clang__
#if __GNUC__ >= 12
#pragma GCC pop_options
#endif
#endif

void KWDGPODiscretizer::InitializeHashCellDictionary(NumericKeyDictionary* nkdHashCells,
const KWDataGrid* dataGrid) const
{
Expand Down Expand Up @@ -1495,6 +1514,15 @@ void KWDGPOGrouper::InitializeCellFrequencyVector(KWDGPOCellFrequencyVector* cel
// Index de l'attribut a post-optimiser (et donc a ignorer pour le calcul de la signature exogene
static int nKWDGPOGrouperPostOptimizationAttributeIndex = -1;

// On force l'optimisation en O1 car il y a un probleme avec gcc v12
// Cf. pbm similaire pour la methode KWDGPODiscretizerCompareCell
#if defined NDEBUG && defined __GNUC__ && !defined __clang__
#if __GNUC__ >= 12
#pragma GCC push_options
#pragma GCC optimize("O1")
#endif
#endif

// Fonction de comparaison de deux cellules basee sur leur signature exogene
int KWDGPOGrouperCompareCell(const void* elem1, const void* elem2)
{
Expand Down Expand Up @@ -1531,6 +1559,12 @@ int KWDGPOGrouperCompareCell(const void* elem1, const void* elem2)
return 0;
}

#if defined NDEBUG && defined __GNUC__ && !defined __clang__
#if __GNUC__ >= 12
#pragma GCC pop_options
#endif
#endif

void KWDGPOGrouper::InitializeHashCellDictionary(NumericKeyDictionary* nkdHashCells, const KWDataGrid* dataGrid) const
{
ObjectArray oaDataGridCells;
Expand Down
Loading