COMBINATORIAL_BLAS 1.6
 
Loading...
Searching...
No Matches
SpParMat.h
Go to the documentation of this file.
1/****************************************************************/
2/* Parallel Combinatorial BLAS Library (for Graph Computations) */
3/* version 1.6 -------------------------------------------------*/
4/* date: 6/15/2017 ---------------------------------------------*/
5/* authors: Ariful Azad, Aydin Buluc --------------------------*/
6/****************************************************************/
7/*
8 Copyright (c) 2010-2017, The Regents of the University of California
9
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 THE SOFTWARE.
27 */
28
29
30#ifndef _SP_PAR_MAT_H_
31#define _SP_PAR_MAT_H_
32
33#include <iostream>
34#include <fstream>
35#include <cmath>
36#include <mpi.h>
37#include <vector>
38#include <iterator>
39
40#include "SpMat.h"
41#include "SpTuples.h"
42#include "SpDCCols.h"
43#include "CommGrid.h"
44#include "MPIType.h"
45#include "LocArr.h"
46#include "SpDefs.h"
47#include "Deleter.h"
48#include "SpHelper.h"
49#include "SpParHelper.h"
50#include "DenseParMat.h"
51#include "FullyDistVec.h"
52#include "Friends.h"
53#include "Operations.h"
54#include "DistEdgeList.h"
55#include "CombBLAS.h"
56
57namespace combblas {
58
67template <class IT, class NT, class DER>
69{
70public:
71 typedef typename DER::LocalIT LocalIT;
72 typedef typename DER::LocalNT LocalNT;
73 typedef IT GlobalIT;
74 typedef NT GlobalNT;
75
76 // Constructors
78 SpParMat (MPI_Comm world); // ABAB: there is risk that any integer would call this constructor due to MPICH representation
79 SpParMat (std::shared_ptr<CommGrid> grid);
80 SpParMat (DER * myseq, std::shared_ptr<CommGrid> grid);
81
82 SpParMat (std::ifstream & input, MPI_Comm & world);
84
85 template <class DELIT>
86 SpParMat (const DistEdgeList< DELIT > & rhs, bool removeloops = true); // conversion from distributed edge list
87
88 SpParMat (const SpParMat< IT,NT,DER > & rhs); // copy constructor
89
90 SpParMat (IT total_m, IT total_n, const FullyDistVec<IT,IT> & , const FullyDistVec<IT,IT> & , const FullyDistVec<IT,NT> & , bool SumDuplicates = false); // matlab sparse
91 SpParMat (IT total_m, IT total_n, const FullyDistVec<IT,IT> & , const FullyDistVec<IT,IT> & , const NT & , bool SumDuplicates = false); // matlab sparse
92 SpParMat< IT,NT,DER > & operator=(const SpParMat< IT,NT,DER > & rhs); // assignment operator
95
96 template <typename SR>
97 void Square ();
98
99 float LoadImbalance() const;
100 void Transpose();
107
109
110 template <typename _BinaryOperation>
112
113 template <typename _BinaryOperation, typename _UnaryOperation >
115
116 template <typename _BinaryOperation>
118
119 template <typename VT, typename GIT, typename _BinaryOperation, typename _UnaryOperation >
121
122 template <typename VT, typename GIT, typename _BinaryOperation>
124
125 template <typename VT, typename GIT>
126 bool Kselect(FullyDistVec<GIT,VT> & rvec, IT k_limit, int kselectVersion) const;
127 template <typename VT, typename GIT>
128 bool Kselect(FullyDistSpVec<GIT,VT> & kth, IT k_limit, int kselectVersion) const; //sparse case
129
130 template <typename VT, typename GIT, typename _UnaryOperation>
132 template <typename VT, typename GIT, typename _UnaryOperation>
134 template <typename VT, typename GIT>
135 bool Kselect1(FullyDistVec<GIT,VT> & rvec, IT k_limit) const; // TODO: make private
136 template <typename VT, typename GIT>
137 bool Kselect2(FullyDistVec<GIT,VT> & rvec, IT k_limit) const; // TODO: make private
138
139 IT Bandwidth() const;
140 IT Profile() const;
141
142 template <typename VT, typename GIT, typename _BinaryOperation>
144 template <typename VT, typename GIT, typename _BinaryOperation, typename _UnaryOperation >
146
147 template <typename _UnaryOperation>
149 {
150 spSeq->Apply(__unary_op);
151 }
152
153 IT RemoveLoops(); // returns the number of loops removed
156
157 template <typename LIT, typename OT>
159 void ActivateThreading(int numsplits); //<! As of version 1.2, only works with boolean matrices
160
161 template <typename _UnaryOperation>
162 SpParMat<IT,NT,DER> PruneI(_UnaryOperation __unary_op, bool inPlace = true) //<! Prune any nonzero entries based on both row/column indices and value
163 {
164 IT grow=0, gcol=0;
165 GetPlaceInGlobalGrid(grow, gcol);
166 if (inPlace)
167 {
168 spSeq->PruneI(__unary_op, inPlace, grow, gcol);
169 return SpParMat<IT,NT,DER>(getcommgrid()); // return blank to match signature
170 }
171 else
172 {
173 return SpParMat<IT,NT,DER>(spSeq->PruneI(__unary_op, inPlace, grow, gcol), commGrid);
174 }
175 }
176
177 template <typename _UnaryOperation>
178 SpParMat<IT,NT,DER> Prune(_UnaryOperation __unary_op, bool inPlace = true) //<! Prune any nonzero entries for which the __unary_op evaluates to true (solely based on value)
179 {
180 if (inPlace)
181 {
182 spSeq->Prune(__unary_op, inPlace);
183 return SpParMat<IT,NT,DER>(getcommgrid()); // return blank to match signature
184 }
185 else
186 {
187 return SpParMat<IT,NT,DER>(spSeq->Prune(__unary_op, inPlace), commGrid);
188 }
189 }
190
191 template <typename _BinaryOperation>
193
194 template <typename _BinaryOperation>
196
197 template <typename IRRELEVANT_NT>
199
200 template <typename _BinaryOperation>
202
203 void Dump(std::string filename) const;
204 void PrintInfo() const;
205
206 template <typename NNT, typename NDER> operator SpParMat< IT,NNT,NDER > () const;
207 template <typename NIT, typename NNT, typename NDER> operator SpParMat< NIT,NNT,NDER > () const;
208
209 IT getnrow() const;
210 IT getncol() const;
211 IT getnnz() const;
212
213 template <typename LIT>
215
216 SpParMat<IT,NT,DER> SubsRefCol (const std::vector<IT> & ci) const;
217
219 template <typename SelectFirstSR, typename SelectSecondSR>
221
222 // Column- or row-only indexing
223 template<typename SelectFirstSR,
224 typename SelectSecondSR>
226 SubsRef_SR (const FullyDistVec<IT, IT> &v, Dim dim, bool inplace = false);
227
232
239
243
245
247 {
248 public:
249 NT getNoNum(IT row, IT col) { return static_cast<NT>(1); }
250 void binaryfill(FILE * rFile, IT & row, IT & col, NT & val)
251 {
252 if (fread(&row, sizeof(IT), 1,rFile) != 1)
253 std::cout << "binaryfill(): error reading row index" << std::endl;
254 if (fread(&col, sizeof(IT), 1,rFile) != 1)
255 std::cout << "binaryfill(): error reading col index" << std::endl;
256 if (fread(&val, sizeof(NT), 1,rFile) != 1)
257 std::cout << "binaryfill(): error reading value" << std::endl;
258 return;
259 }
260 size_t entrylength() { return 2*sizeof(IT)+sizeof(NT); }
261
262 template <typename c, typename t>
263 NT read(std::basic_istream<c,t>& is, IT row, IT col)
264 {
265 NT v;
266 is >> v;
267 return v;
268 }
269
270 template <typename c, typename t>
271 void save(std::basic_ostream<c,t>& os, const NT& v, IT row, IT col)
272 {
273 os << v;
274 }
275 };
276
277 template <typename _BinaryOperation>
278 void ParallelReadMM (const std::string & filename, bool onebased, _BinaryOperation BinOp);
279
280 template <class HANDLER>
281 void ParallelWriteMM(const std::string & filename, bool onebased, HANDLER handler);
283
284 void ParallelBinaryWrite(std::string filename) const;
285
286 template <typename _BinaryOperation>
288
289 template <class HANDLER>
290 void ReadDistribute (const std::string & filename, int master, bool nonum, HANDLER handler, bool transpose = false, bool pario = false);
291 void ReadDistribute (const std::string & filename, int master, bool nonum=false, bool pario = false)
292 {
294 }
295
296 template <class HANDLER>
297 void SaveGathered(std::string filename, HANDLER handler, bool transpose = false) const;
298 void SaveGathered(std::string filename) const { SaveGathered(filename, ScalarReadSaveHandler(), false); }
299
300 std::ofstream& put(std::ofstream& outfile) const;
301
302 std::shared_ptr<CommGrid> getcommgrid() const { return commGrid; }
303 typename DER::LocalIT getlocalrows() const { return spSeq->getnrow(); }
304 typename DER::LocalIT getlocalcols() const { return spSeq->getncol();}
305 typename DER::LocalIT getlocalnnz() const { return spSeq->getnnz(); }
306 DER & seq() const { return (*spSeq); }
307 DER * seqptr() const { return spSeq; }
308
309 template <typename _BinaryOperation, typename LIT>
310 void SparseCommon(std::vector< std::vector < std::tuple<LIT,LIT,NT> > > & data, LIT locsize, IT total_m, IT total_n, _BinaryOperation BinOp);
311 //void SparseCommon(std::vector< std::vector < std::tuple<typename DER::LocalIT,typename DER::LocalIT,NT> > > & data, typename DER::LocalIT locsize, IT total_m, IT total_n, _BinaryOperation BinOp);
312
313 // @TODO-OGUZ allow different index type for blocked matrices
314 std::vector<std::vector<SpParMat<IT, NT, DER>>>
315 BlockSplit (int br, int bc);
316
317
319 template <typename SR, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
320 friend IU
322
323 template <typename SR, typename NUO, typename UDERO, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
326
327 template <typename SR, typename NUO, typename UDERO, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
330
331 template <typename SR, typename NUO, typename UDERO, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
334
335 template <typename IU, typename NU1, typename NU2, typename UDERA, typename UDERB>
337
338 template <typename SR, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
341
342 template <typename SR, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
345
346 template <typename SR, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
349
350 template <typename SR, typename NUO, typename UDERO, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
353
354 template <typename SR, typename NUO, typename UDERO, typename IU, typename NU1, typename NU2, typename UDERA, typename UDERB>
356 int phases, NUO hardThreshold, IU selectNum, IU recoverNum, NUO recoverPct, int kselectVersion, int computationKernel, int64_t perProcessMem);
357
358 template <typename SR, typename NUO, typename UDERO, typename IU, typename NU1, typename NU2, typename UDERA, typename UDERB>
360 NUO hardThreshold, IU selectNum, IU recoverNum, NUO recoverPct, int kselectVersion, int64_t perProcessMem);
361
362 template <typename SR, typename IU, typename NUM, typename NUV, typename UDER>
365
366 template <typename SR, typename IU, typename NUM, typename NUV, typename UDER>
369
370 template <typename SR, typename IU, typename NUM, typename UDER>
373
374 // output type is part of the signature
375 template <typename SR, typename IVT, typename OVT, typename IU, typename NUM, typename UDER>
377
378 template <typename SR, typename IVT, typename OVT, typename IU, typename NUM, typename UDER>
380
381 template <typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
384
385 template <typename RETT, typename RETDER, typename IU, typename NU1, typename NU2, typename UDERA, typename UDERB, typename _BinaryOperation>
388
389 template <typename RETT, typename RETDER, typename IU, typename NU1, typename NU2, typename UDERA, typename UDERB, typename _BinaryOperation, typename _BinaryPredicate>
392
393 template<typename SR, typename IVT, typename OVT, typename IU, typename NUM, typename UDER>
395 int32_t * & sendindbuf, OVT * & sendnumbuf, int * & sdispls, int * sendcnt, int accnz, bool indexisvalue, PreAllocatedSPA<OVT> & SPA);
396
397 template<typename VT, typename IU, typename UDER>
399
400private:
401 typedef std::array<char, MAXVERTNAME> STRASARRAY;
402 typedef std::pair< STRASARRAY, uint64_t> TYPE2SEND;
403
404 class CharArraySaveHandler
405 {
406 public:
407 // no reader
408 template <typename c, typename t>
409 void save(std::basic_ostream<c,t>& os, STRASARRAY & chararray, int64_t index)
410 {
411 auto locnull = std::find(chararray.begin(), chararray.end(), '\0'); // find the null character (or string::end)
412 std::string strtmp(chararray.begin(), locnull); // range constructor
413 os << strtmp;
414 }
415 };
416
417 MPI_File TupleRead1stPassNExchange (const std::string & filename, TYPE2SEND * & senddata, IT & totsend, FullyDistVec<IT,STRASARRAY> & distmapper, uint64_t & totallength);
418
419 template <typename VT, typename GIT, typename _BinaryOperation, typename _UnaryOperation >
420 void Reduce(FullyDistVec<GIT,VT> & rvec, Dim dim, _BinaryOperation __binary_op, VT id, _UnaryOperation __unary_op, MPI_Op mympiop) const;
421
422
423 template <typename VT, typename GIT> // GIT: global index type of vector
424 void TopKGather(std::vector<NT> & all_medians, std::vector<IT> & nnz_per_col, int & thischunk, int & chunksize,
425 const std::vector<NT> & medians, const std::vector<IT> & nnzperc, int itersuntil, std::vector< std::vector<NT> > & localmat,
426 const std::vector<IT> & actcolsmap, std::vector<IT> & klimits, std::vector<IT> & toretain, std::vector<std::vector<std::pair<IT,NT>>> & tmppair,
427 IT coffset, const FullyDistVec<GIT,VT> & rvec) const;
428
429 void GetPlaceInGlobalGrid(IT& rowOffset, IT& colOffset) const;
430
431 void HorizontalSend(IT * & rows, IT * & cols, NT * & vals, IT * & temprows, IT * & tempcols, NT * & tempvals, std::vector < std::tuple <IT,IT,NT> > & localtuples,
432 int * rcurptrs, int * rdispls, IT buffperrowneigh, int rowneighs, int recvcount, IT m_perproc, IT n_perproc, int rankinrow);
433
434 template <class HANDLER>
435 void ReadAllMine(FILE * binfile, IT * & rows, IT * & cols, NT * & vals, std::vector< std::tuple<IT,IT,NT> > & localtuples, int * rcurptrs, int * ccurptrs, int * rdispls, int * cdispls,
436 IT m_perproc, IT n_perproc, int rowneighs, int colneighs, IT buffperrowneigh, IT buffpercolneigh, IT entriestoread, HANDLER handler, int rankinrow, bool transpose);
437
438 void VerticalSend(IT * & rows, IT * & cols, NT * & vals, std::vector< std::tuple<IT,IT,NT> > & localtuples, int * rcurptrs, int * ccurptrs, int * rdispls, int * cdispls,
439 IT m_perproc, IT n_perproc, int rowneighs, int colneighs, IT buffperrowneigh, IT buffpercolneigh, int rankinrow);
440
441 void AllocateSetBuffers(IT * & rows, IT * & cols, NT * & vals, int * & rcurptrs, int * & ccurptrs, int rowneighs, int colneighs, IT buffpercolneigh);
442 void BcastEssentials(MPI_Comm & world, IT & total_m, IT & total_n, IT & total_nnz, int master);
443
444 std::shared_ptr<CommGrid> commGrid;
445 DER * spSeq;
446
447 template <class IU, class NU>
448 friend class DenseParMat;
449
450 template <typename IU, typename NU, typename UDER>
451 friend std::ofstream& operator<< (std::ofstream& outfile, const SpParMat<IU,NU,UDER> & s);
452};
453
454template <typename SR, typename NUO, typename UDERO, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
456{
458}
459
460template <typename SR, typename IU, typename NU1, typename NU2, typename UDER1, typename UDER2>
461SpParMat<IU,typename promote_trait<NU1,NU2>::T_promote,typename promote_trait<UDER2,UDER2>::T_promote>
462 PSpGEMM (SpParMat<IU,NU1,UDER1> & A, SpParMat<IU,NU2,UDER2> & B, bool clearA = false, bool clearB = false)
463{
464 typedef typename promote_trait<NU1,NU2>::T_promote N_promote;
465 typedef typename promote_trait<UDER1,UDER2>::T_promote DER_promote;
466 return Mult_AnXBn_Synch<SR, N_promote, DER_promote> (A, B, clearA, clearB );
467}
468
469}
470
471
472
473#include "SpParMat.cpp"
474
475#endif
int64_t IT
Definition test.cpp:53
NT read(std::basic_istream< c, t > &is, IT row, IT col)
Definition SpParMat.h:263
void save(std::basic_ostream< c, t > &os, const NT &v, IT row, IT col)
Definition SpParMat.h:271
void binaryfill(FILE *rFile, IT &row, IT &col, NT &val)
Definition SpParMat.h:250
void PruneFull(const FullyDistVec< IT, IT > &ri, const FullyDistVec< IT, IT > &ci)
prune all entries whose row indices are in ri OR column indices are in ci
friend SpParMat< IU, NUO, UDERO > Mult_AnXBn_Overlap(SpParMat< IU, NU1, UDER1 > &A, SpParMat< IU, NU2, UDER2 > &B, bool clearA, bool clearB)
bool Kselect2(FullyDistVec< GIT, VT > &rvec, IT k_limit) const
DER & seq() const
Definition SpParMat.h:306
void EWiseScale(const DenseParMat< IT, NT > &rhs)
void ReadDistribute(const std::string &filename, int master, bool nonum=false, bool pario=false)
Definition SpParMat.h:291
friend SpParMat< IU, typename promote_trait< NU1, NU2 >::T_promote, typename promote_trait< UDER1, UDER2 >::T_promote > Mult_AnXBn_Fence(const SpParMat< IU, NU1, UDER1 > &A, const SpParMat< IU, NU2, UDER2 > &B)
FullyDistVec< IT, std::array< char, MAXVERTNAME > > ReadGeneralizedTuples(const std::string &, _BinaryOperation)
void SaveGathered(std::string filename) const
Definition SpParMat.h:298
void DimApply(Dim dim, const FullyDistVec< IT, NT > &v, _BinaryOperation __binary_op)
FullyDistVec< IT, NT > Reduce(Dim dim, _BinaryOperation __binary_op, NT id, _UnaryOperation __unary_op) const
SpParMat(DER *myseq, MPI_Comm &world)
friend std::ofstream & operator<<(std::ofstream &outfile, const SpParMat< IU, NU, UDER > &s)
SpParMat< IT, NT, DER > PruneI(_UnaryOperation __unary_op, bool inPlace=true)
Definition SpParMat.h:162
SpParMat(IT total_m, IT total_n, const FullyDistVec< IT, IT > &, const FullyDistVec< IT, IT > &, const FullyDistVec< IT, NT > &, bool SumDuplicates=false)
friend void LocalSpMV(const SpParMat< IU, NUM, UDER > &A, int rowneighs, OptBuf< int32_t, OVT > &optbuf, int32_t *&indacc, IVT *&numacc, int32_t *&sendindbuf, OVT *&sendnumbuf, int *&sdispls, int *sendcnt, int accnz, bool indexisvalue, PreAllocatedSPA< OVT > &SPA)
SpParMat(const DistEdgeList< DELIT > &rhs, bool removeloops=true)
friend int64_t EstPerProcessNnzSUMMA(SpParMat< IU, NU1, UDERA > &A, SpParMat< IU, NU2, UDERB > &B, bool hashEstimate)
SpParMat< IT, NT, DER > SubsRefCol(const std::vector< IT > &ci) const
Column indexing with special parallel semantics.
bool operator==(const SpParMat< IT, NT, DER > &rhs) const
friend FullyDistSpVec< IU, typename promote_trait< NUM, NUV >::T_promote > SpMV(const SpParMat< IU, NUM, UDER > &A, const FullyDistSpVec< IU, NUV > &x)
friend void LocalSpMV(const SpParMat< IU, bool, UDER > &A, int rowneighs, OptBuf< int32_t, VT > &optbuf, int32_t *&indacc, VT *&numacc, int *sendcnt, int accnz)
friend SpParMat< IU, typename promote_trait< NU1, NU2 >::T_promote, typename promote_trait< UDER1, UDER2 >::T_promote > Mult_AnXBn_PassiveTarget(const SpParMat< IU, NU1, UDER1 > &A, const SpParMat< IU, NU2, UDER2 > &B)
std::vector< std::vector< SpParMat< IT, NT, DER > > > BlockSplit(int br, int bc)
void ReadDistribute(const std::string &filename, int master, bool nonum, HANDLER handler, bool transpose=false, bool pario=false)
SpParMat(IT total_m, IT total_n, const FullyDistVec< IT, IT > &, const FullyDistVec< IT, IT > &, const NT &, bool SumDuplicates=false)
bool Kselect(FullyDistVec< GIT, VT > &rvec, IT k_limit, int kselectVersion) const
FullyDistVec< IT, NT > Reduce(Dim dim, _BinaryOperation __binary_op, NT id) const
void MaskedReduce(FullyDistVec< GIT, VT > &rvec, FullyDistSpVec< GIT, VT > &mask, Dim dim, _BinaryOperation __binary_op, VT id, bool exclude=false) const
DER::LocalIT LocalIT
Definition SpParMat.h:71
SpParMat(std::ifstream &input, MPI_Comm &world)
SpParMat< IT, NT, DER > PruneColumn(const FullyDistSpVec< IT, NT > &pvals, _BinaryOperation __binary_op, bool inPlace=true)
SpParMat< IT, NT, DER > SubsRef_SR(const FullyDistVec< IT, IT > &v, Dim dim, bool inplace=false)
void EWiseMult(const SpParMat< IT, NT, DER > &rhs, bool exclude)
DER::LocalIT getlocalcols() const
Definition SpParMat.h:304
bool Kselect1(FullyDistSpVec< GIT, VT > &rvec, IT k_limit, _UnaryOperation __unary_op) const
bool Kselect1(FullyDistVec< GIT, VT > &rvec, IT k_limit) const
SpParMat< IT, NT, DER > Prune(_UnaryOperation __unary_op, bool inPlace=true)
Definition SpParMat.h:178
void ActivateThreading(int numsplits)
void Find(FullyDistVec< IT, IT > &, FullyDistVec< IT, IT > &, FullyDistVec< IT, NT > &) const
void PrintInfo() const
float LoadImbalance() const
IT Bandwidth() const
DER::LocalNT LocalNT
Definition SpParMat.h:72
friend SpParMat< IU, NUO, UDERO > Mult_AnXBn_DoubleBuff(SpParMat< IU, NU1, UDER1 > &A, SpParMat< IU, NU2, UDER2 > &B, bool clearA, bool clearB)
void Reduce(FullyDistVec< GIT, VT > &rvec, Dim dim, _BinaryOperation __binary_op, VT id, _UnaryOperation __unary_op) const
void SetDifference(const SpParMat< IT, NT, DER > &rhs)
SpParMat(std::shared_ptr< CommGrid > grid)
SpParMat< IT, NT, DER > SubsRef_SR(const FullyDistVec< IT, IT > &ri, const FullyDistVec< IT, IT > &ci, bool inplace=false)
General indexing with serial semantics.
void SpAsgn(const FullyDistVec< IT, IT > &ri, const FullyDistVec< IT, IT > &ci, SpParMat< IT, NT, DER > &B)
void AddLoops(FullyDistVec< IT, NT > loopvals, bool replaceExisting=false)
bool Kselect(FullyDistSpVec< GIT, VT > &kth, IT k_limit, int kselectVersion) const
SpParMat< IT, NT, DER > & operator+=(const SpParMat< IT, NT, DER > &rhs)
void Dump(std::string filename) const
void UpdateDense(DenseParMat< IT, NT > &rhs, _BinaryOperation __binary_op) const
void Apply(_UnaryOperation __unary_op)
Definition SpParMat.h:148
IT Profile() const
SpParMat(DER *myseq, std::shared_ptr< CommGrid > grid)
void Find(FullyDistVec< IT, IT > &, FullyDistVec< IT, IT > &) const
friend SpParMat< IU, RETT, RETDER > EWiseApply(const SpParMat< IU, NU1, UDERA > &A, const SpParMat< IU, NU2, UDERB > &B, _BinaryOperation __binary_op, bool notB, const NU2 &defaultBVal)
IT getncol() const
friend SpParMat< IU, typename promote_trait< NU1, NU2 >::T_promote, typename promote_trait< UDER1, UDER2 >::T_promote > EWiseMult(const SpParMat< IU, NU1, UDER1 > &A, const SpParMat< IU, NU2, UDER2 > &B, bool exclude)
void AddLoops(NT loopval, bool replaceExisting=false)
void SaveGathered(std::string filename, HANDLER handler, bool transpose=false) const
SpParMat< IT, NT, DER > & operator=(const SpParMat< IT, NT, DER > &rhs)
void ParallelReadMM(const std::string &filename, bool onebased, _BinaryOperation BinOp)
DER::LocalIT getlocalrows() const
Definition SpParMat.h:303
DER::LocalIT getlocalnnz() const
Definition SpParMat.h:305
void ParallelBinaryWrite(std::string filename) const
friend int CalculateNumberOfPhases(SpParMat< IU, NU1, UDERA > &A, SpParMat< IU, NU2, UDERB > &B, NUO hardThreshold, IU selectNum, IU recoverNum, NUO recoverPct, int kselectVersion, int64_t perProcessMem)
Definition ParFriends.h:733
DER * seqptr() const
Definition SpParMat.h:307
bool Kselect1(FullyDistVec< GIT, VT > &rvec, IT k_limit, _UnaryOperation __unary_op) const
void OptimizeForGraph500(OptBuf< LIT, OT > &optbuf)
SpParMat(const SpParMat< IT, NT, DER > &rhs)
friend SpParMat< IU, typename promote_trait< NU1, NU2 >::T_promote, typename promote_trait< UDER1, UDER2 >::T_promote > Mult_AnXBn_ActiveTarget(const SpParMat< IU, NU1, UDER1 > &A, const SpParMat< IU, NU2, UDER2 > &B)
std::ofstream & put(std::ofstream &outfile) const
void ParallelWriteMM(const std::string &filename, bool onebased, HANDLER handler)
SpParMat(MPI_Comm world)
DER InducedSubgraphs2Procs(const FullyDistVec< IT, IT > &Assignments, std::vector< IT > &LocalIdxs) const
void Reduce(FullyDistVec< GIT, VT > &rvec, Dim dim, _BinaryOperation __binary_op, VT id) const
int Owner(IT total_m, IT total_n, IT grow, IT gcol, LIT &lrow, LIT &lcol) const
friend SpParMat< IU, NUO, UDERO > Mult_AnXBn_SUMMA(SpParMat< IU, NU1, UDER1 > &A, SpParMat< IU, NU2, UDER2 > &B, bool clearA, bool clearB)
void PruneColumnByIndex(const FullyDistSpVec< IT, IRRELEVANT_NT > &ci)
SpParMat< IT, NT, DER > PruneColumn(const FullyDistVec< IT, NT > &pvals, _BinaryOperation __binary_op, bool inPlace=true)
friend SpParMat< IU, NUO, UDERO > MemEfficientSpGEMM(SpParMat< IU, NU1, UDERA > &A, SpParMat< IU, NU2, UDERB > &B, int phases, NUO hardThreshold, IU selectNum, IU recoverNum, NUO recoverPct, int kselectVersion, int computationKernel, int64_t perProcessMem)
Definition ParFriends.h:450
std::shared_ptr< CommGrid > getcommgrid() const
Definition SpParMat.h:302
friend IU EstimateFLOP(SpParMat< IU, NU1, UDER1 > &A, SpParMat< IU, NU2, UDER2 > &B, bool clearA, bool clearB)
Friend declarations.
void MaskedReduce(FullyDistVec< GIT, VT > &rvec, FullyDistSpVec< GIT, VT > &mask, Dim dim, _BinaryOperation __binary_op, VT id, _UnaryOperation __unary_op, bool exclude=false) const
SpParMat< IT, NT, DER > operator()(const FullyDistVec< IT, IT > &ri, const FullyDistVec< IT, IT > &ci, bool inplace=false)
Definition SpParMat.h:228
void Prune(const FullyDistVec< IT, IT > &ri, const FullyDistVec< IT, IT > &ci)
prune all entries whose row indices are in ri AND column indices are in ci
void ParallelWriteMM(const std::string &filename, bool onebased)
Definition SpParMat.h:282
IT getnrow() const
void SparseCommon(std::vector< std::vector< std::tuple< LIT, LIT, NT > > > &data, LIT locsize, IT total_m, IT total_n, _BinaryOperation BinOp)
friend SpParMat< IU, NUO, UDERO > Mult_AnXBn_Synch(SpParMat< IU, NU1, UDER1 > &A, SpParMat< IU, NU2, UDER2 > &B, bool clearA, bool clearB)
long int64_t
Definition compat.h:21
void PSpGEMM(SpParMat< IU, NU1, UDER1 > &A, SpParMat< IU, NU2, UDER2 > &B, SpParMat< IU, NUO, UDERO > &out, bool clearA=false, bool clearB=false)
Definition SpParMat.h:455
double A
signed int int32_t
Definition stdint.h:77