"git@developer.sourcefind.cn:OpenDAS/ktransformers.git" did not exist on "a456e25a54f80b1b83d554b8f4deef14765d7cc4"
Unverified Commit 7d19b33c authored by mozga-intel's avatar mozga-intel Committed by GitHub
Browse files

OMP pragma was added to support hetero_graph loop. (#2148)



* 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: default avatarZihao Ye <expye@outlook.com>
parent 8a4520d5
...@@ -605,7 +605,10 @@ DGL_REGISTER_GLOBAL("heterograph_index._CAPI_DGLHeteroCreateFormat") ...@@ -605,7 +605,10 @@ DGL_REGISTER_GLOBAL("heterograph_index._CAPI_DGLHeteroCreateFormat")
.set_body([] (DGLArgs args, DGLRetValue* rv) { .set_body([] (DGLArgs args, DGLRetValue* rv) {
HeteroGraphRef hg = args[0]; HeteroGraphRef hg = args[0];
dgl_format_code_t code = hg->GetRelationGraph(0)->GetAllowedFormats(); 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)); auto bg = std::dynamic_pointer_cast<UnitGraph>(hg->GetRelationGraph(etype));
for (auto format : CodeToSparseFormats(code)) for (auto format : CodeToSparseFormats(code))
bg->GetFormat(format); bg->GetFormat(format);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment