Skip to main content

cuda_available

A package for checking available CUDA device information

GitHub License PyPI - Version GitHub Workflow Status (with event)

Usage

Basic usage

from cuda_available import *

cnt = getCudaDeviceCount()
print(f"Cuda device count: {cnt}")
for idx in range(cnt):
    print(CudaDeviceInfo(idx))

Get count of cuda device

from cuda_available import *

cnt = getCudaDeviceCount()
print(f"Cuda device count: {cnt}")

Check if cuda init successful

from cuda_available import *

state = "Succeed" if isCudaInitSuccess() else "Failed"
print(f"Cuda init state: {state}")

Get CUDA driver version

from cuda_available import *

version = cudaDriverVersion()
print(f"Cuda driver version: {version}")

Get infomation of cuda device

from cuda_available import *

cnt = getCudaDeviceCount()
for idx in range(cnt):
    info = CudaDeviceInfo(idx)
    print(f"UUID: {info.uuid}")
    print(f"Name: {info.name}")
    print(f"ComputeCapability: {info.computeCapability}")
    print(f"TotalGlobalVmem: {info.totalGlobalVmem}")
    print(f"PciId: {info.pciId}")
    print(f"UsingTccDriver: {info.isTccDriver}")
    print("===================================")

Advanced usage

Get more cuda attribute

from cuda_available import *

cnt = getCudaDeviceCount()
for idx in range(cnt):
    info = CudaDeviceInfo(idx)
    mem_clock_rate = info.getAttr(CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE)
    print(f"The memory clock rate is {mem_clock_rate / 1000 / 1000} GHz")

Using custom cuda lib name

Warning: This situation is very rare, please do so when making sure you know what you are doing

from cuda_available import *

# if you are using windows, it will search for <cuda_lib_name>.dll
# if you are using linux, it will search for [lib]<cuda_lib_name>.so[.X]
setCudaDylibName("cuda_lib_name")

cnt = getCudaDeviceCount()
for idx in range(cnt):
    info = CudaDeviceInfo(idx)
    print(f"UUID: {info.uuid}")
    print(f"Name: {info.name}")
    print(f"ComputeCapability: {info.computeCapability}")
    print(f"TotalGlobalVmem: {info.totalGlobalVmem}")
    print(f"PciId: {info.pciId}")
    print(f"UsingTccDriver: {info.isTccDriver}")
    print("===================================")

Metadata

Release files for cuda-available 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cuda-available 0.3.1
File Size Uploaded Provenance Actions
cuda_available-0.3.1.tar.gz 6.3 kB Without provenance Details for cuda_available-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cuda-available 0.3.1
File Interpreter ABI Platform Actions
cuda_available-0.3.1-py3-none-any.whl Python 3 none any Details for cuda_available-0.3.1-py3-none-any.whl

Total release size: 14.2 kB

Release files / cuda_available-0.3.1.tar.gz

Download URL cuda_available-0.3.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
54575a56dcb5c251213bf4a142432888bea0e53ef704a0ef245230cdaafb7ca6
BLAKE2b-256 checksum
How to use checksums
83eb55bf1ed3f0c8a400ee0f2994d65ad820abb38f598c9768ae6c26a6e69d4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / cuda_available-0.3.1-py3-none-any.whl

Download URL cuda_available-0.3.1-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3ae683690a1ffd42ac0dfafc389a78d783784d65043cdd5a057492ee06244dc
BLAKE2b-256 checksum
How to use checksums
0e1a08c87c31751bf658439a90b1b4544c60c08da0ac3d043a6b60ad2e1102da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Security for cuda-available 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page