Skip to content

Commit

Permalink
OMP pragma was added to support hetero_graph loop. (dmlc#2148)
Browse files Browse the repository at this point in the history
* OMP pragma was added to support hetero_graph loop, as follows:
pragma omp parallel for

* OMP pragma will be enabled iff the gpu is used for

Co-authored-by: Zihao Ye <[email protected]>
  • Loading branch information
mozga-intel and yzh119 authored Oct 9, 2020
1 parent 8a4520d commit 7d19b33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/graph/heterograph_capi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,10 @@ DGL_REGISTER_GLOBAL("heterograph_index._CAPI_DGLHeteroCreateFormat")
.set_body([] (DGLArgs args, DGLRetValue* rv) {
HeteroGraphRef hg = args[0];
dgl_format_code_t code = hg->GetRelationGraph(0)->GetAllowedFormats();
for (dgl_type_t etype = 0; etype < hg->NumEdgeTypes(); ++etype) {
#if !defined(DGL_USE_CUDA)
#pragma omp parallel for
#endif
for (int64_t etype = 0; etype < hg->NumEdgeTypes(); ++etype) {
auto bg = std::dynamic_pointer_cast<UnitGraph>(hg->GetRelationGraph(etype));
for (auto format : CodeToSparseFormats(code))
bg->GetFormat(format);
Expand Down

0 comments on commit 7d19b33

Please sign in to comment.