Skip to content

boomerAMG on GPU for SolidMechanicsLagrangianSSLE #1054

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

Merged
merged 68 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c0e3d8f
Removing SuperLU coarse solver
castelletto1 Jul 16, 2020
abe1f6a
Hypre default LAI
castelletto1 Aug 18, 2020
a392f2a
Adding model problem
castelletto1 Aug 18, 2020
16ffd62
Attempted Hypre setup for GPU execution
rrsettgast Oct 1, 2020
6550d95
change localIndex and globalIndex to an int for hypregpu. Added cudas…
rrsettgast Oct 3, 2020
8af4936
update for hypre build
rrsettgast Oct 5, 2020
9be628a
added more amg options for hypre gpu study
rrsettgast Oct 13, 2020
3ccc0e9
simulations running, but not converging, with device pointers
rrsettgast Oct 23, 2020
5560b69
modify component filter
rrsettgast Oct 23, 2020
239bf6a
fix bug in component filter
rrsettgast Oct 25, 2020
8f0234f
Merge branch 'develop' into feature/boomerAMG-for-elasticity
rrsettgast Oct 27, 2020
29f0a26
Merge branch 'feature/boomerAMG-for-elasticity' of github.com:GEOSX/G…
rrsettgast Oct 28, 2020
7a6e7f3
post merge fixes
rrsettgast Nov 3, 2020
8a0e58d
post merge fixes
rrsettgast Nov 3, 2020
f9675fa
introduce cmake arguments for types for localIndex and globalIndex
rrsettgast Nov 5, 2020
ba290b5
changes for integration back into develop
rrsettgast Nov 5, 2020
3940989
squashme
rrsettgast Nov 16, 2020
94e5266
fix quartz builds
rrsettgast Nov 17, 2020
f8d0530
Merge branch 'develop' into feature/boomerAMG-for-elasticity
rrsettgast Feb 19, 2021
b84333c
Checkpoint. Post merge fixes. Successful run on GPU
rrsettgast Feb 19, 2021
30a82c7
Apply suggestions from code review
rrsettgast Feb 19, 2021
de3d0cd
Updated ESSL, fixes link error with GCC.
corbett5 Feb 19, 2021
a3dffe3
smooth out cmake configuration
rrsettgast Feb 22, 2021
675eab6
Merge branch 'feature/boomerAMG-for-elasticity' of github.com:GEOSX/G…
rrsettgast Feb 22, 2021
4192d75
Update src/coreComponents/linearAlgebra/interfaces/hypre/HyprePrecond…
rrsettgast Feb 22, 2021
662692d
delete me. debugging
rrsettgast Feb 23, 2021
40fdba0
Merge branch 'feature/boomerAMG-for-elasticity' of github.com:GEOSX/G…
rrsettgast Feb 23, 2021
d9d978a
reenable solve...new crashes
rrsettgast Mar 2, 2021
341f0e5
bugfix
rrsettgast Mar 3, 2021
bd6df5c
bugfix
rrsettgast Mar 3, 2021
5e2bf98
disable hypre in lassen hostconfig
rrsettgast Mar 4, 2021
577a50b
update travis tpl tag
rrsettgast Mar 5, 2021
8324e10
address review comments
rrsettgast Mar 5, 2021
c74ce7e
Merge remote-tracking branch 'origin/develop' into feature/boomerAMG-…
rrsettgast Mar 5, 2021
a394d65
formatting and dox
rrsettgast Mar 6, 2021
27a565c
formatting and dox
rrsettgast Mar 6, 2021
dfb53bf
fix typo
rrsettgast Mar 6, 2021
4d7f9fc
disable hypre in travis cuda builds
rrsettgast Mar 6, 2021
5efeb15
Update .travis.yml
rrsettgast Mar 6, 2021
594a9cb
allow disabling of hypre
rrsettgast Mar 6, 2021
31b07e1
still trying to turn off hypre for cuda non-hyprecuda
rrsettgast Mar 6, 2021
6526b4a
still trying to turn off hypre for cuda non-hyprecuda
rrsettgast Mar 7, 2021
7d1295b
change lai condition number estimate
rrsettgast Mar 7, 2021
fa42154
Update testLAOperations.cpp
rrsettgast Mar 7, 2021
021fb55
Update HyprePreconditioner.cpp
rrsettgast Mar 7, 2021
0784195
squashme
rrsettgast Mar 7, 2021
7fad00c
changing some amg defaults
rrsettgast Mar 8, 2021
6ecc2cd
remove extra file
rrsettgast Mar 8, 2021
19abb38
Apply suggestions from code review
rrsettgast Mar 8, 2021
e998b3e
cleanup HypreVector
rrsettgast Mar 8, 2021
b092540
Merge branch 'feature/boomerAMG-for-elasticity' of github.com:GEOSX/G…
rrsettgast Mar 8, 2021
b68a80b
address some review comments
rrsettgast Mar 8, 2021
a6deba0
revert doxygen/GeosxConfig.hpp to hypre
rrsettgast Mar 8, 2021
47803fe
update submodule and tpl CI tag
rrsettgast Mar 8, 2021
1ab7abf
yet another fix for travis
rrsettgast Mar 9, 2021
87da7e6
yet another fix for travis
rrsettgast Mar 9, 2021
cd8d2a6
yet another fix for travis
rrsettgast Mar 9, 2021
4bf5284
yet another fix for travis
rrsettgast Mar 9, 2021
fe26290
yet another fix for travis
rrsettgast Mar 9, 2021
626b770
yet another fix for travis
rrsettgast Mar 9, 2021
fe409fb
yet another fix for travis
rrsettgast Mar 9, 2021
dce53ab
yet another fix for travis
rrsettgast Mar 9, 2021
084cac4
yet another fix for travis
rrsettgast Mar 9, 2021
c35a2ab
yet another fix for travis
rrsettgast Mar 9, 2021
58e86f5
yet another fix for travis
rrsettgast Mar 9, 2021
ec8590e
yet another fix for travis
rrsettgast Mar 9, 2021
9c68dc6
yet another fix for travis
rrsettgast Mar 9, 2021
1833bbb
yet another fix for travis
rrsettgast Mar 9, 2021
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
161 changes: 161 additions & 0 deletions examples/GPU/beamBending.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<?xml version="1.0" ?>

<Problem>
<!-- SPHINX_Gravity -->
<Solvers
gravityVector="0.0, 0.0, 0.0">
<!-- SPHINX_GravityEnd -->
<!-- SPHINX_SolidMechanicsSolver -->
<SolidMechanicsLagrangianSSLE
name="lagsolve"
timeIntegrationOption="QuasiStatic"
discretization="FE1"
logLevel="0"
targetRegions="{ Region2 }"
solidMaterialNames="{ shale }">
<!-- SPHINX_SolidMechanicsSolverEnd -->
<NonlinearSolverParameters
newtonTol="1.0e-6"
newtonMaxIter="8"/>
<LinearSolverParameters
logLevel="1"
solverType="gmres"
krylovTol="1.0e-12"
preconditionerType="amg"/>
</SolidMechanicsLagrangianSSLE>
</Solvers>

<!-- SPHINX_BeamBendingMesh -->
<Mesh>
<InternalMesh
name="mesh1"
elementTypes="{ C3D8 }"
xCoords="{ 0, 80 }"
yCoords="{ 0, 8 }"
zCoords="{ 0, 4 }"
nx="{ 320 }"
ny="{ 32 }"
nz="{ 16 }"
cellBlockNames="{ cb1 }"/>
</Mesh>

<!-- SPHINX_BeamBendingMeshEnd -->
<Events
maxTime="2.0">
<!-- This event is applied every cycle, and overrides the
solver time-step request -->
<!-- SPHINX_Execution -->
<PeriodicEvent
name="solverApplications"
forceDt="1.0"
target="/Solvers/lagsolve"/>

<!-- SPHINX_ExecutionEnd -->
<!-- This event is applied every 5.0e-5s. The targetExactTimestep
flag allows this event to request a dt modification to match an
integer multiple of the timeFrequency. -->
<!--PeriodicEvent
name="outputs"
timeFrequency="1.0"
targetExactTimestep="1"
target="/Outputs/siloOutput"/-->

<!--PeriodicEvent
name="restarts"
timeFrequency="1e99"
targetExactTimestep="0"
target="/Outputs/restartOutput"/-->
</Events>

<!-- SPHINX_FEDiscretization -->
<NumericalMethods>
<FiniteElements>
<FiniteElementSpace
name="FE1"
order="1"/>
</FiniteElements>
</NumericalMethods>

<!-- SPHINX_FEDiscretizationEnd -->
<ElementRegions>
<CellElementRegion
name="Region2"
cellBlocks="{ cb1 }"
materialList="{ shale }"/>
</ElementRegions>

<Constitutive>
<LinearElasticIsotropic
name="granite"
defaultDensity="2700"
defaultBulkModulus="5.5556e9"
defaultShearModulus="4.16667e9"/>

<!-- SPHINX_Material -->
<LinearElasticIsotropic
name="shale"
defaultDensity="2700"
defaultBulkModulus="5.5556e9"
defaultShearModulus="4.16667e9"/>

<!-- SPHINX_MaterialEnd -->
</Constitutive>

<!-- SPHINX_BoundaryConditions -->
<FieldSpecifications>
<FieldSpecification
name="xnegconstraint"
objectPath="nodeManager"
fieldName="TotalDisplacement"
component="0"
scale="0.0"
setNames="{ xneg }"/>

<FieldSpecification
name="yconstraint"
objectPath="nodeManager"
fieldName="TotalDisplacement"
component="1"
scale="0.0"
setNames="{ xneg }"/>

<FieldSpecification
name="zconstraint"
objectPath="nodeManager"
fieldName="TotalDisplacement"
component="2"
scale="0.0"
setNames="{ zneg, zpos }"/>

<FieldSpecification
name="xposconstraint"
objectPath="faceManager"
fieldName="Traction"
component="1"
scale="1.0e6"
functionName="timeFunction"
setNames="{ xpos }"/>
</FieldSpecifications>

<!-- SPHINX_BoundaryConditionsEnd -->
<!-- SPHINX_TableFunction -->
<Functions>
<TableFunction
name="timeFunction"
inputVarNames="{ time }"
coordinates="{ 0.0, 10.0 }"
values="{ 0.0, 10.0 }"/>
</Functions>

<!-- SPHINX_TableFunctionEnd -->
<Outputs>
<Silo
name="siloOutput"
parallelThreads="32"
plotFileRoot="plot"
childDirectory="sub"/>

<Restart
name="restartOutput"/>
</Outputs>
</Problem>
2 changes: 1 addition & 1 deletion host-configs/LLNL/lassen-clang@upstream.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ set(ESSL_LIBRARIES /usr/tcetmp/packages/essl/essl-6.2/lib64/libesslsmpcuda.so
# PETSc doesn't seem to work correctly with clang.
set(ENABLE_PETSC OFF CACHE BOOL "" FORCE )
#set(PETSC_OMP_DIR ${GEOSX_TPL_ROOT_DIR}/omp-links-for-petsc CACHE STRING "")
set(ENABLE_HYPRE OFF CACHE BOOL "" FORCE )
set(ENABLE_HYPRE ON CACHE BOOL "" FORCE )
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,27 @@

#include "HypreInterface.hpp"
#include "linearAlgebra/interfaces/hypre/HyprePreconditioner.hpp"
#include "HYPRE_utilities.h"
#include "_hypre_utilities.h"

namespace geosx
{

void HypreInterface::initialize( int & GEOSX_UNUSED_PARAM( argc ),
char * * & GEOSX_UNUSED_PARAM( argv ) )
{}
{
HYPRE_Init();
#if defined(USE_CUDA)
HYPRE_ExecutionPolicy default_exec_policy = HYPRE_EXEC_DEVICE;
hypre_HandleDefaultExecPolicy(hypre_handle()) = HYPRE_EXEC_DEVICE;
hypre_HandleSpgemmUseCusparse(hypre_handle()) = 1;
#endif
}

void HypreInterface::finalize()
{}
{
HYPRE_Finalize();
}

std::unique_ptr< PreconditionerBase< HypreInterface > >
geosx::HypreInterface::createPreconditioner( LinearSolverParameters params )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,85 @@ void HypreMatrix::close()
m_assembled = true;
}

//void HypreMatrix::create( CRSMatrixView< real64 const, globalIndex const > const & localMatrix,
// MPI_Comm const & comm )
//{
//
//
//
// HYPRE_BigInt *row_starts;
// HYPRE_BigInt *col_starts;
// HYPRE_Int num_cols_offd;
// HYPRE_Int num_nonzeros_diag;
// HYPRE_Int num_nonzeros_offd;
//
// HYPRE_Int *diag_i;
// HYPRE_Int *diag_j;
// double *diag_data;
// HYPRE_Int *offd_i;
// HYPRE_Int *offd_j;
// double *offd_data;
// HYPRE_Int offd_num_cols;
// HYPRE_Int *offd_col_map;
//
//
//
// m_parcsr_mat = hypre_ParCSRMatrixCreate( comm,
// localMatrix.numRows(),
// localMatrix.numRows(),
// row_starts,
// col_starts,
// num_cols_offd,
// num_nonzeros_diag,
// num_nonzeros_offd);
//
//
//
//
//
// hypre_ParCSRMatrixSetDataOwner(m_parcsr_mat,1);
// hypre_ParCSRMatrixSetRowStartsOwner(m_parcsr_mat,0);
// hypre_ParCSRMatrixSetColStartsOwner(m_parcsr_mat,0);
//
// HYPRE_Int local_num_rows = hypre_CSRMatrixNumRows(m_parcsr_mat->diag);
//
// hypre_CSRMatrixSetDataOwner(m_parcsr_mat->diag,0);
// hypre_CSRMatrixI(m_parcsr_mat->diag) = diag_i;
// hypre_CSRMatrixJ(m_parcsr_mat->diag) = diag_j;
// hypre_CSRMatrixData(m_parcsr_mat->diag) = diag_data;
// hypre_CSRMatrixNumNonzeros(m_parcsr_mat->diag) = diag_i[local_num_rows];
// hypre_CSRMatrixSetRownnz(m_parcsr_mat->diag);
// // Prevent hypre from destroying m_parcsr_mat->diag->{i,j,data}, own m_parcsr_mat->diag->{i,j,data}
// //diagOwner = 3;
//
// hypre_CSRMatrixSetDataOwner(m_parcsr_mat->offd,0);
// hypre_CSRMatrixI(m_parcsr_mat->offd) = offd_i;
// hypre_CSRMatrixJ(m_parcsr_mat->offd) = offd_j;
// hypre_CSRMatrixData(m_parcsr_mat->offd) = offd_data;
// hypre_CSRMatrixNumNonzeros(m_parcsr_mat->offd) = offd_i[local_num_rows];
// hypre_CSRMatrixSetRownnz(m_parcsr_mat->offd);
// // Prevent hypre from destroying m_parcsr_mat->offd->{i,j,data}, own m_parcsr_mat->offd->{i,j,data}
// //offdOwner = 3;
//
// hypre_ParCSRMatrixColMapOffd(m_parcsr_mat) = offd_col_map;
// // Prevent hypre from destroying m_parcsr_mat->col_map_offd, own m_parcsr_mat->col_map_offd
// //colMapOwner = 1;
//
// hypre_ParCSRMatrixSetNumNonzeros(m_parcsr_mat);
//
// /* Make sure that the first entry in each row is the diagonal one. */
// if (row_starts == col_starts)
// {
// hypre_CSRMatrixReorder(hypre_ParCSRMatrixDiag(m_parcsr_mat));
// }
//
// hypre_MatvecCommPkgCreate(m_parcsr_mat);
//
// height = GetNumRows();
// width = GetNumCols();
//}


bool HypreMatrix::created() const
{
return m_ij_mat != nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ class HypreMatrix final : public virtual LinearOperator< HypreVector >,

virtual void close() override;

// virtual void create( CRSMatrixView< real64 const, globalIndex const > const & localMatrix,
// MPI_Comm const & comm ) override;

virtual bool created() const override;

virtual void reset() override;
Expand Down Expand Up @@ -336,6 +339,9 @@ class HypreMatrix final : public virtual LinearOperator< HypreVector >,
*/
HYPRE_ParCSRMatrix m_parcsr_mat = nullptr;

// CRSMatrix< real64, globalIndex > & m_diagCRS;
// CRSMatrix< real64, globalIndex > & m_offDiagCRS;

};

} // namespace geosx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ void HypreSolver::solve_krylov( HypreMatrix & mat,
{
Stopwatch watch;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't caliper used?

Copy link
Member

Choose a reason for hiding this comment

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

Because we want timings for each call....can caliper do that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I imagine it can but I don't know to be honest.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the goal was to eventually have some (crude) runtime profiling printing to the log as the simulation executes, just to let the user know how things are proceeding. Caliper is great, but you have to wait until the end of the simulation to examine the profile. Or at least, at the time we implemented the stopwatch, it wasn't clear how we could get this info out of Caliper during the run.

Copy link
Member

Choose a reason for hiding this comment

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

I do recall I was supposed to improve Stopwatch at some point....but not high on the priority list.


#if defined(USE_CUDA)
HYPRE_ExecutionPolicy default_exec_policy = HYPRE_EXEC_DEVICE;
hypre_HandleDefaultExecPolicy(hypre_handle()) = HYPRE_EXEC_DEVICE;
hypre_HandleSpgemmUseCusparse(hypre_handle()) = 1;
#endif

// Create the preconditioner, but don't compute (this is done by solver setup)
HyprePreconditioner precond( m_parameters, dofManager );

Expand Down Expand Up @@ -340,6 +346,13 @@ void HypreSolver::solve_krylov( HypreMatrix & mat,
HYPRE_BoomerAMGSetAggNumLevels( uu_amg_solver, 1 );
HYPRE_BoomerAMGSetNumFunctions( uu_amg_solver, 3 );

// Relaxation options: Use options 18 or 7.
// Coarsening options: Only PMIS is supported
// Interpolation options: Use options 3, 6, 14 or 15.
HYPRE_BoomerAMGSetRelaxType( uu_amg_solver, 7 );
HYPRE_BoomerAMGSetCoarsenType( uu_amg_solver, 8 );
HYPRE_BoomerAMGSetInterpType( uu_amg_solver, 3 );

HYPRE_BoomerAMGSetup( uu_amg_solver, separateComponentMatrix.unwrapped(), nullptr, nullptr );

HYPRE_MGRSetFSolver( precond.unwrapped(), HYPRE_BoomerAMGSolve, HYPRE_BoomerAMGSetup, uu_amg_solver );
Expand Down
2 changes: 2 additions & 0 deletions src/coreComponents/managers/initialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ void basicSetup( int argc, char * argv[], bool const parseCommandLine )
setupMKL();
setupLAI( argc, argv );



if( parseCommandLine )
{
internal::parseCommandLineOptions( argc, argv );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
newtonTol="1.0e-6"
newtonMaxIter="8"/>
<LinearSolverParameters
logLevel="1"
solverType="gmres"
krylovTol="1.0e-12"
preconditionerType="amg"/>
Expand All @@ -32,9 +33,9 @@
xCoords="{ 0, 80 }"
yCoords="{ 0, 8 }"
zCoords="{ 0, 4 }"
nx="{ 80 }"
ny="{ 8 }"
nz="{ 4 }"
nx="{ 160 }"
ny="{ 16 }"
nz="{ 8 }"
cellBlockNames="{ cb1 }"/>
</Mesh>

Expand Down