Skip to content

Commit

Permalink
Adding control APIs and namespacing for core algorithm paths like SpG…
Browse files Browse the repository at this point in the history
…EMM, SpMV, and SpTrans. (AMReX-Codes#2859)

Co-authored-by: Paul Mullowney <Paul.Mullowney@nrel.gov>
  • Loading branch information
PaulMullowney and Paul Mullowney committed Jun 29, 2022
1 parent e4c83cf commit 6f9a46c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Src/Base/AMReX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ namespace {
#ifdef AMREX_USE_HYPRE
namespace {
int init_hypre = 1;
#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_HIP)
int hypre_spgemm_use_vendor = 0;
int hypre_spmv_use_vendor = 0;
int hypre_sptrans_use_vendor = 0;
#endif
}
#endif

Expand Down Expand Up @@ -489,6 +494,11 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse,

#ifdef AMREX_USE_HYPRE
pp.queryAdd("init_hypre", init_hypre);
#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_HIP)
pp.queryAdd("hypre_spgemm_use_vendor", hypre_spgemm_use_vendor);
pp.queryAdd("hypre_spmv_use_vendor", hypre_spmv_use_vendor);
pp.queryAdd("hypre_sptrans_use_vendor", hypre_sptrans_use_vendor);
#endif
#endif
}

Expand Down Expand Up @@ -526,7 +536,7 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse,
#ifdef AMREX_USE_HYPRE
if (init_hypre) {
HYPRE_Init();
#ifdef HYPRE_USING_CUDA
#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_HIP)

#if defined(HYPRE_RELEASE_NUMBER) && (HYPRE_RELEASE_NUMBER >= 22400)

Expand All @@ -543,7 +553,9 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse,
#endif
/* This API below used to be HYPRE_SetSpGemmUseCusparse(). This was changed in commit
Hypre master commit dfdd1cd12f */
HYPRE_SetSpGemmUseVendor(false);
HYPRE_SetSpGemmUseVendor(hypre_spgemm_use_vendor);
HYPRE_SetSpMVUseVendor(hypre_spmv_use_vendor);
HYPRE_SetSpTransUseVendor(hypre_sptrans_use_vendor);
HYPRE_SetMemoryLocation(HYPRE_MEMORY_DEVICE);
HYPRE_SetExecutionPolicy(HYPRE_EXEC_DEVICE);
HYPRE_SetUseGpuRand(true);
Expand Down

0 comments on commit 6f9a46c

Please sign in to comment.