Skip to content

Commit

Permalink
drop: current progress
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewreisner committed Aug 13, 2024
1 parent 7b16ebf commit eb03a7c
Show file tree
Hide file tree
Showing 6 changed files with 560 additions and 486 deletions.
6 changes: 3 additions & 3 deletions raptor/external/hypre_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ raptor::ParBSRMatrix* convert(hypre_ParCSRMatrix* A_hypre,
}
}
// add blocks to A
for (auto & blk : bmap) {
bcolind.emplace_back(blk.first);
bvalues.emplace_back(blk.second);
for (auto [colind, val] : bmap) {
bcolind.emplace_back(colind);
bvalues.emplace_back(val);
}
browptr[block_index + 1] = browptr[block_index] + bmap.size();
}
Expand Down
6 changes: 3 additions & 3 deletions raptor/multilevel/par_multilevel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ namespace raptor
}

// Add coarse levels to hierarchy
while (levels[last_level]->A->global_num_rows > max_coarse &&
(max_levels == -1 || (int) levels.size() < max_levels))
while ((max_levels == -1 || (int) levels.size() < max_levels) &&
levels[last_level]->A->global_num_rows > max_coarse)
{
extend_hierarchy();

Expand All @@ -190,7 +190,7 @@ namespace raptor

// Duplicate coarsest level across all processes that hold any
// rows of A_c
duplicate_coarse();
// duplicate_coarse();

if (track_times)
{
Expand Down
19 changes: 9 additions & 10 deletions raptor/par_strength.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,11 @@ void norm_strength(ParCSRMatrix & A, ParCSRMatrix & S,
auto row_end_off = A.off_proc->idx1[i+1];
if (row_end_on - row_start_on || row_end_off - row_start_off)
{
double diag;
if (A.on_proc->idx2[row_start_on] == i)
{
diag = A.on_proc->vals[row_start_on];
bool has_zero_diag = true;
if (A.on_proc->idx2[row_start_on] == i) {
row_start_on++;
}
else
{
diag = 0.0;
}
has_zero_diag = false;
}

auto row_var = (num_variables > 1) ? variables[i] : -1;
// Find value with max magnitude in row
Expand All @@ -245,7 +240,11 @@ void norm_strength(ParCSRMatrix & A, ParCSRMatrix & S,

// Always add diagonal
S.on_proc->idx2[S.on_proc->nnz] = i;
S.on_proc->vals[S.on_proc->nnz] = diag;
if constexpr (is_bsr)
S.on_proc->vals[S.on_proc->nnz] = has_zero_diag ? 0 :
value<P>(dynamic_cast<BSRMatrix&>(*A.on_proc), row_start_on - 1);
else
S.on_proc->vals[S.on_proc->nnz] = has_zero_diag ? 0 : A.on_proc->vals[row_start_on - 1];
S.on_proc->nnz++;

// Add all off-diagonal entries to strength
Expand Down
21 changes: 15 additions & 6 deletions raptor/ruge_stuben/par_air_solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,28 @@ struct ParAIRSolver : ParMultilevel {

void extend_hierarchy() override {
int level_ctr = levels.size() - 1;
bool tap_level = tap_amg >= 0 && tap_amg <= level_ctr;

ParCSRMatrix *A = levels[level_ctr]->A;
ParBSRMatrix *A_bsr = dynamic_cast<ParBSRMatrix*>(A);
if (A_bsr) extend_hier(*A_bsr);
// else extend_hier(*A);
}

private:
template<class T>
void extend_hier(T & A) {
int level_ctr = levels.size() - 1;
bool tap_level = tap_amg >= 0 && tap_amg <= level_ctr;
splitting_t split;
auto S = A->strength(strength_type, strong_threshold, tap_level,
num_variables, variables);
auto S = A.strength(strength_type, strong_threshold, tap_level,
num_variables, variables);

split_rs(S, split.on_proc, split.off_proc, tap_level);
auto P = one_point_interpolation(A, S, split);
auto P = one_point_interpolation(A, *S, split);
auto R = local_air(A, *S, split, fpoint_distance::two);

levels.emplace_back(new ParLevel());
}

private:
coarsen_t coarsen_type;
interp_t interp_type;
restrict_t restrict_type;
Expand Down
Loading

0 comments on commit eb03a7c

Please sign in to comment.