forked from pytorch/glow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable switching Glow backend (pytorch#3698)
Summary: Creates a new HostManager for the given Glow backend and graphs fused afterwards will be fused for the HostManager containing devices of the given type. Previously fused nodes may contain shared references to previously created HostManager instances so these will only be destroyed if the PT graphs containing those nodes are destroyed to prevent invalidation of previously fused graph. Documentation: doxygen Pull Request resolved: pytorch#3698 Test Plan: added unit test Differential Revision: D18265179 Pulled By: jackm321 fbshipit-source-id: 03404ccde041a0801d7eeef7960e1388f9ebb008
- Loading branch information
1 parent
5b89f3d
commit 3d1caf9
Showing
4 changed files
with
93 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
import torch_glow | ||
|
||
|
||
def test_set_glow_backend(): | ||
"""Test setting the Glow backend type""" | ||
|
||
backend_name_before = torch_glow.getGlowBackendName() | ||
backend_num_devices_before = torch_glow.getGlowBackendNumDevices() | ||
|
||
torch_glow.setGlowBackend("CPU", 4) | ||
|
||
assert(torch_glow.getGlowBackendName() == "CPU") | ||
assert(torch_glow.getGlowBackendNumDevices() == 4) | ||
|
||
# reset everything | ||
torch_glow.setGlowBackend(backend_name_before, backend_num_devices_before) |