[Trilinos-Users] [EXTERNAL] Solving linear systems on GPU
Rajamanickam, Sivasankaran
srajama at sandia.gov
Tue Jan 31 10:38:29 EST 2017
Ashes
The execution space is based on the Tpetra matrix and vector execution space.
Let me see if we can find a short example for you. BTW, please CC the list so you get responses from different people and the responses are archived.
-Siva
________________________________
From: Ashesh Chattopadhyay <ashesh6810 at gmail.com>
Sent: Tuesday, January 31, 2017 8:18 AM
To: Rajamanickam, Sivasankaran
Subject: Re: [Trilinos-Users] [EXTERNAL] Solving linear systems on GPU
Sir,
I was using this function to set everything up in Belos to solve the linear system.
template<class MV, class OP>
MV solve ( MV& X, const MV& B, const OP& A)
{
using Teuchos::ParameterList;
using Teuchos::parameterList;
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::rcpFromRef;
typedef typename MV::scalar_type scalar_type;
RCP<ParameterList> solverParams = parameterList();
solverParams->set ("Num Blocks", 40);
solverParams->set ("Maximum Iterations", 5000);
solverParams->set ("Convergence Tolerance", 1.0e-3);
Belos::SolverFactory<scalar_type, MV, OP> factory;
RCP<Belos::SolverManager<scalar_type, MV, OP> > solver =
factory.create ("GMRES", solverParams);
typedef Belos::LinearProblem<scalar_type, MV, OP> problem_type;
RCP<problem_type> problem =
rcp (new problem_type (rcpFromRef (A), rcpFromRef (X), rcpFromRef (B)));
problem->setProblem ();
solver->setProblem (problem);
Belos::ReturnType result = solver->solve();
int numIters = solver->getNumIters();
if (result == Belos::Converged) {
std::cout << "The Belos solve took " << numIters << " iteration(s) to reach "
"a relative residual tolerance of " << 1.0e-4 << "." << std::endl;
} else {
std::cout << "The Belos solve took " << numIters << " iteration(s), but did not reach "
"a relative residual tolerance of " << 1.0e-4 << "." << std::endl;
}
return X;
Is there a way to specify, something like execution space as device or something like that, the way one can do in Kokkos to execute on GPU? Or any other way, kindly point me to a reference from which I can learn how to do it.
Thanks
Ashesh
On Tue, Jan 31, 2017 at 8:06 AM, Ashesh Chattopadhyay <ashesh6810 at gmail.com<mailto:ashesh6810 at gmail.com>> wrote:
Sir,
Thank you. Yes , I have a Tpetra Crs Matrix A and a multivector b. I simply wanna solve Ax=b,without preconditioning. My A matrix is a saddle point matrix coming out of a modified nodal analysis algorithm. Can you please point me to an example or documentation as to how to use Belos to solve this on GPU? Till now I was doing this on CPU using GMRES in belos, the way the examples are there on git.
Thanks
Ashesh
On Jan 31, 2017 7:33 AM, "Rajamanickam, Sivasankaran" <srajama at sandia.gov<mailto:srajama at sandia.gov>> wrote:
...
--
Research Assistant, Multi-Scale Multi-Physics Computation Lab
University of Texas at El Paso
Texas, El Paso, USA
(+1) 915-355-5013
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20170131/d1f73a4e/attachment-0001.html>
More information about the Trilinos-Users
mailing list