Skip to main content

A package for checking available CUDA device information

Project description

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("===================================")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cuda_available-0.3.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

cuda_available-0.3.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file cuda_available-0.3.1.tar.gz.

File metadata

  • Download URL: cuda_available-0.3.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for cuda_available-0.3.1.tar.gz
Algorithm Hash digest
SHA256 54575a56dcb5c251213bf4a142432888bea0e53ef704a0ef245230cdaafb7ca6
MD5 e3dfb88c2b4c624f2195ceb2e44cd3cd
BLAKE2b-256 83eb55bf1ed3f0c8a400ee0f2994d65ad820abb38f598c9768ae6c26a6e69d4d

See more details on using hashes here.

File details

Details for the file cuda_available-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: cuda_available-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for cuda_available-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3ae683690a1ffd42ac0dfafc389a78d783784d65043cdd5a057492ee06244dc
MD5 c8096538238d9cc3dd85aa072678a674
BLAKE2b-256 0e1a08c87c31751bf658439a90b1b4544c60c08da0ac3d043a6b60ad2e1102da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page