Skip to content

Commit

Permalink
Merge Pull Request trilinos#13768 from trilinos/Trilinos/master_merge…
Browse files Browse the repository at this point in the history
…_20250131_175819

Automatically Merged using Trilinos Master Merge AutoTester
PR Title: b'Trilinos Master Merge PR Generator: Auto PR created to promote from master_merge_20250131_175819 branch to master'
PR Author: trilinos-autotester
  • Loading branch information
trilinos-autotester authored Feb 1, 2025
2 parents b9ef0e9 + 221f025 commit bd59c87
Show file tree
Hide file tree
Showing 392 changed files with 26,780 additions and 21,012 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/AT2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
with:
skip_after_successful_duplicate: 'true'

gcc10-openmpi416-EXPERIMENTAL:
gcc10-openmpi4:
needs: pre-checks
runs-on: [self-hosted, gcc-10.3.0_openmpi-4.1.6]
if: ${{ needs.pre-checks.outputs.should_skip != 'true' && (github.event.action == 'synchronize' || github.event.action == 'opened' || github.event.review.state == 'APPROVED') }}
Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:
echo "https://github.com/trilinos/Trilinos/wiki/Containers" >> $GITHUB_STEP_SUMMARY
echo "https://gitlab-ex.sandia.gov/trilinos-project/trilinos-containers/-/wikis/Containers-at-Sandia" >> $GITHUB_STEP_SUMMARY
cuda11-EXPERIMENTAL:
cuda11:
needs: pre-checks
runs-on: [self-hosted, cuda-11.4.2_gcc-10.3.0_openmpi-4.1.6]
if: ${{ needs.pre-checks.outputs.should_skip != 'true' && (github.event.action == 'synchronize' || github.event.action == 'opened' || github.event.review.state == 'APPROVED') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1
uses: github/codeql-action/init@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
Expand Down Expand Up @@ -108,6 +108,6 @@ jobs:
ninja -j 16
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1
uses: github/codeql-action/analyze@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1
uses: github/codeql-action/upload-sarif@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-latest
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
with:
debug-only: false
ascending: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


import sys
import imp
import shutil
import unittest

Expand Down
150 changes: 108 additions & 42 deletions packages/amesos2/src/Amesos2_EpetraCrsMatrix_MatrixAdapter_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,20 @@ namespace Amesos2 {
int myNRows = this->mat_->NumMyRows();
int myNnz = this->mat_->NumMyNonzeros();
if(current_phase == PREORDERING || current_phase == SYMBFACT) {
// workspace for column major
KV_GS pointers_t;
KV_GO indices_t;

// gether rowptr
Kokkos::resize(recvCounts, nRanks);
Kokkos::resize(recvDispls, nRanks+1);

// index-bases
global_ordinal_t rowIndexBase = rowMap->getIndexBase();
global_ordinal_t colIndexBase = colMap->getIndexBase();
// map from global to local
host_ordinal_type_array perm_g2l;
host_ordinal_type_array perm_l2g;
// workspace for column major
KV_GS pointers_t;
KV_GO indices_t;
bool need_to_perm = false;
{
#ifdef HAVE_AMESOS2_TIMERS
Teuchos::RCP< Teuchos::Time > gatherTime = Teuchos::TimeMonitor::getNewCounter ("Amesos2::gather(rowptr)");
Expand All @@ -142,13 +149,38 @@ namespace Amesos2 {
}
recvDispls(nRanks) = 0;
}
if (myRank == 0 && column_major) {
// gether g2l perm (convert to 0-base)
{
host_ordinal_type_array lclMap;
Kokkos::resize(lclMap, myNRows);
if (myRank == 0) {
Kokkos::resize(perm_g2l, nRows);
Kokkos::resize(perm_l2g, nRows);
} else {
Kokkos::resize(perm_g2l, 1);
}
for (int i=0; i < myNRows; i++) {
lclMap(i) = rowMap->getGlobalElement(i);
}
Teuchos::gatherv<int, local_ordinal_t> (lclMap.data(), myNRows, perm_g2l.data(),
recvCounts.data(), recvDispls.data(),
0, *comm);
if (myRank == 0) {
for (int i=0; i < nRows; i++) {
perm_g2l(i) -= rowIndexBase;
perm_l2g(perm_g2l(i)) = i;
if (i != perm_g2l(i)) need_to_perm = true;
}
}
}
if (myRank == 0 && (column_major || need_to_perm)) {
Kokkos::resize(pointers_t, nRows+1);
} else if (myRank != 0) {
Kokkos::resize(pointers_t, 2);
}
int *pointers_ = (myRank != 0 || column_major ? pointers_t.data() : pointers.data());
Teuchos::gatherv<int, local_ordinal_t> (&lclRowptr[1], myNRows, &pointers_[1],
local_ordinal_t sendIdx = (myNRows > 0 ? 1 : 0); // To skip sending the first rowptr entry (note: 0, if local matrix is empty)
local_ordinal_t *pointers_ = ((myRank != 0 || (column_major || need_to_perm)) ? pointers_t.data() : pointers.data());
Teuchos::gatherv<int, local_ordinal_t> (&lclRowptr[sendIdx], myNRows, &pointers_[1],
recvCounts.data(), recvDispls.data(),
0, *comm);
if (myRank == 0) {
Expand All @@ -157,13 +189,17 @@ namespace Amesos2 {
recvCounts(0) = pointers_[recvDispls(1)];
local_ordinal_t displs = recvCounts(0);
for (int p = 1; p < nRanks; p++) {
// save recvCounts from pth MPI
recvCounts(p) = pointers_[recvDispls(p+1)];
// shift pointers for pth MPI to global
for (int i = 1+recvDispls(p); i <= recvDispls(p+1); i++) {
pointers_[i] += displs;
// skip "Empty" submatrix (no rows)
// recvCounts(p) is zero, while pointers_[recvDispls(p+1)] now contains nnz from p-1
if (recvDispls(p+1) > recvDispls(p)) {
// save recvCounts from pth MPI
recvCounts(p) = pointers_[recvDispls(p+1)];
// shift pointers for pth MPI to global
for (int i = 1+recvDispls(p); i <= recvDispls(p+1); i++) {
pointers_[i] += displs;
}
displs += recvCounts(p);
}
displs += recvCounts(p);
}
ret = pointers_[nRows];
}
Expand All @@ -182,43 +218,70 @@ namespace Amesos2 {
}
// -- convert to global colids
KV_GO lclColind_ ("localColind_", myNnz);
for (int i = 0; i < int(myNnz); i++) lclColind_(i) = colMap->getGlobalElement((lclColind[i]));
if (column_major) {
for (int i = 0; i < int(myNnz); i++) lclColind_(i) = (colMap->getGlobalElement((lclColind[i])) - colIndexBase);
if (column_major || need_to_perm) {
Kokkos::resize(indices_t, indices.extent(0));
Teuchos::gatherv<int, local_ordinal_t> (lclColind_.data(), myNnz, indices_t.data(),
Teuchos::gatherv<int, local_ordinal_t> (lclColind_.data(), myNnz, indices_t.data(),
recvCounts.data(), recvDispls.data(),
0, *comm);
} else {
Teuchos::gatherv<int, local_ordinal_t> (lclColind_.data(), myNnz, indices.data(),
Teuchos::gatherv<int, local_ordinal_t> (lclColind_.data(), myNnz, indices.data(),
recvCounts.data(), recvDispls.data(),
0, *comm);
}
}
if (myRank == 0 && column_major) {
if (myRank == 0) {
#ifdef HAVE_AMESOS2_TIMERS
Teuchos::RCP< Teuchos::Time > gatherTime = Teuchos::TimeMonitor::getNewCounter ("Amesos2::gather(transpose index)");
Teuchos::TimeMonitor GatherTimer(*gatherTime);
#endif
// Map to transpose
Kokkos::resize(transpose_map, ret);
// Transopose to convert to CSC
for (int i=0; i<=nRows; i++) {
pointers(i) = 0;
}
for (int k=0; k<ret; k++) {
if (indices_t(k) < nRows-1) {
pointers(indices_t(k)+2) ++;
if (column_major) {
// Map to transpose
Kokkos::resize(transpose_map, ret);
// Transopose to convert to CSC
for (int i=0; i<=nRows; i++) {
pointers(i) = 0;
}
}
for (int i=1; i < nRows; i++) {
pointers(i+1) += pointers(i);
}
for (int i=0; i<nRows; i++) {
for (int k=pointers_t(i); k<pointers_t(i+1); k++) {
transpose_map(k) = pointers(1+indices_t(k));
indices(pointers(1+indices_t(k))) = i;
pointers(1+indices_t(k)) ++;
for (int k=0; k<ret; k++) {
int col = indices_t(k);
if (col < nRows-1) {
pointers(col+2) ++;
}
}
for (int i=1; i < nRows; i++) {
pointers(i+1) += pointers(i);
}
// nonzeroes in each column are sorted in ascending row
for (int row=0; row<nRows; row++) {
int i = perm_g2l(row);
for (int k=pointers_t(i); k<pointers_t(i+1); k++) {
int col = indices_t(k);
transpose_map(k) = pointers(1+col);
indices(pointers(1+col)) = row;
pointers(1+col) ++;
}
}
} else if (need_to_perm) {
// Map to permute
Kokkos::resize(transpose_map, ret);
for (int i=0; i<nRows; i++) {
int row = perm_g2l(i);
pointers(row+2) = pointers_t(i+1)-pointers_t(i);
}
for (int i=1; i < nRows; i++) {
pointers(i+1) += pointers(i);
}
for (int i=0; i<nRows; i++) {
int row = perm_g2l(i);
for (int k=pointers_t(i); k<pointers_t(i+1); k++) {
int col = indices_t(k);
transpose_map(k) = pointers(1+row);
indices(pointers(1+row)) = col;
pointers(1+row) ++;
}
}
} else {
Kokkos::resize(transpose_map, 0);
}
}
}
Expand All @@ -229,22 +292,25 @@ namespace Amesos2 {
Teuchos::RCP< Teuchos::Time > gatherTime = Teuchos::TimeMonitor::getNewCounter ("Amesos2::gather(nzvals)");
Teuchos::TimeMonitor GatherTimer(*gatherTime);
#endif
if (column_major) {
// gather nzvals
if (transpose_map.extent(0) > 0) {
Kokkos::resize(nzvals_t, nzvals.extent(0));
Teuchos::gatherv<int, scalar_t> (lclNzvals, myNnz, nzvals_t.data(),
Teuchos::gatherv<int, scalar_t> (lclNzvals, myNnz, nzvals_t.data(),
recvCounts.data(), recvDispls.data(),
0, *comm);
} else {
Teuchos::gatherv<int, scalar_t> (lclNzvals, myNnz, nzvals.data(),
Teuchos::gatherv<int, scalar_t> (lclNzvals, myNnz, nzvals.data(),
recvCounts.data(), recvDispls.data(),
0, *comm);
}
}
if (myRank == 0 && column_major) {
if (myRank == 0) {
// Insert Numerical values to transopose matrix
ret = pointers(nRows);
for (int k=0; k<ret; k++) {
nzvals(transpose_map(k)) = nzvals_t(k);
if (transpose_map.extent(0) > 0) {
for (int k=0; k<ret; k++) {
nzvals(transpose_map(k)) = nzvals_t(k);
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/amesos2/src/Amesos2_Superlu_FunctionMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace SLU {
#include "slu_util.h"
#include "superlu_enum_consts.h"

#undef EMPTY

void
at_plus_a(
const int n, /* number of columns in matrix A. */
Expand Down
2 changes: 2 additions & 0 deletions packages/amesos2/src/Amesos2_Superludist_TypeMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ namespace SLUD {
}
#endif // HAVE_TEUCHOS_COMPLEX

#undef EMPTY

// multiplication of SLUD types
template <typename slu_scalar_t, typename slu_mag_t>
struct slu_dist_mult {};
Expand Down
Loading

0 comments on commit bd59c87

Please sign in to comment.