-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'leofang/cluster' into HEAD
- Loading branch information
Showing
16 changed files
with
220 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ jobs: | |
upload-enabled: | ||
- false | ||
python-version: | ||
- "3.13" | ||
- "3.12" | ||
- "3.11" | ||
- "3.10" | ||
|
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
# | ||
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE | ||
|
||
__version__ = "0.1.0" | ||
__version__ = "0.1.1" |
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,67 @@ | ||
# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED. | ||
# | ||
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE | ||
|
||
from typing import Tuple | ||
|
||
from cuda import cuda, cudart | ||
from cuda.core.experimental._device import Device | ||
from cuda.core.experimental._utils import handle_return | ||
|
||
|
||
class System: | ||
"""Provide information about the cuda system. | ||
This class is a singleton and should not be instantiated directly. | ||
""" | ||
|
||
_instance = None | ||
|
||
def __new__(cls): | ||
if cls._instance is None: | ||
cls._instance = super().__new__(cls) | ||
return cls._instance | ||
|
||
def __init__(self): | ||
if hasattr(self, "_initialized") and self._initialized: | ||
return | ||
self._initialized = True | ||
|
||
@property | ||
def driver_version(self) -> Tuple[int, int]: | ||
""" | ||
Query the CUDA driver version. | ||
Returns | ||
------- | ||
tuple of int | ||
A 2-tuple of (major, minor) version numbers. | ||
""" | ||
version = handle_return(cuda.cuDriverGetVersion()) | ||
major = version // 1000 | ||
minor = (version % 1000) // 10 | ||
return (major, minor) | ||
|
||
@property | ||
def num_devices(self) -> int: | ||
""" | ||
Query the number of available GPUs. | ||
Returns | ||
------- | ||
int | ||
The number of available GPU devices. | ||
""" | ||
return handle_return(cudart.cudaGetDeviceCount()) | ||
|
||
@property | ||
def devices(self) -> tuple: | ||
""" | ||
Query the available device instances. | ||
Returns | ||
------- | ||
tuple of Device | ||
A tuple containing instances of available devices. | ||
""" | ||
total = self.num_devices | ||
return tuple(Device(device_id) for device_id in range(total)) |
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 |
---|---|---|
|
@@ -7,4 +7,5 @@ maxdepth: 3 | |
0.1.1 <release/0.1.1-notes> | ||
0.1.0 <release/0.1.0-notes> | ||
``` |
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
Oops, something went wrong.