mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
work around scotch fpe bug
This commit is contained in:
@ -55,7 +55,17 @@ metisCoeffs
|
|||||||
}
|
}
|
||||||
|
|
||||||
scotchCoeffs
|
scotchCoeffs
|
||||||
{}
|
{
|
||||||
|
//processorWeights
|
||||||
|
//(
|
||||||
|
// 1
|
||||||
|
// 1
|
||||||
|
// 1
|
||||||
|
// 1
|
||||||
|
//);
|
||||||
|
//writeGraph true;
|
||||||
|
//strategy "b";
|
||||||
|
}
|
||||||
|
|
||||||
manualCoeffs
|
manualCoeffs
|
||||||
{
|
{
|
||||||
|
|||||||
@ -75,6 +75,24 @@ extern "C"
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Hack: scotch generates floating point errors so need to switch of error
|
||||||
|
// trapping!
|
||||||
|
#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64)
|
||||||
|
# define LINUX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LINUX) && defined(__GNUC__)
|
||||||
|
# define LINUX_GNUC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LINUX_GNUC
|
||||||
|
# ifndef __USE_GNU
|
||||||
|
# define __USE_GNU
|
||||||
|
# endif
|
||||||
|
# include <fenv.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -113,13 +131,30 @@ Foam::label Foam::scotchDecomp::decompose
|
|||||||
{
|
{
|
||||||
// Strategy
|
// Strategy
|
||||||
// ~~~~~~~~
|
// ~~~~~~~~
|
||||||
|
|
||||||
// Default.
|
// Default.
|
||||||
SCOTCH_Strat stradat;
|
SCOTCH_Strat stradat;
|
||||||
check(SCOTCH_stratInit(&stradat), "SCOTCH_stratInit");
|
check(SCOTCH_stratInit(&stradat), "SCOTCH_stratInit");
|
||||||
//SCOTCH_stratGraphMap(&stradat, &argv[i][2]);
|
|
||||||
//fprintf(stdout, "S\tStrat=");
|
if (decompositionDict_.found("scotchCoeffs"))
|
||||||
//SCOTCH_stratSave(&stradat, stdout);
|
{
|
||||||
//fprintf(stdout, "\n");
|
const dictionary& scotchCoeffs =
|
||||||
|
decompositionDict_.subDict("scotchCoeffs");
|
||||||
|
|
||||||
|
|
||||||
|
string strategy;
|
||||||
|
if (scotchCoeffs.readIfPresent("strategy", strategy))
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "scotchDecomp : Using strategy " << strategy << endl;
|
||||||
|
}
|
||||||
|
SCOTCH_stratGraphMap(&stradat, strategy.c_str());
|
||||||
|
//fprintf(stdout, "S\tStrat=");
|
||||||
|
//SCOTCH_stratSave(&stradat, stdout);
|
||||||
|
//fprintf(stdout, "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Graph
|
// Graph
|
||||||
@ -198,12 +233,36 @@ Foam::label Foam::scotchDecomp::decompose
|
|||||||
|
|
||||||
SCOTCH_Arch archdat;
|
SCOTCH_Arch archdat;
|
||||||
check(SCOTCH_archInit(&archdat), "SCOTCH_archInit");
|
check(SCOTCH_archInit(&archdat), "SCOTCH_archInit");
|
||||||
check
|
|
||||||
(
|
List<label> processorWeights;
|
||||||
// SCOTCH_archCmpltw for weighted.
|
if (decompositionDict_.found("scotchCoeffs"))
|
||||||
SCOTCH_archCmplt(&archdat, nProcessors_),
|
{
|
||||||
"SCOTCH_archCmplt"
|
const dictionary& scotchCoeffs =
|
||||||
);
|
decompositionDict_.subDict("scotchCoeffs");
|
||||||
|
|
||||||
|
scotchCoeffs.readIfPresent("processorWeights", processorWeights);
|
||||||
|
}
|
||||||
|
if (processorWeights.size())
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "scotchDecomp : Using procesor weights " << processorWeights
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
check
|
||||||
|
(
|
||||||
|
SCOTCH_archCmpltw(&archdat, nProcessors_, processorWeights.begin()),
|
||||||
|
"SCOTCH_archCmpltw"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
check
|
||||||
|
(
|
||||||
|
SCOTCH_archCmplt(&archdat, nProcessors_),
|
||||||
|
"SCOTCH_archCmplt"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//SCOTCH_Mapping mapdat;
|
//SCOTCH_Mapping mapdat;
|
||||||
@ -212,6 +271,16 @@ Foam::label Foam::scotchDecomp::decompose
|
|||||||
//SCOTCH_graphMapExit(&grafdat, &mapdat);
|
//SCOTCH_graphMapExit(&grafdat, &mapdat);
|
||||||
|
|
||||||
|
|
||||||
|
// Hack:switch off fpu error trapping
|
||||||
|
# ifdef LINUX_GNUC
|
||||||
|
int oldExcepts = fedisableexcept
|
||||||
|
(
|
||||||
|
FE_DIVBYZERO
|
||||||
|
| FE_INVALID
|
||||||
|
| FE_OVERFLOW
|
||||||
|
);
|
||||||
|
# endif
|
||||||
|
|
||||||
finalDecomp.setSize(xadj.size()-1);
|
finalDecomp.setSize(xadj.size()-1);
|
||||||
finalDecomp = 0;
|
finalDecomp = 0;
|
||||||
check
|
check
|
||||||
@ -226,6 +295,11 @@ Foam::label Foam::scotchDecomp::decompose
|
|||||||
"SCOTCH_graphMap"
|
"SCOTCH_graphMap"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# ifdef LINUX_GNUC
|
||||||
|
feenableexcept(oldExcepts);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//finalDecomp.setSize(xadj.size()-1);
|
//finalDecomp.setSize(xadj.size()-1);
|
||||||
//check
|
//check
|
||||||
|
|||||||
Reference in New Issue
Block a user