Skip to content

Commit

Permalink
[GraphBolt][CUDA] Skip in-place pinning tests on WSL. (#7517)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfbalin authored Jul 12, 2024
1 parent eb352e9 commit 945247e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
14 changes: 14 additions & 0 deletions python/dgl/graphbolt/internal_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Miscallenous internal utils."""
import functools
import hashlib
import os
import platform
import warnings
from collections.abc import Mapping, Sequence

Expand All @@ -15,6 +17,18 @@
from setuptools.extern.packaging import version


@functools.lru_cache(maxsize=None)
def is_wsl(v: str = platform.uname().release) -> int:
"""Detects if Python is running in WSL"""

if v.endswith("-Microsoft"):
return 1
elif v.endswith("microsoft-standard-WSL2"):
return 2

return 0


# pylint: disable=invalid-name
_default_formatwarning = warnings.formatwarning

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,9 @@ def test_csc_sampling_graph_to_device(device):
F._default_context_str == "cpu",
reason="Tests for pinned memory are only meaningful on GPU.",
)
@unittest.skipIf(
gb.is_wsl(), reason="In place pinning is not supported on WSL."
)
def test_csc_sampling_graph_to_pinned_memory():
# Construct FusedCSCSamplingGraph.
graph = create_fused_csc_sampling_graph()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
import tempfile
import unittest
from functools import reduce
from operator import mul

import backend as F

Expand Down Expand Up @@ -216,6 +214,8 @@ def test_torch_based_pinned_feature(dtype, idtype, shape, in_place):

feature = gb.TorchBasedFeature(tensor)
if in_place:
if gb.is_wsl():
pytest.skip("In place pinning is not supported on WSL.")
feature.pin_memory_()

# Check if pinning is truly in-place.
Expand Down

0 comments on commit 945247e

Please sign in to comment.