Skip to content

Commit

Permalink
debugging negative outnum
Browse files Browse the repository at this point in the history
  • Loading branch information
Brig Bagley committed Feb 27, 2016
1 parent ad6c405 commit c41f307
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 63 deletions.
7 changes: 4 additions & 3 deletions src/FEMSolver.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ FEMSolver::FEMSolver(
cycleIters_(1), // The number of CG iterations per outer iteration
dsType_(0), // Data Structure Type
topSize_(256), // the Max size of coarsest level
metisSize_(90102), // the Max size of coarsest level
randMisParameters_(90102), // the Max size of coarsest level
partitionMaxSize_(512), // the largest partition size (use getMaxThreads() to determine for your device)
aggregatorType_(1), // the Aggregator METIS (0) or MIS (1)
aggregatorType_(0), // aggregator oldMis (0), metis bottom up (1),
// metis top down (2), aggMisGPU (3), aggMisCPU (4), newMisLight (5)
convergeType_(0), // Convergence tolerance algo [ABSOLUTE_CONVERGENCE (0), RELATIVE_CONVERGENCE (1)]
tolerance_(1e-6), // the convergence tolerance
cycleType_(0), // set the cycle algorithm
Expand Down Expand Up @@ -70,7 +71,7 @@ void FEMSolver::solveFEM(Matrix_ell_h* A_h,
this->cycleIters_, this->maxIters_, this->maxLevels_,
this->topSize_, this->smootherWeight_, this->preInnerIters_,
this->postInnerIters_, this->postRelaxes_, this->dsType_,
this->metisSize_, this->partitionMaxSize_, this->proOmega_,
this->randMisParameters_, this->partitionMaxSize_, this->proOmega_,
this->aggregatorType_,
this->triMesh_, this->tetMesh_);
//setup multi grid for solver
Expand Down
5 changes: 3 additions & 2 deletions src/FEMSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ class FEMSolver {
int cycleIters_; // the number of CG iterations per outer iteration
int dsType_; // data structure type
int topSize_; // max size of coarsest level
int metisSize_; // max size of coarsest level
int randMisParameters_; // max size of coarsest level
int partitionMaxSize_; // max size of of the partition
int aggregatorType_; // aggregator metis (0) mis (1)
int aggregatorType_; // aggregator oldMis (0), metis bottom up (1),
// metis top down (2), aggMisGPU (3), aggMisCPU (4), newMisLight (5)
int convergeType_; // the convergence tolerance algorithm <absolute (0)|relative (1)>
double tolerance_; // the convergence tolerance
int cycleType_; // the cycle algorithm <V (0) | W (1) | F (2) | K (3)>
Expand Down
2 changes: 1 addition & 1 deletion src/core/aggmis/cuda/AggMIS_GraphHelpers.cu
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ namespace AggMIS {
void getPartIndicesNegStart(IntVector_d& sortedPartition,
IntVector_d& partIndices) {
// Sizing the array:
int maxPart = sortedPartition[sortedPartition.size() - 1];
int maxPart = max(0,sortedPartition[sortedPartition.size() - 1]);
partIndices.resize(maxPart + 2, 0);

// Figuring out block sizes for kernel call:
Expand Down
1 change: 1 addition & 0 deletions src/core/cuda/ComputePermutationMethods.cu
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ namespace misHelpers {
int fineSize, coarseSize;
coarseSize = part_max_size % 1000;
fineSize = (part_max_size / 1000) % 1000;
fineSize = fineSize <= 0 ? 1 : fineSize;


// Getting the fine aggregation with Metis
Expand Down
8 changes: 4 additions & 4 deletions src/core/cuda/aggregator.cu
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
template <class Matrix, class Vector>
Aggregator<Matrix, Vector>* Aggregator<Matrix, Vector>::allocate(int type)
{
if (type == 0)
return new MIS_Aggregator < Matrix, Vector > ;
else
return new RandMIS_Aggregator < Matrix, Vector > ;
//if (type == 0)
// return new MIS_Aggregator < Matrix, Vector > ;
//else
return new RandMIS_Aggregator < Matrix, Vector > ;
}

/****************************************
Expand Down
4 changes: 2 additions & 2 deletions src/core/cuda/amg.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AMG<Matrix, Vector>::AMG(bool verbose, int convergeType, int cycleType,
int solverType, double tolerance, int cycleIters, int maxIters,
int maxLevels, int topSize, double smootherWeight,
int preInnerIters, int postInnerIters, int postRelaxes,
int dsType, int metisSize, int partitionMaxSize, double proOmega,
int dsType, int randMisParameters, int partitionMaxSize, double proOmega,
int aggregatorType, TriMesh* triMesh, TetMesh* tetMesh) :
fine(0), verbose_(verbose),
convergeType_(convergeType == 0 ? ABSOLUTE_CONVERGENCE : RELATIVE_CONVERGENCE),
Expand All @@ -24,7 +24,7 @@ AMG<Matrix, Vector>::AMG(bool verbose, int convergeType, int cycleType,
maxIters_(maxIters), maxLevels_(maxLevels), topSize_(topSize),
smootherWeight_(smootherWeight), preInnerIters_(preInnerIters),
postInnerIters_(postInnerIters), postRelaxes_(postRelaxes),
dsType_(dsType), metisSize_(metisSize), partitionMaxSize_(partitionMaxSize),
dsType_(dsType), randMisParameters_(randMisParameters), partitionMaxSize_(partitionMaxSize),
proOmega_(proOmega), aggregatorType_(aggregatorType),
triMesh_(triMesh), tetMesh_(tetMesh) {
switch (cycleType) {
Expand Down
16 changes: 13 additions & 3 deletions src/core/cuda/mis.cu
Original file line number Diff line number Diff line change
Expand Up @@ -565,17 +565,27 @@ void MIS_Aggregator<Matrix, Vector>::aggregateGraphMIS(int n, int *adjIndexes, i
}

template <class Matrix, class Vector>
void MIS_Aggregator<Matrix, Vector>::computePermutation_d(IdxVector_d &adjIndexesIn, IdxVector_d &adjacencyIn, IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionLabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int parameters, int part_max_size, bool verbose)
void MIS_Aggregator<Matrix, Vector>::computePermutation_d(IdxVector_d &adjIndexesIn,
IdxVector_d &adjacencyIn, IdxVector_d &permutation, IdxVector_d &ipermutation,
IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionLabel,
IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int aggregation_type,
int parameters, int part_max_size, bool verbose)
{
}

template <class Matrix, class Vector>
void MIS_Aggregator<Matrix, Vector>::computePermutation_d(TriMesh *meshPtr, IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionLabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int parameters, int part_max_size, bool verbose)
void MIS_Aggregator<Matrix, Vector>::computePermutation_d(TriMesh *meshPtr,
IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx,
IdxVector_d &partitionIdx, IdxVector_d &partitionLabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut,
int aggregation_type, int parameters, int part_max_size, bool verbose)
{
}

template <class Matrix, class Vector>
void MIS_Aggregator<Matrix, Vector>::computePermutation_d(TetMesh *meshPtr, IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionLabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int parameters, int part_max_size, bool verbose)
void MIS_Aggregator<Matrix, Vector>::computePermutation_d(TetMesh *meshPtr,
IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx,
IdxVector_d &partitionIdx, IdxVector_d &partitionLabel, IdxVector_d &adjIndexesOut,
IdxVector_d &adjacencyOut, int aggregation_type, int parameters, int part_max_size, bool verbose)
{
}

Expand Down
34 changes: 17 additions & 17 deletions src/core/cuda/randMIS.cu
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,11 @@ void RandMIS_Aggregator<Matrix, Vector>::computePermutation_d(IdxVector_d &adjIn
IdxVector_d &partitionLabel,
IdxVector_d &adjIndexesOut,
IdxVector_d &adjacencyOut,
int agg_type,
int parameters,
int part_max_size,
bool verbose) {
int AggregatorMethod = (parameters / 100000000); // The type of Aggregation method to use (0 = MIS unprocessed)
if (AggregatorMethod == 0)
if (agg_type == 0)
{
if (verbose)
printf("Calling Old MIS Aggregation method.\n");
Expand All @@ -458,10 +458,10 @@ void RandMIS_Aggregator<Matrix, Vector>::computePermutation_d(IdxVector_d &adjIn
part_max_size,
verbose);
}
else if (AggregatorMethod == 1)
else if (agg_type == 1)
{
if (verbose)
printf("Calling Metis bottom up method");
printf("Calling Metis bottom up method\n");
misHelpers::CP::MetisBottomUp(adjIndexesIn,
adjacencyIn,
permutation,
Expand All @@ -475,10 +475,10 @@ void RandMIS_Aggregator<Matrix, Vector>::computePermutation_d(IdxVector_d &adjIn
part_max_size,
verbose);
}
else if (AggregatorMethod == 2)
else if (agg_type == 2)
{
if (verbose)
printf("Calling Metis top down method");
printf("Calling Metis top down method\n");
misHelpers::CP::MetisTopDown(adjIndexesIn,
adjacencyIn,
permutation,
Expand All @@ -492,10 +492,10 @@ void RandMIS_Aggregator<Matrix, Vector>::computePermutation_d(IdxVector_d &adjIn
part_max_size,
verbose);
}
else if (AggregatorMethod == 3)
else if (agg_type == 3)
{
if (verbose)
printf("Calling AggMIS GPU method");
printf("Calling AggMIS GPU method\n");
misHelpers::CP::NewMIS(adjIndexesIn,
adjacencyIn,
permutation,
Expand All @@ -509,10 +509,10 @@ void RandMIS_Aggregator<Matrix, Vector>::computePermutation_d(IdxVector_d &adjIn
part_max_size,
verbose);
}
else if (AggregatorMethod == 4)
else if (agg_type == 4)
{
if (verbose)
printf("Calling AggMIS CPU method");
printf("Calling AggMIS CPU method\n");
misHelpers::CP::NewMIS_CPU(adjIndexesIn,
adjacencyIn,
permutation,
Expand All @@ -526,10 +526,10 @@ void RandMIS_Aggregator<Matrix, Vector>::computePermutation_d(IdxVector_d &adjIn
part_max_size,
verbose);
}
else if (AggregatorMethod == 5)
else if (agg_type == 5)
{
if (verbose)
printf("Calling AggMIS Light CPU method");
printf("Calling AggMIS Light CPU method\n");
misHelpers::CP::LightMIS_CPU(adjIndexesIn,
adjacencyIn,
permutation,
Expand All @@ -544,7 +544,7 @@ void RandMIS_Aggregator<Matrix, Vector>::computePermutation_d(IdxVector_d &adjIn
verbose);
}
else if (verbose)
printf("Aggregation method %d not recognized!\n", AggregatorMethod);
printf("Aggregation method %d not recognized!\n", agg_type);

if (verbose)
std::cout << "Finished with RandMIS_Aggregator::computePermutation_d" << std::endl;
Expand All @@ -554,26 +554,26 @@ template <class Matrix, class Vector>
void RandMIS_Aggregator<Matrix, Vector>::computePermutation_d(TriMesh *meshPtr,
IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx,
IdxVector_d &partitionIdx, IdxVector_d &partitionLabel, IdxVector_d &adjIndexesOut,
IdxVector_d &adjacencyOut, int parameters, int part_max_size, bool verbose)
IdxVector_d &adjacencyOut, int aggregation_type, int parameters, int part_max_size, bool verbose)
{
IdxVector_d adjIndexesIn, adjacencyIn;
misHelpers::getAdjacency(meshPtr, adjIndexesIn, adjacencyIn);
computePermutation_d(adjIndexesIn, adjacencyIn, permutation, ipermutation,
aggregateIdx, partitionIdx, partitionLabel, adjIndexesOut,
adjacencyOut, parameters, part_max_size, verbose);
adjacencyOut, aggregation_type, parameters, part_max_size, verbose);
}

template <class Matrix, class Vector>
void RandMIS_Aggregator<Matrix, Vector>::computePermutation_d(TetMesh *meshPtr,
IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx,
IdxVector_d &partitionIdx, IdxVector_d &partitionLabel, IdxVector_d &adjIndexesOut,
IdxVector_d &adjacencyOut, int parameters, int part_max_size, bool verbose)
IdxVector_d &adjacencyOut, int aggregation_type, int parameters, int part_max_size, bool verbose)
{
IdxVector_d adjIndexesIn, adjacencyIn;
misHelpers::getAdjacency(meshPtr, adjIndexesIn, adjacencyIn);
computePermutation_d(adjIndexesIn, adjacencyIn, permutation, ipermutation,
aggregateIdx, partitionIdx, partitionLabel, adjIndexesOut, adjacencyOut,
parameters, part_max_size, verbose);
aggregation_type, parameters, part_max_size, verbose);
}

template <class Matrix, class Vector>
Expand Down
7 changes: 4 additions & 3 deletions src/core/cuda/smoothedMG_amg_level.cu
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ void SmoothedMG_AMG_Level<Matrix_h, Vector_h>::createNextLevel(bool verbose)
std::cout << "calling computePermutation_d with tri mesh." << std::endl;
aggregator->computePermutation_d(this->m_meshPtr, permutation_d, ipermutation_d,
aggregateIdx_d, partitionIdx_d, partitionlabel_d, m_xadjout_d, m_adjncyout_d,
this->amg->metisSize_, this->amg->partitionMaxSize_, verbose);// DHL
this->amg->aggregatorType_, this->amg->randMisParameters_,
this->amg->partitionMaxSize_, verbose);// DHL
if (verbose)
std::cout << "computePermutation_d called with tri mesh." << std::endl;
}
Expand All @@ -417,7 +418,7 @@ void SmoothedMG_AMG_Level<Matrix_h, Vector_h>::createNextLevel(bool verbose)
std::cout << "calling computePermutation_d with tet mesh." << std::endl;
aggregator->computePermutation_d(this->m_tetmeshPtr, permutation_d,
ipermutation_d, aggregateIdx_d, partitionIdx_d, partitionlabel_d,
m_xadjout_d, m_adjncyout_d, this->amg->metisSize_,
m_xadjout_d, m_adjncyout_d, this->amg->aggregatorType_, this->amg->randMisParameters_,
this->amg->partitionMaxSize_, verbose); // DHL
if (verbose)
std::cout << "computePermutation_d called with tet mesh." << std::endl;
Expand All @@ -429,7 +430,7 @@ void SmoothedMG_AMG_Level<Matrix_h, Vector_h>::createNextLevel(bool verbose)
std::cout << "calling computePermutation_d with level_id != 0." << std::endl;
aggregator->computePermutation_d(m_xadj_d, m_adjncy_d, permutation_d,
ipermutation_d, aggregateIdx_d, partitionIdx_d, partitionlabel_d,
m_xadjout_d, m_adjncyout_d, this->amg->metisSize_,
m_xadjout_d, m_adjncyout_d, this->amg->aggregatorType_, this->amg->randMisParameters_,
this->amg->partitionMaxSize_, verbose); // DHL
if (verbose)
std::cout << "computePermutation_d called with level_id != 0." << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions src/core/include/amg.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AMG
int solverType, double tolerance, int cycleIters, int maxIters,
int maxLevels, int topSize, double smootherWeight,
int preInnerIters, int postInnerIters, int postRelaxes,
int dsType, int metisSize, int partitionMaxSize, double proOmega,
int dsType, int randMisParameters, int partitionMaxSize, double proOmega,
int aggregatorType, TriMesh* triMesh, TetMesh* tetMesh);
~AMG();

Expand Down Expand Up @@ -60,7 +60,7 @@ class AMG
int postInnerIters_; // the post inner iterations for GSINNER
int postRelaxes_; // the number of post relax iterations
int dsType_;
int metisSize_;
int randMisParameters_;
int partitionMaxSize_;
double proOmega_;
int aggregatorType_;
Expand Down
6 changes: 3 additions & 3 deletions src/core/include/smoothedMG/aggregators/aggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class Aggregator
virtual void computePermutation(TriMesh* meshPtr, IdxVector_h &permutation, IdxVector_h &ipermutation, IdxVector_h &aggregateIdx, IdxVector_h &partitionIdx, int* partitonlabel, int* nnout, int* &xadjout, int* &adjncyout, int metissize) = 0;
virtual void computePermutation(TetMesh* meshPtr, IdxVector_h &permutation, IdxVector_h &ipermutation, IdxVector_h &aggregateIdx, IdxVector_h &partitionIdx, int* partitonlabel, int* nnout, int* &xadjout, int* &adjncyout, int metissize) = 0;
virtual void computePermutation(int nn, int* xadj, int* adjncy, IdxVector_h &permutation, IdxVector_h &ipermutation, IdxVector_h &aggregateIdx, IdxVector_h &partitionIdx, int* partitionlabel, int* nnout, int* &xadjout, int* &adjncyout, int metissize) = 0;
virtual void computePermutation_d(IdxVector_d &adjIndexesIn, IdxVector_d &adjacencyIn, IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionlabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int parameters, int part_max_size, bool verbose = false) = 0;
virtual void computePermutation_d(TriMesh* meshPtr, IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionlabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int parameters, int part_max_size, bool verbose = false) = 0;
virtual void computePermutation_d(TetMesh* meshPtr, IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionlabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int parameters, int part_max_size, bool verbose = false) = 0;
virtual void computePermutation_d(IdxVector_d &adjIndexesIn, IdxVector_d &adjacencyIn, IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionlabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int aggregation_type, int parameters, int part_max_size, bool verbose = false) = 0;
virtual void computePermutation_d(TriMesh* meshPtr, IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionlabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int aggregation_type, int parameters, int part_max_size, bool verbose = false) = 0;
virtual void computePermutation_d(TetMesh* meshPtr, IdxVector_d &permutation, IdxVector_d &ipermutation, IdxVector_d &aggregateIdx, IdxVector_d &partitionIdx, IdxVector_d &partitionlabel, IdxVector_d &adjIndexesOut, IdxVector_d &adjacencyOut, int aggregation_type, int parameters, int part_max_size, bool verbose = false) = 0;

virtual ~Aggregator()
{
Expand Down
Loading

0 comments on commit c41f307

Please sign in to comment.