< GeeXLab Reference Guide />

> Back to Reference Guide Index


gh_cuda library

Description

gh_cuda is the module that manages CUDA functions. Currently CUDA functions only covers the API level support of CUDA-capable devices.


Number of functions: 9

  1. gh_cuda.get_driver_version (Lua - Python)
  2. gh_cuda.get_num_devices (Lua - Python)
  3. gh_cuda.sm_version_to_num_cores (Lua - Python)
  4. gh_cuda.device_get_name (Lua - Python)
  5. gh_cuda.device_get_pci_bus_id_string (Lua - Python)
  6. gh_cuda.device_get_total_memory (Lua - Python)
  7. gh_cuda.device_get_attribute_1i (Lua - Python)
  8. gh_cuda.device_get_attribute_2i (Lua - Python)
  9. gh_cuda.device_get_attribute_3i (Lua - Python)



get_driver_version

Description

Returns the version of CUDA supported by the graphics driver.


Syntax

version = gh_cuda.get_driver_version()

Languages

Lua - Python


Parameters

This function has no input parameter(s).


Return Values


Code sample

    
version = gh_cuda.get_driver_version()
            


get_num_devices

Description

Returns the number of CUDA devices available.


Syntax

num_devices = gh_cuda.get_num_devices()

Languages

Lua - Python


Parameters

This function has no input parameter(s).


Return Values


Code sample

    
num_devices = gh_cuda.get_num_devices()
            


sm_version_to_num_cores

Description

Utility function that returns the number of cores per SM (CUDA multiprocessor) from a CUDA compute capability.


Syntax

num_cores_per_sm = gh_cuda.sm_version_to_num_cores(
 cc_major,
 cc_minor
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
num_cores_per_sm = gh_cuda.sm_version_to_num_cores(6, 0)
            


device_get_name

Description

Returns the name of a CUDA device.


Syntax

name = gh_cuda.device_get_name(
 device_index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
name = gh_cuda.device_get_name(0)
            


device_get_pci_bus_id_string

Description

Returns the PCI bus ID string of a CUDA device.


Syntax

pci_bus_id_str = gh_cuda.device_get_pci_bus_id_string(
 device_index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
pci_bus_id_str = gh_cuda.device_get_pci_bus_id_string(0)
            


device_get_total_memory

Description

Returns the total amount of memory of a CUDA device.


Syntax

total_memory = gh_cuda.device_get_total_memory(
 device_index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
total_memory = gh_cuda.device_get_total_memory(0)
            


device_get_attribute_1i

Description

Returns the value of an attribute of a CUDA device.


Syntax

x = gh_cuda.device_get_attribute_1i(
 device_index,
 attribute
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
--[[
"simd_width"
"mem_pitch"
"registers_per_block"
"texture_align"
"core_clock_rate"
"mem_clock_rate"
"mem_bus_width"
"mem_bandwidth_gbs"
"pci_bus_id"
"l2_cache_size"
"async_count"
"total_constant_memory"
"shared_mem_per_block"
"max_shared_mem_per_sm"
"max_threads_per_block"
"max_threads_per_sm"
"warp_size"
"multiprocessor_count"
"cuda_cores_per_sm"
"cuda_cores"
--]]

attribute = "multiprocessor_count"
x = gh_cuda.device_get_attribute_1i(0, attribute)
            


device_get_attribute_2i

Description

Returns the value of an attribute of a CUDA device.


Syntax

x, y = gh_cuda.device_get_attribute_2i(
 device_index,
 attribute
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
-- "compute_capability"

attribute = "compute_capability"
x, y = gh_cuda.device_get_attribute_2i(0, attribute)
            


device_get_attribute_3i

Description

Returns the value of an attribute of a CUDA device.


Syntax

x, y, z = gh_cuda.device_get_attribute_3i(
 device_index,
 attribute
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
-- "max_threads_dim"
-- "max_grid_size"
-- "max_block_dim"

attribute = "max_threads_dim"
x, y, z = gh_cuda.device_get_attribute_3i(0, attribute)
            






GeeXLab Rootard Guide | Downloads | Contact | Newsletter