< 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.device_get_attribute_1i ()
  2. gh_cuda.device_get_attribute_2i ()
  3. gh_cuda.device_get_attribute_3i ()
  4. gh_cuda.device_get_name ()
  5. gh_cuda.device_get_pci_bus_id_string ()
  6. gh_cuda.device_get_total_memory ()
  7. gh_cuda.get_driver_version ()
  8. gh_cuda.get_num_devices ()
  9. gh_cuda.sm_version_to_num_cores ()



device_get_attribute_1i

Description

Returns the value of an attribute of a CUDA device.


Syntax

x = gh_cuda.device_get_attribute_1i(
 dev_index,
 attr_name
)

Languages


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(
 dev_index,
 attr_name
)

Languages


Parameters


Return Values


Code sample


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(
 dev_index,
 attr_name
)

Languages


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)
			


device_get_name

Description

Returns the name of a CUDA device.


Syntax

dev_name = gh_cuda.device_get_name(
 dev_index
)

Languages


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(
 dev_index
)

Languages


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(
 dev_index
)

Languages


Parameters


Return Values


Code sample


total_memory = gh_cuda.device_get_total_memory(0)
			


get_driver_version

Description

Returns the version of CUDA supported by the graphics driver.


Syntax

version = gh_cuda.get_driver_version()

Languages


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


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


Parameters


Return Values


Code sample


num_cores_per_sm = gh_cuda.sm_version_to_num_cores(6, 0)
			






GeeXLab Rootard Guide | Downloads | Contact | Newsletter