Skip to content
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

Try to update graph then run sssp on new graph #1033

Open
Yongze-zzz opened this issue Jan 13, 2023 · 7 comments
Open

Try to update graph then run sssp on new graph #1033

Yongze-zzz opened this issue Jan 13, 2023 · 7 comments
Labels
🍍 algorithms New or existing graph algorithms question. 🚂 operators Looking/Adding a new operator or a core functionality to an existing operator?

Comments

@Yongze-zzz
Copy link

Dear author!I tried to use the dynamic graph API to update the original graph and run sssp on the new graph.The important codes like below.
First,there is a graph with type:
1673607470245
So that the orginal graph: GraphT graph could using like: auto &graph_csr = graph.csr(),and auto &dyn_graph = graph.dyn();.
Is the dynamic graph constructed by default when loading the original graph?The output is dyn_graph.nodes = 4.
Next question is, after InsertEdgesBatch like below:
image
the dynamic graph seems like not be updated. Did I call the API in the right way?
Hope for u reply ,thanks

@Yongze-zzz Yongze-zzz added 🍍 algorithms New or existing graph algorithms question. 🚂 operators Looking/Adding a new operator or a core functionality to an existing operator? labels Jan 13, 2023
@maawad
Copy link
Member

maawad commented Jan 13, 2023

Hi @Yongze-zzz, We don't update any host-side graph metadata but there is an internal graph iterator that is used to access the graph. If you want to update the graph, please follow the example here. If you want to implement SSSP, please use "SIMPLE" advance mode and see example here and here.

Another example for loading Matrix Market graph

@Yongze-zzz
Copy link
Author

Hi @Yongze-zzz, We don't update any host-side graph metadata but there is an internal graph iterator that is used to access the graph. If you want to update the graph, please follow the example here. If you want to implement SSSP, please use "SIMPLE" advance mode and see example here and here.

Another example for loading Matrix Market graph

Thanks for your reply! I have reproduced the graph updated phase and simple advance operator according to your example. As the simple advance operator, we construct an edge iterator that scans the entire adjacency list of the vertex like the code below in advance_base.cuh .
1673754281076
But the kernel function GetEdgeCounts runs only one time.I am not sure the graph was updated because of the outpu imformation.
The advance src is 1, matrix graph is gunrock/dataset/small/tree.mtx.Then I inserted only one edge: src 1->dst 3.
image

@maawad
Copy link
Member

maawad commented Jan 15, 2023

Is the graph input to the GetEdgeCounts kernel CSR? We don't update the CSR graph if you update the dynamic one. If you want an updated CSR graph, then you need to explicitly ask for that like this:

auto& result_csr_graph = result_graph.csr();
result_csr_graph.Allocate(nodes, new_edges_count, util::HOST | util::DEVICE);
result_dynamic_graph.ToCsr(result_csr_graph);

Then you can run any advance on that CSR graph (not just the SIMPLE one).

But you don't need to convert back to CSR if you want to run SSSP on a dynamic graph. You can 1) follow the example here to load and update the graph, then 2) add the SSSP code with the main difference being changing GraphT to WeightedDynT.

typedef typename app::TestGraph<VertexT, SizeT, ValueT,
graph::HAS_EDGE_VALUES | graph::HAS_CSR>
GraphT;

to

using WeightedDynT =
app::TestGraph<VertexT, SizeT, ValueT,
graph::HAS_EDGE_VALUES | graph::HAS_DYN>;

And finally, specify the advance mode on the command line using the flag --advance-mode=SIMPLE.

This would be a valuable contribution, so please fork and share your code, if possible, and I will be happy to help you resolve any issues.

@Yongze-zzz
Copy link
Author

Yongze-zzz commented Feb 3, 2023

1675488023181
Hello author!
I've forked your dynamic-graph branch and modify some code(https://github.com/Yongze-zzz/gunrock/tree/dynamic-graph) .You could clone the code and take a look, the codes implemented dynamic graph update,but when I try to run sssp algorithm by calling advance operation on graph.dyn() ,there is a compile error like below.
1675416252418

I modified /examples/test_sssp.cu by call sssp_app.cu and you could run it by command "./bin/sssp --src 0 market ../dataset/small/test_sssp.mtx --advance-mode SIMPLE".I look forward to your reply.Thanks!

@maawad
Copy link
Member

maawad commented Feb 8, 2023

Thanks, @Yongze-zzz, for adding the SSSP code! I tried your code, and I saw the compilation error you reported. There was another error about PairT not being defined, but that was easy to fix.
I will look into the FLAG error as soon as possible; it should be easy to fix.

@Yongze-zzz
Copy link
Author

Dear authors , the FLAG error I have been fixed by commented out gunrock_sssp function. But when I try to delete edges on directed graph, there is an complie error : /gunrock/gunrock/graph/dynamic_graph/kernels/map/delete.cuh(41): error: no instance of overloaded function "atomicSub" matches the argument list ,could you provide some suggestion to me to solve to prolem. Appreciate!

@maawad
Copy link
Member

maawad commented Feb 22, 2023

Hi @Yongze-zzz, Thanks for debugging that compile error. I think that function is not necessary now. I also removed it, made a few changes, and successfully compiled the code. Could you send me an email at mawad@ucdavis.edu so we can coordinate how to share these changes with your fork?

Do you mind pushing your changes so I can see the bug you are running into?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍍 algorithms New or existing graph algorithms question. 🚂 operators Looking/Adding a new operator or a core functionality to an existing operator?
Projects
None yet
Development

No branches or pull requests

2 participants