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

Supernodal SpTRSV: support SuperLU version < 5 #1012

Merged
merged 1 commit into from
Jun 9, 2021
Merged
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
48 changes: 40 additions & 8 deletions perf_test/sparse/KokkosSparse_sptrsv_superlu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,20 @@
#if defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU) && \
defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV)

#include "slu_ddefs.h"
#include "slu_sdefs.h"
#include "slu_zdefs.h"
#include "slu_cdefs.h"
namespace SLU {
namespace D {
#include "slu_ddefs.h"
}
namespace S {
#include "slu_sdefs.h"
}
namespace C {
#include "slu_cdefs.h"
}
namespace Z {
#include "slu_zdefs.h"
}
}
// auxiliary functions from perf_test (e.g., pivoting, printing)
#include "KokkosSparse_sptrsv_aux.hpp"

Expand All @@ -73,6 +83,10 @@ using namespace KokkosKernels::Experimental;
using namespace KokkosSparse;
using namespace KokkosSparse::Experimental;
using namespace KokkosSparse::PerfTest::Experimental;
using namespace SLU::D;
using namespace SLU::S;
using namespace SLU::C;
using namespace SLU::Z;

enum {CUSPARSE, SUPERNODAL_NAIVE, SUPERNODAL_ETREE, SUPERNODAL_DAG, SUPERNODAL_SPMV, SUPERNODAL_SPMV_DAG};

Expand Down Expand Up @@ -220,21 +234,39 @@ void factor_superlu (bool symm_mode, bool metis,
printf( " + calling SuperLU dgstrf with panel_size=%d, relax_size=%d..\n",panel_size,relax_size );
printf( " * Dimension %dx%d; # nonzeros %d\n", A.nrow, A.ncol, Astore->nnz);

#ifdef HAVE_KOKKOSKERNELS_SUPERLU5_API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iyamazaki Just to make sure I understand: Do we need to set -DHAVE_KOKKOSKERNELS_SUPERLU5_API:BOOL=ON in the cmake command when building Kokkos Kernels?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @vqd8a. I am not sure that will work.. For my testing, I just added -DHAVE_KOKKOSKERNELS_SUPERLU5_API to CMAKE_CXX_FLAGS.. It will be nice if there is a cleaner way like that (or can configure figure out SuperLU version?).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @iyamazaki . I am fine with setting -DHAVE_KOKKOSKERNELS_SUPERLU5_API in CMAKE_CXX_FLAGS.

GlobalLU_t Glu;
#endif
int lwork = 0;
if (std::is_same<scalar_type, double>::value == true) {
dgstrf (&options, &AC, relax_size, panel_size, etree,
NULL, lwork, *perm_c, *perm_r, &L, &U, &Glu, &stat, &info);
NULL, lwork, *perm_c, *perm_r, &L, &U,
#ifdef HAVE_KOKKOSKERNELS_SUPERLU5_API
&Glu,
#endif
&stat, &info);
} else if (std::is_same<scalar_type, float>::value == true) {
sgstrf (&options, &AC, relax_size, panel_size, etree,
NULL, lwork, *perm_c, *perm_r, &L, &U, &Glu, &stat, &info);
NULL, lwork, *perm_c, *perm_r, &L, &U,
#ifdef HAVE_KOKKOSKERNELS_SUPERLU5_API
&Glu,
#endif
&stat, &info);
} else if (std::is_same<scalar_type, std::complex<float>>::value == true ||
std::is_same<scalar_type, Kokkos::complex<float>>::value == true) {
cgstrf (&options, &AC, relax_size, panel_size, etree,
NULL, lwork, *perm_c, *perm_r, &L, &U, &Glu, &stat, &info);
NULL, lwork, *perm_c, *perm_r, &L, &U,
#ifdef HAVE_KOKKOSKERNELS_SUPERLU5_API
&Glu,
#endif
&stat, &info);
} else {
zgstrf (&options, &AC, relax_size, panel_size, etree,
NULL, lwork, *perm_c, *perm_r, &L, &U, &Glu, &stat, &info);
NULL, lwork, *perm_c, *perm_r, &L, &U,
#ifdef HAVE_KOKKOSKERNELS_SUPERLU5_API
&Glu,
#endif
&stat, &info);
}
if (info != 0) printf( " SuperLU failed with info=%d\n",info );
StatFree(&stat);
Expand Down