[XPU][Tests] Make tests device-agnostic (#51968)
Signed-off-by: pmanczak <pawel.manczak@intel.com>
This commit is contained in:
+6
-7
@@ -284,19 +284,18 @@ def cleanup_fixture(should_do_global_cleanup_after_test: bool):
|
||||
def workspace_init():
|
||||
"""Initialize the workspace manager for tests that need it.
|
||||
|
||||
This fixture initializes the workspace manager with a CUDA device
|
||||
if available, and resets it after the test completes. Tests that
|
||||
create a full vLLM engine should NOT use this fixture as the engine
|
||||
will initialize the workspace manager itself.
|
||||
This fixture initializes the workspace manager with the current
|
||||
platform's accelerator device if available, and resets it after the test
|
||||
completes. Tests that create a full vLLM engine should NOT use this
|
||||
fixture as the engine will initialize the workspace manager itself.
|
||||
"""
|
||||
from vllm.v1.worker.workspace import (
|
||||
init_workspace_manager,
|
||||
reset_workspace_manager,
|
||||
)
|
||||
|
||||
if torch.cuda.is_available():
|
||||
device = torch.device("cuda:0")
|
||||
init_workspace_manager(device)
|
||||
if torch.accelerator.is_available():
|
||||
init_workspace_manager(torch.device(0))
|
||||
yield
|
||||
reset_workspace_manager()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user