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
c94d2a5f
Unverified
Commit
c94d2a5f
authored
Oct 12, 2023
by
Andrzej Kotłowski
Committed by
GitHub
Oct 12, 2023
Browse files
[Performance] Do not fuse neighbor sampler for 1 thread (#6421)
parent
ad4df9c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
python/dgl/dataloading/neighbor_sampler.py
python/dgl/dataloading/neighbor_sampler.py
+4
-2
No files found.
python/dgl/dataloading/neighbor_sampler.py
View file @
c94d2a5f
...
@@ -3,6 +3,7 @@ from .. import backend as F
...
@@ -3,6 +3,7 @@ from .. import backend as F
from
..base
import
EID
,
NID
from
..base
import
EID
,
NID
from
..heterograph
import
DGLGraph
from
..heterograph
import
DGLGraph
from
..transforms
import
to_block
from
..transforms
import
to_block
from
..utils
import
get_num_threads
from
.base
import
BlockSampler
from
.base
import
BlockSampler
...
@@ -150,8 +151,9 @@ class NeighborSampler(BlockSampler):
...
@@ -150,8 +151,9 @@ class NeighborSampler(BlockSampler):
def
sample_blocks
(
self
,
g
,
seed_nodes
,
exclude_eids
=
None
):
def
sample_blocks
(
self
,
g
,
seed_nodes
,
exclude_eids
=
None
):
output_nodes
=
seed_nodes
output_nodes
=
seed_nodes
blocks
=
[]
blocks
=
[]
# sample_neighbors_fused function requires multithreading to be more efficient
if
self
.
fused
:
# than sample_neighbors
if
self
.
fused
and
get_num_threads
()
>
1
:
cpu
=
F
.
device_type
(
g
.
device
)
==
"cpu"
cpu
=
F
.
device_type
(
g
.
device
)
==
"cpu"
if
isinstance
(
seed_nodes
,
dict
):
if
isinstance
(
seed_nodes
,
dict
):
for
ntype
in
list
(
seed_nodes
.
keys
()):
for
ntype
in
list
(
seed_nodes
.
keys
()):
...
...
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