CudaTools
1.1 Basic Information
Namespace:
HEaaN::CudaTools
Purpose: Provides basic utility functions for CUDA device management and monitoring
1.2 API Reference
1.2.1 Device Availability Check
Function: Checks the availability of CUDA devices
Return Value: Boolean indicating CUDA device availability (
true
/false
)Usage Example:
1.2.2 Device Synchronization
Function: Waits until all CUDA device operations are completed
When to Use: Blocks the host thread until all previously launched CUDA kernels have completed their execution.
1.2.3 Device Information Management
Functions:
cudaGetDevice()
: Returns the ID of the currently active CUDA devicecudaDeviceCount()
: Returns the number of available CUDA devices in the SystemcudaSetDevice(int device_id)
: Sets the active CUDA device
Usage Example:
Note: Currently
gpu-run
allocates a single gpu to run your binary. Usingdevice_id
other than0
will elad to a runtime error.
1.2.4 Profiling Tools
Function: Set markers for NVIDIA Visual Profiler (e.g., Nsight System)
Purpose: Performance profiling of CUDA code
Usage Example:
1.2.5 Memory Information
Function: Retrieves memory information of the current CUDA device
Return Value:
{available_memory, total_memory}
in bytesUsage Example:
Last updated
Was this helpful?