-
Notifications
You must be signed in to change notification settings - Fork 110
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
Multiply sparse matrices #132
Changes from 28 commits
46a0501
ecab33b
114ea14
e08607b
babba77
8e04d35
70c8108
83812d9
c78c650
2dbc810
17ef6b6
8b85694
b18c7e5
418f3b6
dbb84c8
e07bcdb
8cd5636
9842229
a43cb33
edfda9e
adf8f2c
32571ce
c762c2a
04e78df
2f6048e
0a15f61
1a83151
a1e8579
2ead9d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,7 +235,7 @@ class DistMatrix; | |
#include <El/core/Matrix/decl.hpp> | ||
#include <El/core/Graph/decl.hpp> | ||
#include <El/core/DistMap/decl.hpp> | ||
#include <El/core/DistGraph/decl.hpp> | ||
#include <El/core/DistGraph.hpp> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why include DistGraph.hpp rather than DistGraph/decl.hpp? |
||
#include <El/core/SparseMatrix/decl.hpp> | ||
#include <El/core/DistSparseMatrix/decl.hpp> | ||
#include <El/core/DistMultiVec/decl.hpp> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,45 @@ | |
|
||
namespace El { | ||
|
||
struct DistGraphMultMeta | ||
{ | ||
bool ready; | ||
// NOTE: The 'send' and 'recv' roles reverse for adjoint multiplication | ||
Int numRecvInds; | ||
vector<int> sendSizes, sendOffs, | ||
recvSizes, recvOffs; | ||
vector<Int> sendInds, colOffs; | ||
|
||
DistGraphMultMeta() : ready(false), numRecvInds(0) { } | ||
|
||
void Clear() | ||
{ | ||
ready = false; | ||
numRecvInds = 0; | ||
SwapClear( sendSizes ); | ||
SwapClear( recvSizes ); | ||
SwapClear( sendOffs ); | ||
SwapClear( recvOffs ); | ||
SwapClear( sendInds ); | ||
SwapClear( colOffs ); | ||
} | ||
|
||
const DistGraphMultMeta& operator=( const DistGraphMultMeta& meta ) | ||
{ | ||
ready = meta.ready; | ||
numRecvInds = meta.numRecvInds; | ||
sendSizes = meta.sendSizes; | ||
sendOffs = meta.sendOffs; | ||
recvSizes = meta.recvSizes; | ||
recvOffs = meta.recvOffs; | ||
sendInds = meta.sendInds; | ||
colOffs = meta.colOffs; | ||
return *this; | ||
} | ||
}; | ||
|
||
|
||
|
||
using std::set; | ||
|
||
// Forward declare ldl::DistFront | ||
|
@@ -134,6 +173,10 @@ class DistGraph | |
// total number of edges divided by the number of processes | ||
double Imbalance() const EL_NO_RELEASE_EXCEPT; | ||
|
||
mutable DistGraphMultMeta multMeta; | ||
DistGraphMultMeta InitializeMultMeta() const; | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the extra line of white space? |
||
void AssertConsistent() const; | ||
void AssertLocallyConsistent() const; | ||
|
||
|
@@ -170,4 +213,4 @@ class DistGraph | |
|
||
} // namespace El | ||
|
||
#endif // ifndef EL_CORE_DISTGRAPH_DECL_HPP | ||
#endif // ifndef EL_CORE_DISTGRAPH_HPP |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,44 +11,8 @@ | |
#ifndef EL_CORE_DISTSPARSEMATRIX_DECL_HPP | ||
#define EL_CORE_DISTSPARSEMATRIX_DECL_HPP | ||
|
||
namespace El { | ||
namespace El { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the extra single space? |
||
|
||
struct DistSparseMultMeta | ||
{ | ||
bool ready; | ||
// NOTE: The 'send' and 'recv' roles reverse for adjoint multiplication | ||
Int numRecvInds; | ||
vector<int> sendSizes, sendOffs, | ||
recvSizes, recvOffs; | ||
vector<Int> sendInds, colOffs; | ||
|
||
DistSparseMultMeta() : ready(false), numRecvInds(0) { } | ||
|
||
void Clear() | ||
{ | ||
ready = false; | ||
numRecvInds = 0; | ||
SwapClear( sendSizes ); | ||
SwapClear( recvSizes ); | ||
SwapClear( sendOffs ); | ||
SwapClear( recvOffs ); | ||
SwapClear( sendInds ); | ||
SwapClear( colOffs ); | ||
} | ||
|
||
const DistSparseMultMeta& operator=( const DistSparseMultMeta& meta ) | ||
{ | ||
ready = meta.ready; | ||
numRecvInds = meta.numRecvInds; | ||
sendSizes = meta.sendSizes; | ||
sendOffs = meta.sendOffs; | ||
recvSizes = meta.recvSizes; | ||
recvOffs = meta.recvOffs; | ||
sendInds = meta.sendInds; | ||
colOffs = meta.colOffs; | ||
return *this; | ||
} | ||
}; | ||
|
||
// Use a simple 1d distribution where each process owns a fixed number of rows, | ||
// if last process, height - (commSize-1)*floor(height/commSize) | ||
|
@@ -194,8 +158,7 @@ class DistSparseMatrix | |
// total number of nonzeros divided by the number of processes | ||
double Imbalance() const EL_NO_RELEASE_EXCEPT; | ||
|
||
mutable DistSparseMultMeta multMeta; | ||
DistSparseMultMeta InitializeMultMeta() const; | ||
DistGraphMultMeta InitializeMultMeta() const; | ||
|
||
void MappedSources | ||
( const DistMap& reordering, vector<Int>& mappedSources ) const; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think because a few lines early we issue:
B.distGraph_ = A.distGraph_;
which assigns the multMeta objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, agreed.