-
Notifications
You must be signed in to change notification settings - Fork 44
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
[WIP] Graph Concepts and Containers #634
base: development
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## development #634 +/- ##
===============================================
+ Coverage 85.08% 85.74% +0.65%
===============================================
Files 336 355 +19
Lines 24954 26570 +1616
Branches 11338 12040 +702
===============================================
+ Hits 21232 22782 +1550
- Misses 3692 3771 +79
+ Partials 30 17 -13
|
@stiefn @fuerlinger @rkowalewski @devreal @pascalj Graph containers and algorithms are fully merged now, including tests and examples. Relevant implementation is in:
Integration tests passed, but could use some more unit tests. Still, I'm voting for merging it into development, that's what the branch is about. |
I will give the review a try tomorrow on the train. |
typedef Vertex<self_t> vertex_type; | ||
typedef Edge<self_t> edge_type; | ||
|
||
typedef std::vector<vertex_type> vertex_container_type; |
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 is _VertexContainer
not used? Same for edge_container_type
.
typename EdgeProperties = EmptyProperties, // user-defined struct | ||
typename VertexSizeType = int, | ||
typename EdgeSizeType = int, | ||
//template<class, class...> typename EdgeContainer = std::vector, |
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.
remove dead code
typename EdgeSizeType = int, | ||
//template<class, class...> typename EdgeContainer = std::vector, | ||
//template<class, class...> typename VertexContainer = std::vector | ||
template<class, class...> class _EdgeContainer = std::vector, |
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.
order is reversed, above its always vertex, than edge, here it is edge, than vertex
GraphDirection Direction = DirectedGraph, | ||
typename VertexProperties = EmptyProperties, // user-defined struct | ||
typename EdgeProperties = EmptyProperties, // user-defined struct | ||
typename VertexSizeType = int, |
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.
enforce an unsigned type
/** | ||
* Removes a given vertex. | ||
*/ | ||
void remove_vertex(const local_vertex_iterator & v) { |
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.
unimplemented
/** | ||
* Removes the edges between two given vertices. | ||
*/ | ||
void remove_edge(const local_vertex_iterator & v1, |
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.
unimplemented
/** | ||
* Removes the edges between two given vertices. | ||
*/ | ||
void remove_edge(const global_vertex_iterator & v1, |
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.
unimplemented
/** | ||
* Removes a given edge. | ||
*/ | ||
void remove_edge(const local_out_edge_iterator & e) { |
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.
unimplemented
/** | ||
* Removes a given edge. | ||
*/ | ||
void remove_edge(const global_out_edge_iterator & e) { |
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.
unimplemented
} | ||
*/ | ||
|
||
// TODO: Generalize following methods for other edge attributes than { int } |
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.
does this limit the usability of the whole Graph, or are these just convenience functions for the user? I.e, they are not used by the implementation itself?
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 cannot claim to have read every line of code but overall I think the PR is in a good shape already. Documentation is rather scarce imo and can be improved. I see some code duplication that maybe can be avoided. Some minor and not-so-minor comments inline. Also, please add an entry to the CHANGELOG
:)
"dart_adapt_teamlist_convert failed", teamid); | ||
return DART_ERR_INVAL; | ||
} | ||
if (sendbuf == recvbuf || NULL == sendbuf) { |
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.
Please be consistent with the change in dart_allgatherv
above.
@@ -2168,6 +2168,150 @@ dart_ret_t dart_allgatherv( | |||
return DART_OK; | |||
} | |||
|
|||
#if 0 |
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 is it disabled?
int *isenddispls = malloc(sizeof(int) * comm_size); | ||
int *inrecvcounts = malloc(sizeof(int) * comm_size); | ||
int *irecvdispls = malloc(sizeof(int) * comm_size); | ||
for (int i = 0; i < comm_size; i++) { |
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.
This conversion (size_t
-> int
) pains me. It would be good to extract it and use a common implementation everywhere.
|
||
typedef dash::Graph<dash::DirectedGraph, vprop, eprop> graph_t; | ||
|
||
int main(int argc, char* argv[]) { |
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.
Not a single comment in this file. Please document what the example does and maybe add some comments to the code, too.
} | ||
|
||
if(dash::myid() == 0) { | ||
std::clock_t g_begin_time = clock(); |
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.
Don't we have dash::Timer
for this?
|
||
namespace dash { | ||
|
||
/** |
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.
Since this is internal/Graph.h
the classes in here should be put into the dash::internal
namespace.
*/ | ||
void add_globmem(glob_mem_type & glob_mem) { | ||
// only GlobMem objects with the same Team can be used | ||
if(*_team == glob_mem.team()) { |
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.
Should there be an error otherwise?
global_iterator _begin; | ||
global_iterator _end; | ||
local_iterator _lbegin; | ||
local_iterator _lend; |
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.
The iterators are in an undefined state before the first commit
call. Is this acceptable?
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.
Of course not, good catch.
namespace dash { | ||
|
||
// TODO: Remove this class and add template parameter for bucket list type to | ||
// GlobHeapLocalPtr |
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.
Is this easy to do before merging?
|
||
TEST_F(ConnectedComponentsTest, AlgorithmRun) | ||
{ | ||
std::list<std::pair<int, int>> edge_list = { |
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.
Just out of curiosity: how was this generated (please tell me not by hand ;)) and can we generate it on the fly?
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.
It's from a graph sample data set, @stiefn should know more.
As the STL has no equivalent, I defined the DASH graph concepts following the Boost Graph Library (BGL).
In his Master thesis, @stiefn refined and extended concepts for several peculiarities and requirements of PGAS and DASH.
This merge contains his reference implementation. Merging current development was surprisingly non-conflicting.
The implementation proved stable and effizient in several productive scenarios like BFS and Connected Components.
Missing: more unit tests, review, some suggestions for improvement in comments here and there.