-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix memory utils organization (#2990)
Summary: Pull Request resolved: #2990 X-link: facebookresearch/FBGEMM#83 - Fix memory utils organization to expose new_unified_tensor op in CPU-only mode in OSS Reviewed By: spcyppt Differential Revision: D61291513 fbshipit-source-id: 1b4a3582ff6240896d4cb529056c5ea7e2391a7b
- Loading branch information
1 parent
7105d5f
commit 6d3c2fe
Showing
10 changed files
with
98 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# pyre-strict | ||
# pyre-ignore-all-errors[56] | ||
|
||
import unittest | ||
|
||
import fbgemm_gpu | ||
import hypothesis.strategies as st | ||
import torch | ||
from hypothesis import given, settings | ||
|
||
# pyre-fixme[16]: Module `fbgemm_gpu` has no attribute `open_source`. | ||
open_source: bool = getattr(fbgemm_gpu, "open_source", False) | ||
|
||
if open_source: | ||
# pyre-ignore[21] | ||
from test_utils import cpu_and_maybe_gpu, TestSuite | ||
else: | ||
from fbgemm_gpu.test.test_utils import cpu_and_maybe_gpu, TestSuite | ||
|
||
|
||
class OpsLoadTest(TestSuite): # pyre-ignore[11] | ||
@given( | ||
device=cpu_and_maybe_gpu(), | ||
host_mapped=st.booleans(), | ||
) | ||
@settings(deadline=None) | ||
def test_cpu_ops(self, device: torch.device, host_mapped: bool) -> None: | ||
with self.assertNotRaised(Exception): # pyre-ignore[16] | ||
torch.ops.fbgemm.new_unified_tensor( | ||
torch.zeros(1, device=device, dtype=torch.float), | ||
[1000], | ||
host_mapped, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |