Branch data Line data Source code
1 : : // ***************************************************************************** 2 : : /*! 3 : : Created 2025, Christopher Long 4 : : \file src/LinearSolver/bicg.ci 5 : : \copyright 2012-2015 J. Bakosi, 6 : : 2016-2018 Los Alamos National Security, LLC., 7 : : 2019-2021 Triad National Security, LLC. 8 : : All rights reserved. See the LICENSE file for details. 9 : : \brief Charm++ module interface for distributed conjugate gradients 10 : : \details Charm++ module interface file for asynchronous distributed 11 : : conjugate gradients linear solver. 12 : : \see bicg.[ch]pp for more info. 13 : : */ 14 : : // ***************************************************************************** 15 : : 16 : : module bicg { 17 : : 18 : : include "CSR.hpp"; 19 : : include "CommMap.hpp"; 20 : : 21 : : namespace tk { 22 : : 23 : : array [1D] BiCG { 24 : : entry BiCG( 25 : : const CSR& A, 26 : : const std::vector< tk::real >& x, 27 : : const std::vector< tk::real >& b, 28 : : const std::vector< std::size_t >& gid, 29 : : const std::unordered_map< std::size_t, std::size_t >& lid, 30 : : const NodeCommMap& nodecommmap ); 31 : : entry BiCG( 32 : : std::tuple< tk::CSR, 33 : : std::vector< tk::real >, 34 : : std::vector< tk::real > >&& system, 35 : : const std::vector< std::size_t >& gid, 36 : : const std::unordered_map< std::size_t, std::size_t >& lid, 37 : : const NodeCommMap& nodecommmap ); 38 : : entry void init( const std::vector< tk::real >& x, 39 : : const std::vector< tk::real >& b, 40 : : const std::unordered_map< std::size_t, 41 : : std::vector< std::pair< bool, tk::real > > >& bc, 42 : : std::size_t ignorebc, 43 : : CkCallback cb ); 44 : : entry void setup( CkCallback cb ); 45 : : entry void solve( std::size_t maxit, tk::real stop_tol, CkCallback c ); 46 : : entry [reductiontarget] void normb( tk::real n ); 47 : : entry [reductiontarget] void rho( tk::real r ); 48 : : entry [reductiontarget] void pq( tk::real n ); 49 : : entry [reductiontarget] void tt( tk::real n ); 50 : 0 : entry [reductiontarget] void ts( tk::real n ); 51 : : entry [reductiontarget] void normres( tk::real r ); 52 : : entry [reductiontarget] void normresomega( tk::real r ); 53 : : entry [reductiontarget] void comprho( tk::real r ); 54 [ - - ][ - - ]: 0 : entry void comres( const std::vector< std::size_t >& gid, 55 : : const std::vector< std::vector< tk::real > >& rc ); 56 : : entry void combc( const std::unordered_map< std::size_t, 57 : 0 : std::vector< std::pair< bool, tk::real > > >& bc ); 58 : : entry void comq( const std::vector< std::size_t >& gid, 59 : : const std::vector< std::vector< tk::real > >& qc ); 60 : 0 : entry void comx( const std::vector< std::size_t >& gid, 61 : : const std::vector< std::vector< tk::real > >& xc ); 62 : : entry void comt( const std::vector< std::size_t >& gid, 63 : 0 : const std::vector< std::vector< tk::real > >& tc ); 64 : : entry void comx2( const std::vector< std::size_t >& gid, 65 : : const std::vector< std::vector< tk::real > >& x2c ); 66 : 0 : 67 : : // SDAG code follows. See http://charm.cs.illinois.edu/manuals/html/ 68 : : // charm++/manual.html, Sec. "Structured Control Flow: Structured Dagger". 69 : : 70 : : entry void wait4res() { 71 : : when ownres_complete(), comres_complete(), normb_complete() 72 : : serial "res" { initres(); } 73 : : } 74 : : 75 : : entry void wait4bc() { 76 : : when ownbc_complete( CkCallback cb ), combc_complete() 77 : : serial "bc" { apply( cb ); } 78 : : } 79 : : 80 : : entry void wait4q() { 81 : : when ownq_complete(), comq_complete() serial "q" { q(); } 82 : : } 83 : : 84 : : entry void wait4x() { 85 : : when ownx_complete(), comx_complete() serial "x" { x(); } 86 : : } 87 : : 88 : : entry void wait4t() { 89 : : when ownt_complete(), comt_complete() serial "t" { t(); } 90 : : } 91 : : 92 : : entry void wait4x2() { 93 : : when ownx2_complete(), comx2_complete() serial "x2" { x2(); } 94 : : } 95 : : 96 : : entry void ownres_complete(); 97 : : entry void comres_complete(); 98 : : entry void normb_complete(); 99 : : entry void ownbc_complete( CkCallback cb ); 100 : : entry void combc_complete(); 101 : : entry void ownq_complete(); 102 : : entry void comq_complete(); 103 : : entry void ownx_complete(); 104 : : entry void comx_complete(); 105 : : entry void ownt_complete(); 106 : : entry void comt_complete(); 107 : : entry void ownx2_complete(); 108 : : entry void comx2_complete(); 109 : : }; 110 : : 111 : : } // tk:: 112 : : 113 : : }