Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
40506ecc
Unverified
Commit
40506ecc
authored
Dec 05, 2018
by
Da Zheng
Committed by
GitHub
Dec 05, 2018
Browse files
use openmp to accelerate nid mapping (#242)
* use openmp. * update cmake.
parent
378c2645
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
CMakeLists.txt
CMakeLists.txt
+4
-0
src/graph/graph_op.cc
src/graph/graph_op.cc
+2
-0
No files found.
CMakeLists.txt
View file @
40506ecc
...
@@ -77,6 +77,10 @@ else(MSVC)
...
@@ -77,6 +77,10 @@ else(MSVC)
check_cxx_compiler_flag
(
"-std=c++11"
SUPPORT_CXX11
)
check_cxx_compiler_flag
(
"-std=c++11"
SUPPORT_CXX11
)
set
(
CMAKE_C_FLAGS
"-O2 -Wall -fPIC
${
CMAKE_C_FLAGS
}
"
)
set
(
CMAKE_C_FLAGS
"-O2 -Wall -fPIC
${
CMAKE_C_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"-O2 -Wall -fPIC -std=c++11
${
CMAKE_CXX_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"-O2 -Wall -fPIC -std=c++11
${
CMAKE_CXX_FLAGS
}
"
)
if
(
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Linux"
)
set
(
CMAKE_C_FLAGS
"-fopenmp
${
CMAKE_C_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"-fopenmp
${
CMAKE_CXX_FLAGS
}
"
)
endif
()
endif
(
MSVC
)
endif
(
MSVC
)
# add source group
# add source group
...
...
src/graph/graph_op.cc
View file @
40506ecc
...
@@ -116,6 +116,7 @@ IdArray GraphOp::MapParentIdToSubgraphId(IdArray parent_vids, IdArray query) {
...
@@ -116,6 +116,7 @@ IdArray GraphOp::MapParentIdToSubgraphId(IdArray parent_vids, IdArray query) {
const
bool
is_sorted
=
std
::
is_sorted
(
parent_data
,
parent_data
+
parent_len
);
const
bool
is_sorted
=
std
::
is_sorted
(
parent_data
,
parent_data
+
parent_len
);
if
(
is_sorted
)
{
if
(
is_sorted
)
{
#pragma omp parallel for
for
(
int64_t
i
=
0
;
i
<
query_len
;
i
++
)
{
for
(
int64_t
i
=
0
;
i
<
query_len
;
i
++
)
{
const
dgl_id_t
id
=
query_data
[
i
];
const
dgl_id_t
id
=
query_data
[
i
];
const
auto
it
=
std
::
find
(
parent_data
,
parent_data
+
parent_len
,
id
);
const
auto
it
=
std
::
find
(
parent_data
,
parent_data
+
parent_len
,
id
);
...
@@ -132,6 +133,7 @@ IdArray GraphOp::MapParentIdToSubgraphId(IdArray parent_vids, IdArray query) {
...
@@ -132,6 +133,7 @@ IdArray GraphOp::MapParentIdToSubgraphId(IdArray parent_vids, IdArray query) {
const
dgl_id_t
id
=
parent_data
[
i
];
const
dgl_id_t
id
=
parent_data
[
i
];
parent_map
[
id
]
=
i
;
parent_map
[
id
]
=
i
;
}
}
#pragma omp parallel for
for
(
int64_t
i
=
0
;
i
<
query_len
;
i
++
)
{
for
(
int64_t
i
=
0
;
i
<
query_len
;
i
++
)
{
const
dgl_id_t
id
=
query_data
[
i
];
const
dgl_id_t
id
=
query_data
[
i
];
auto
it
=
parent_map
.
find
(
id
);
auto
it
=
parent_map
.
find
(
id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment