New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cuda-available

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cuda-available

A package for checking available CUDA device information

  • 0.3.1
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc