Documentation
¶
Overview ¶
Package cufile provides Linux Go bindings for cuFile (GPUDirect Storage).
Call DriverOpen before using the driver and DriverClose after releasing registered resources. [NewHandleRegister] registers a file described by Descr; release the registration with Handle.Deregister before closing the file.
Handle.Read and Handle.Write transfer between a registered file and CUDA device memory. Callers own the file, device allocation, offsets and buffer lifetimes. These methods return the byte count from cuFile, or 0 and an error when cuFile reports a failure as a negative count. Status-returning functions return a Go error.
The package is built only on Linux and loads libcufile dynamically. Load selects a library explicitly; CUFILE_LIB_PATH overrides the default search path. Loading the library alone does not establish that a file system or device supports GPUDirect Storage.
Other ¶
- BatchHandle.IOCancel: This is a batch API to cancel an ongoing IO batch operation by using the batch_id that was returned by BatchHandle.IOSubmit.
- BatchHandle.IODestroy: BatchHandle.IOGetStatus.
- BatchHandle.IOGetStatus: This is a batch API to monitor the status of batch IO operations by using the batch_id that was returned by BatchHandle.IOSubmit.
- BatchIOSetUp: Handle.Read.
- BatchHandle.IOSubmit: This API will need to be used to submit a read/write operation on an array of GPU/CPU data pointers from their respective file handle, offset, and size bytes.
- BufDeregister: Based on the memory type, this API either deregisters CUDA memory or the host memory registered using the BufRegister API.
- BufRegister: Based on the memory type, this API registers existing cuMemAlloc’d (pinned) memory for GDS IO operations or host memory for IO operations.
- DriverClose: Closes the driver session and frees any associated resources for GDS.
- DriverGetP2PFlags: Gets the P2P flags for a specific filesystem or block device.
- DriverGetProperties: Gets the Driver session properties for GDS functionality.
- DriverOpen: Opens the Driver session to support GDS IO operations.
- DriverSetMaxCacheSize: Sets the maximum GPU buffer space, in KB, per device and is used for internal use, for example, to handle unaligned IO and optimal IO path routing.
- DriverSetMaxDirectIOSize: Sets the max IO size, in KB.
- DriverSetMaxPinnedMemSize: Sets the maximum GPU buffer space, in KB, that is pinned and mapped.
- DriverSetP2PFlags: Sets the P2P flags for a specific filesystem or block device.
- DriverSetPollMode: Sets whether the Handle.Read/Write APIs use polling to complete IO operations.
- GetBARSizeInKB: Get the BAR size for a specific GPU in KB.
- GetParameterBool: Fetch cuFile configuration parameters in a program.
- GetParameterMinMaxValue: Get both the minimum and maximum settable values for a given size_t parameter in a single call.
- GetParameterPosixPoolSlabArray: Get POSIX pool slab array.
- GetParameterSizeT: Fetch cuFile configuration parameters in a program.
- GetParameterString: Fetch cuFile configuration parameters in a program.
- GetStatsL1: Get Level 1 cuFile statistics.
- GetStatsL2: Get Level 2 cuFile statistics.
- GetStatsL3: Get Level 3 cuFile statistics.
- GetStatsLevel: Get the current level of statistics collection for cuFile operations.
- GetVersion: Retrieves the cuFile library version.
- Handle.Deregister: The API is used to release resources that are claimed by HandleRegister.
- HandleRegister: Register an open file.
- Handle.Read: Reads specified bytes from the file descriptor into the device memory or the host memory.
- Handle.ReadAsync: Enqueues a read operation for the specified bytes from the cuFile handle into the device memory by using GDS functionality or to the host memory based on the type of memory pointer.
- SetParameterBool: Allows setting of cuFile configuration parameters in a program.
- SetParameterPosixPoolSlabArray: Sets POSIX pool slabs for compat mode I/O.
- SetParameterSizeT: Allows setting of cuFile configuration parameters in a program.
- SetParameterString: Allows setting of cuFile configuration parameters in a program.
- SetStatsLevel: Set the level of statistics collection for cuFile operations.
- StatsReset: Reset all cuFile statistics counters to zero.
- StatsStart: Start collecting cuFile statistics.
- StatsStop: Stop collecting cuFile statistics.
- StreamDeregister: This optional API deregisters the stream with the cuFile subsystem.
- StreamRegister: Defines the input behavior for stream I/O APIs.
- Handle.Write: Writes specified bytes from the device memory into the file descriptor using GDS.
- Handle.WriteAsync: Queues Handle.Write operation for the specified bytes from the device memory into the cuFile handle by using GDS.
Example ¶
Example is an illustrative registration sequence; replace /path/to/data with a file on a cuFile-supported filesystem before running it. It opens the cuFile driver and registers a file for GPUDirect Storage I/O. It returns early when the cuFile library is not available. Handle.Read and Handle.Write transfer between the file and CUDA device memory. The transfer path depends on the system and cuFile configuration. It has no Output comment, so it is compiled but not run.
package main
import (
"fmt"
"os"
"github.com/tmc/lib/nvidia/cufile"
)
func main() {
if err := cufile.DriverOpen(); err != nil {
fmt.Println("cuFile unavailable:", err)
return
}
defer cufile.DriverClose()
version, err := cufile.GetVersion()
if err != nil {
fmt.Println("version:", err)
return
}
fmt.Println("cuFile version:", version)
f, err := os.Open("/path/to/data")
if err != nil {
fmt.Println("open:", err)
return
}
defer f.Close()
descr := cufile.Descr{
Type: cufile.HandleTypeOpaqueFd,
Handle: [1]uint64{uint64(f.Fd())},
}
h, err := cufile.HandleRegister(&descr)
if err != nil {
fmt.Println("register:", err)
return
}
defer h.Deregister()
fmt.Println("file registered for GPUDirect Storage")
}
Output:
Index ¶
- Constants
- func BufDeregister(bufPtrBase uintptr) error
- func BufRegister(bufPtrBase uintptr, length uint, flags int32) error
- func Close() error
- func DriverClose() error
- func DriverOpen() error
- func DriverSetMaxCacheSize(maxCacheSize uint) error
- func DriverSetMaxDirectIOSize(maxDirectIoSize uint) error
- func DriverSetMaxPinnedMemSize(maxPinnedSize uint) error
- func DriverSetP2PFlags(statusFlag DriverStatusFlags, p2pFlags P2PFlags) error
- func DriverSetPollMode(poll bool, pollThresholdSize uint) error
- func ExportPCIeTopology(filename *byte) error
- func GetBARSizeInKB(gpuIndex int32) (uint, error)
- func GetParameterBool(param CUFileBoolConfigParameter) (bool, error)
- func GetParameterGpuBounceBufferSlabArray(sizeValues *uint, countValues *uint, len_ int32) error
- func GetParameterMinMaxValue(param CUFileSizeTConfigParameter) (uint, uint, error)
- func GetParameterPosixPoolSlabArray(sizeValues *uint, countValues *uint, len_ int32) error
- func GetParameterSizeT(param CUFileSizeTConfigParameter) (uint, error)
- func GetParameterString(param CUFileStringConfigParameter, descStr *byte, len_ int32) error
- func GetStatsLevel() (int32, error)
- func GetVersion() (int32, error)
- func Has(symbol string) bool
- func HasBatchIOCancel() bool
- func HasBatchIODestroy() bool
- func HasBatchIOGetStatus() bool
- func HasBatchIOSetUp() bool
- func HasBatchIOSubmit() bool
- func HasBufDeregister() bool
- func HasBufRegister() bool
- func HasDriverClose() bool
- func HasDriverGetP2PFlags() bool
- func HasDriverGetProperties() bool
- func HasDriverOpen() bool
- func HasDriverSetMaxCacheSize() bool
- func HasDriverSetMaxDirectIOSize() bool
- func HasDriverSetMaxPinnedMemSize() bool
- func HasDriverSetP2PFlags() bool
- func HasDriverSetPollMode() bool
- func HasExportPCIeTopology() bool
- func HasGetBARSizeInKB() bool
- func HasGetParameterBool() bool
- func HasGetParameterGpuBounceBufferSlabArray() bool
- func HasGetParameterMinMaxValue() bool
- func HasGetParameterPosixPoolSlabArray() bool
- func HasGetParameterSizeT() bool
- func HasGetParameterString() bool
- func HasGetStatsL1() bool
- func HasGetStatsL2() bool
- func HasGetStatsL3() bool
- func HasGetStatsLevel() bool
- func HasGetVersion() bool
- func HasHandleDeregister() bool
- func HasHandleRegister() bool
- func HasRead() bool
- func HasReadAsync() bool
- func HasReadv() bool
- func HasSetParameterBool() bool
- func HasSetParameterGpuBounceBufferSlabArray() bool
- func HasSetParameterPosixPoolSlabArray() bool
- func HasSetParameterSizeT() bool
- func HasSetParameterString() bool
- func HasSetStatsLevel() bool
- func HasStatsReset() bool
- func HasStatsStart() bool
- func HasStatsStop() bool
- func HasStreamDeregister() bool
- func HasStreamRegister() bool
- func HasUseCount() bool
- func HasWrite() bool
- func HasWriteAsync() bool
- func HasWritev() bool
- func Load(path string) error
- func Loaded() bool
- func Path() string
- func SetParameterBool(param CUFileBoolConfigParameter, value bool) error
- func SetParameterGpuBounceBufferSlabArray(sizeValues *uint, countValues *uint, len_ int32) error
- func SetParameterPosixPoolSlabArray(sizeValues *uint, countValues *uint, len_ int32) error
- func SetParameterSizeT(param CUFileSizeTConfigParameter, value uint) error
- func SetParameterString(param CUFileStringConfigParameter, descStr *byte) error
- func SetStatsLevel(level int32) error
- func StatsReset() error
- func StatsStart() error
- func StatsStop() error
- func StreamDeregister(stream driver.Stream) error
- func StreamRegister(stream driver.Stream, flags uint32) error
- func UseCount() (int, error)
- type BatchHandle
- type BatchMode
- type BindFailure
- type CUFileArrayConfigParameter
- type CUFileBoolConfigParameter
- type CUFileSizeTConfigParameter
- type CUFileStringConfigParameter
- type CallError
- type CudaResult
- type CufileRDMAInfo
- type Descr
- type DriverControlFlags
- type DriverStatusFlags
- type DrvProps
- type ErrnoError
- type Error
- type FeatureFlags
- type FileHandleType
- type Handle
- func (h Handle) Deregister() error
- func (h Handle) Read(bufPtrBase uintptr, size uint, fileOffset int64, bufPtrOffset int64) (int64, error)
- func (h Handle) ReadAsync(bufPtrBase uintptr, sizeP *uint, fileOffsetP *int64, bufPtrOffsetP *int64, ...) error
- func (h Handle) Readv(iov *IOVec, iovcnt uint, fileOffset int64, flags uint32) (int64, error)
- func (h Handle) Write(bufPtrBase uintptr, size uint, fileOffset int64, bufPtrOffset int64) (int64, error)
- func (h Handle) WriteAsync(bufPtrBase uintptr, sizeP *uint, fileOffsetP *int64, bufPtrOffsetP *int64, ...) error
- func (h Handle) Writev(iov *IOVec, iovcnt uint, fileOffset int64, flags uint32) (int64, error)
- type IOEvents
- type IOParams
- func (i *IOParams) Cookie() uintptr
- func (i *IOParams) DevPtrBase() uintptr
- func (i *IOParams) Fh() Handle
- func (i *IOParams) Mode() BatchMode
- func (i *IOParams) Opcode() Opcode
- func (i *IOParams) SetCookie(v uintptr)
- func (i *IOParams) SetDevPtrBase(v uintptr)
- func (i *IOParams) SetFh(v Handle)
- func (i *IOParams) SetMode(v BatchMode)
- func (i *IOParams) SetOpcode(v Opcode)
- func (i *IOParams) SetSize(v uint)
- func (i *IOParams) Size() uint
- type IOVec
- type LibraryAttempt
- type LibraryConflictError
- type LibraryError
- type OpCounter
- type OpError
- type Opcode
- type P2PFlags
- type PerGpuStats
- type StatsLevel1
- type StatsLevel2
- type StatsLevel3
- type Status
- type SymbolError
- type Timespec
Examples ¶
Constants ¶
const ( // CufileopBaseErr is CUFILEOP_BASE_ERR. CufileopBaseErr = 5000 // CufileGpuUuidLen is CUFILE_GPU_UUID_LEN. CufileGpuUuidLen = 16 // P2PFlagC2C is CU_FILE_P2P_FLAG_C2C. P2PFlagC2C P2PFlags = 8 // P2PFlagDmabuf is CU_FILE_P2P_FLAG_DMABUF. P2PFlagDmabuf P2PFlags = 4 // P2PFlagNvfs is CU_FILE_P2P_FLAG_NVFS. P2PFlagNvfs P2PFlags = 2 // P2PFlagPciP2pdma is CU_FILE_P2P_FLAG_PCI_P2PDMA. P2PFlagPciP2pdma P2PFlags = 1 // RdmaErrBase is CU_FILE_RDMA_ERR_BASE. RDMA-specific error codes. // // These error codes are used between cuObject and cuFile layers to signal QP reset conditions. Base: 6000 (separate from CUFILEOP_BASE_ERR = 5000). RdmaErrBase = 6000 // RdmaRegister is CU_FILE_RDMA_REGISTER. RdmaRegister = 1 // RdmaRelaxedOrdering is CU_FILE_RDMA_RELAXED_ORDERING. RdmaRelaxedOrdering = 2 // RdmaResetToken is CU_FILE_RDMA_RESET_TOKEN. QP reset requested (triggers reset action). RdmaResetToken = 6001 // RdmaResetTokenFailed is CU_FILE_RDMA_RESET_TOKEN_FAILED. QP reset failed. RdmaResetTokenFailed = 6002 // RdmaSuccess is CU_FILE_RDMA_SUCCESS. RDMA operation succeeded. RdmaSuccess = 0 // StreamFixedBufOffset is CU_FILE_STREAM_FIXED_BUF_OFFSET. buffer pointer offset is set at submission time. StreamFixedBufOffset = 1 // StreamFixedFileOffset is CU_FILE_STREAM_FIXED_FILE_OFFSET. file offset is set at submission time. StreamFixedFileOffset = 2 // StreamFixedFileSize is CU_FILE_STREAM_FIXED_FILE_SIZE. file size is set at submission time. StreamFixedFileSize = 4 // StreamPageAlignedInputs is CU_FILE_STREAM_PAGE_ALIGNED_INPUTS. size, offset and buffer offset are 4k aligned. StreamPageAlignedInputs = 8 )
Variables ¶
This section is empty.
Functions ¶
func BufDeregister ¶
BufDeregister Based on the memory type, this API either deregisters CUDA memory or the host memory registered using the BufRegister API.
This API deregisters memory mappings that were registered by BufRegister. Refer to BufRegister for more information.
- bufPtrBase: Address of device pointer to release the mappings that were provided to BufRegister
Errors:
- CU_FILE_ERROR_INVALID_VALUE: on failure to find the registration for the specified memory.
- InternalError: an internal library-specific error.
- MemoryNotRegistered: if bufPtr_base was not registered.
Wraps cuFileBufDeregister.
func BufRegister ¶
BufRegister Based on the memory type, this API registers existing cuMemAlloc’d (pinned) memory for GDS IO operations or host memory for IO operations.
Based on the memory type, this API either registers the specified GPU address or host memory address and size for use with the Handle.Read and Handle.Write operations. The user must call BufDeregister to release the pinned memory mappings for GPU memory if needed. See the following for more information:
Parameters:
- bufPtrBase: Address of device pointer. Handle.Read and Handle.Write must use this bufPtrBase as the base address
- flags: Reserved for future use; must be 0
Errors:
- CudaDriverError: on CUDA-specific errors. CUresult code can be obtained using CU_FILE_CUDA_ERR (err).
- CudaMemoryTypeInvalid: for device memory that is not allocated via cudaMalloc or cuMemAlloc.
- CudaPointerRangeError: if the size exceeds the bounds of the allocated memory.
- GpuMemoryPinningFailed: if not enough pinned memory is available.
- InternalError: an internal library-specific error.
- InvalidMappingSize: if the size exceeds the GPU resource limits.
- InvalidValue: on a failure.
- MemoryAlreadyRegistered: if memory is already registered.
- NvfsDriverError: if the nvidia-fs driver cannot handle the request.
Wraps cuFileBufRegister.
func Close ¶
func Close() error
Close unloads the library and clears all bound function pointers.
The function pointers are package-level state, so Close must not be called concurrently with any other call into this package: doing so is a use-after-free. It is intended for test teardown, not for reclaiming a live library.
func DriverClose ¶
func DriverClose() error
DriverClose closes the driver session and frees any associated resources for GDS.
This happens implicitly upon process exit. The driver can be reopened once it is closed.
- Close the GDS session and any associated memory resources. If there are buffers registered by using BufRegister, which are not unregistered, a DriverClose implicitly unregisters those buffers. Any in-flight IO when DriverClose is in-progress will receive an error.
Errors:
- DriverNotInitialized: on failure.
Wraps cuFileDriverClose, bound as cuFileDriverClose_v2.
func DriverOpen ¶
func DriverOpen() error
DriverOpen opens the Driver session to support GDS IO operations.
- This API opens the session with the NVFS kernel driver to communicate from userspace to kernel space and calls the GDS driver to set up the resources required to support GDS IO operations.
- The API checks whether the current platform supports GDS and initializes the cuFile library.
- This API loads the cuFile settings from a JSON configuration file in /etc/cufile.JSON.
If the JSON configuration file does not exist, the API loads the default library settings. To modify this default config file, administrative privileges are needed. The administrator can modify it to grant cuFile access to the specified devices and mount paths and also tune IO parameters (in KB, 4K aligned) that are based on the type of workload. Refer to the default config file ( /etc/cufile.json) for more information.
A nil error means a successful open, or the driver is already open.
Errors:
- CudaDriverError: if the CUDA driver failed to initialize. PlatformNotSupported if the current platform is not supported by GDS.
- DriverNotInitialized: on a failure to open the driver.
- DriverVersionMismatch: when there is a mismatch between the cuFile library and its kernel driver.
- NvfsSetupError: for a cuFile-specific internal error. Refer to the cufile.log file for more information.
- PermissionDenied: on a failure to open. This can happen when the character device ( /dev/nvidia_fs[0-15]) is restricted to certain users by an administrator, for example, admin, where /dev is not exposed with read permissions in the container.
Wraps cuFileDriverOpen.
func DriverSetMaxCacheSize ¶
DriverSetMaxCacheSize sets the maximum GPU buffer space, in KB, per device and is used for internal use, for example, to handle unaligned IO and optimal IO path routing.
This value might be rounded down to the nearest GPU page size. The max cache size must be 4K aligned. This API overrides the default value that might be set through the JSON configuration file using the properties.max_device_cache_size_kb config key for the current process. This API is used with cuFileGetDriverProperties and is used to set the upper limit on the cache size per device for internal use by the library. Refer to DriverGetProperties for more information.
- maxCacheSize: The maximum GPU buffer space, in KB, per device used for internal use, for example, to handle unaligned IO and optimal IO path routing. This value might be rounded down to the nearest GPU page size. The default value is 131072KB
Errors:
- DriverNotInitialized: on failure to load the driver.
- DriverUnsupportedLimit: on failure to set with valid IO size
Wraps cuFileDriverSetMaxCacheSize.
func DriverSetMaxDirectIOSize ¶
DriverSetMaxDirectIOSize sets the max IO size, in KB.
This parameter is used by the nvidia-fs driver as the maximum IO chunk size in which IO is issued to the underlying filesystem. In compatible mode, this is the maximum IO chunk size that the library uses to issue POSIX read/writes.
- The max direct IO size must be 4K aligned.
This API is used with cuFileGetDriverProperties and is used to set the maximum direct IO size used by the library to specify the nvidia-fs kernel driver the maximum chunk size in which the latter can issue IO to the underlying filesystem. In compatible mode, this is the maximum IO chunk size which the library uses for issuing POSIX read/writes. This parameter is dependent on the underlying GPU hardware and system memory. This API overrides the default value that might be set through the JSON configuration file by using the properties.max_direct_io_size_kb config key for the current process. Refer to the following for more information:
Parameters:
- maxDirectIoSize: The maximum allowed direct IO size in KB. The default value is 16384KB. This is because typically parallel-file systems perform better with bulk read/writes
Errors:
- DriverNotInitialized: on failure to load the driver.
- DriverUnsupportedLimit: on failure to set with valid size.
Wraps cuFileDriverSetMaxDirectIOSize.
func DriverSetMaxPinnedMemSize ¶
DriverSetMaxPinnedMemSize sets the maximum GPU buffer space, in KB, that is pinned and mapped.
This value might be rounded down to the nearest GPU page size. The max pinned size must be 4K aligned. The default value corresponds to the maximum PinnedMemory or the physical memory size of the device. This API overrides the default value that may be set by the properties.max_device_pinned_mem_size_kb JSON config key for the current process. This API is used with cuFileGetDriverProperties and is used to set an upper limit on the maximum size of GPU memory that can be pinned and mapped and is dependent on the underlying GPU hardware and system memory. This API is related to BufRegister, which is used to register GPU device memory. See DriverGetProperties for more information.
Errors:
- DriverNotInitialized: on failure to load driver.
- DriverUnsupportedLimit: on failure to set with valid size.
Wraps cuFileDriverSetMaxPinnedMemSize.
func DriverSetP2PFlags ¶
func DriverSetP2PFlags(statusFlag DriverStatusFlags, p2pFlags P2PFlags) error
DriverSetP2PFlags sets the P2P flags for a specific filesystem or block device.
The p2pFlags parameter should be a bitmask of the desired P2P capabilities. On x86_64 platforms: only P2PFlagPciP2pdma is allowed. On AARCH64 platforms: only P2PFlagC2C is allowed. P2PFlagNvfs and P2PFlagDmabuf are not allowed to be set via this API (they are managed internally by the driver). This API sets the P2P flags for a specific filesystem or block device. Currently, based on the platform, only P2PFlagPciP2pdma or P2PFlagC2C is allowed. If these flags are set, then the I/O will be attempted via P2PDMA mode (if the system supports it) instead of traditional NVFS mode.
Requires CUDA 13.1 or later; see HasDriverSetP2PFlags.
- statusFlag: The filesystem/device status flag (for example, LustreSupported, NvmeSupported, etc.)
- p2pFlags: The P2P flags bitmask to set
Errors:
- DriverNotInitialized: if the cuFile driver is not initialized.
- InvalidValue: if status_flag is invalid.
- CU_FILE_P2P_FLAG_NOT_SUPPORTED: if p2p_flags contains flags not supported on the current platform.
Wraps cuFileDriverSetP2PFlags.
func DriverSetPollMode ¶
DriverSetPollMode sets whether the Handle.Read/Write APIs use polling to complete IO operations.
If poll mode is enabled, an IO size less than or equal to the threshold value is used for polling. DriverSetPollMode(bool poll, size_t pollThresholdSize) API The pollThresholdSize must be 4K aligned. This API is used in conjunction with cuFileGetDriverProperties. This API is used to set whether the library should use polling and the maximum IO threshold size less than or equal to which it will poll. This API overrides the default value that may be set through the JSON configuration file using the config keys properties.poll_mode and properties.poll_max_size_kb for the current process. Refer to the following for more information: DriverGetProperties
- poll: Boolean to indicate whether to use the poll mode
- pollThresholdSize: IO size to use for POLLING mode in KB. The default value is 4KB
Errors:
- DriverNotInitialized: on failure to load the driver.
- DriverUnsupportedLimit: on failure to set with valid threshold size.
Wraps cuFileDriverSetPollMode.
func ExportPCIeTopology ¶
ExportPCIeTopology wraps cuFileExportPCIeTopology.
Requires CUDA 13.2 or later; see HasExportPCIeTopology.
func GetBARSizeInKB ¶
GetBARSizeInKB gets the BAR size for a specific GPU in KB.
This API is used to get the BAR size of the GPU passed in as a parameter.
Requires CUDA 13.0 or later; see HasGetBARSizeInKB.
- gpuIndex: GPU index to query
- barSize: The BAR size in KB
Errors:
- DriverNotInitialized: if the driver is not initialized.
- InvalidValue: on invalid input.
Wraps cuFileGetBARSizeInKB.
func GetParameterBool ¶
func GetParameterBool(param CUFileBoolConfigParameter) (bool, error)
GetParameterBool Fetch cuFile configuration parameters in a program.
Based on the parameter type, the corresponding API can be chosen. If the driver is open, cuFileGetParameter*() returns the current runtime value for the given parameter. If the driver is not opened yet, cuFileGetParameter*() returns the currently staged value for that parameter. Staged parameter values are cleared when the driver is opened. These APIs are used to fetch configuration parameters in a programmatic way as opposed to reading the JSON file or environment variables.
Requires CUDA 12.9 or later; see HasGetParameterBool.
- param: The parameter to get
- value: The location where the value will be stored
Errors:
- InvalidValue: if the input parameter is invalid.
Wraps cuFileGetParameterBool.
func GetParameterGpuBounceBufferSlabArray ¶
GetParameterGpuBounceBufferSlabArray wraps cuFileGetParameterGpuBounceBufferSlabArray.
Requires CUDA 13.2 or later; see HasGetParameterGpuBounceBufferSlabArray.
func GetParameterMinMaxValue ¶
func GetParameterMinMaxValue(param CUFileSizeTConfigParameter) (uint, uint, error)
GetParameterMinMaxValue gets both the minimum and maximum settable values for a given size_t parameter in a single call.
This API is used to get the range a certain size_t parameter supports. This can help applications decide what values they can assign to certain parameters.
Requires CUDA 13.0 or later; see HasGetParameterMinMaxValue.
- param: CUFileSizeTConfigParameter configuration parameter
- minValue: The minimum value
- maxValue: The maximum value
Errors:
- InvalidValue: if min_value or max_value is NULL.
Wraps cuFileGetParameterMinMaxValue.
func GetParameterPosixPoolSlabArray ¶
GetParameterPosixPoolSlabArray gets POSIX pool slab array.
sizeValues and countValues parameters are returned as a pair. This API is used to query values of a POSIX pool array.
Requires CUDA 13.0 or later; see HasGetParameterPosixPoolSlabArray.
- sizeValues: Buffer to receive slab sizes in KB
- countValues: Buffer to receive slab counts
- len_: Buffer size (must match the actual parameter length)
Errors:
- InvalidValue: if inputs are invalid.
Wraps cuFileGetParameterPosixPoolSlabArray.
func GetParameterSizeT ¶
func GetParameterSizeT(param CUFileSizeTConfigParameter) (uint, error)
GetParameterSizeT Fetch cuFile configuration parameters in a program.
Based on the parameter type, the corresponding API can be chosen. If the driver is open, cuFileGetParameter*() returns the current runtime value for the given parameter. If the driver is not opened yet, cuFileGetParameter*() returns the currently staged value for that parameter. Staged parameter values are cleared when the driver is opened. These APIs are used to fetch configuration parameters in a programmatic way as opposed to reading the JSON file or environment variables.
Requires CUDA 12.9 or later; see HasGetParameterSizeT.
- param: The parameter to get
- value: The location where the value will be stored
Errors:
- InvalidValue: if the input parameter is invalid.
Wraps cuFileGetParameterSizeT.
func GetParameterString ¶
func GetParameterString(param CUFileStringConfigParameter, descStr *byte, len_ int32) error
GetParameterString Fetch cuFile configuration parameters in a program.
Based on the parameter type, the corresponding API can be chosen. If the driver is open, cuFileGetParameter*() returns the current runtime value for the given parameter. If the driver is not opened yet, cuFileGetParameter*() returns the currently staged value for that parameter. Staged parameter values are cleared when the driver is opened. These APIs are used to fetch configuration parameters in a programmatic way as opposed to reading the JSON file or environment variables.
Requires CUDA 12.9 or later; see HasGetParameterString.
- param: The parameter to get
- descStr: The location where the value will be stored
Errors:
- InvalidValue: if the input parameter is invalid.
Wraps cuFileGetParameterString.
func GetStatsLevel ¶
GetStatsLevel gets the current level of statistics collection for cuFile operations.
Returns the currently configured stats level (0–3) in the provided pointer.
Requires CUDA 13.0 or later; see HasGetStatsLevel.
- level: The current statistics level
Errors:
- CU_FILE_ERROR_INVALID_VALUE
Wraps cuFileGetStatsLevel.
func GetVersion ¶
GetVersion retrieves the cuFile library version.
The version is returned as (1000 * major + 10 * minor). For example, cuFile 1.7.0 would be represented by 1070. This API is used to obtain the current version of the cuFile library. It may be useful sometimes for an application to expect based on the version if any specific GDS feature is present or not.
Requires CUDA 12.3 or later; see HasGetVersion.
- version: Output. argument which would contain the version number in the above format upon successful completion
Errors:
- DriverVersionReadError: if the version is not available.
- InvalidValue: if the version parameter is null.
Wraps cuFileGetVersion.
func Has ¶
Has reports whether the named C symbol resolved in the loaded library, loading it first if necessary. It returns false if the library failed to load. Use it to gate on capabilities before calling into them.
func HasBatchIOCancel ¶
func HasBatchIOCancel() bool
HasBatchIOCancel reports whether cuFileBatchIOCancel resolved in the loaded library.
func HasBatchIODestroy ¶
func HasBatchIODestroy() bool
HasBatchIODestroy reports whether cuFileBatchIODestroy resolved in the loaded library.
func HasBatchIOGetStatus ¶
func HasBatchIOGetStatus() bool
HasBatchIOGetStatus reports whether cuFileBatchIOGetStatus resolved in the loaded library.
func HasBatchIOSetUp ¶
func HasBatchIOSetUp() bool
HasBatchIOSetUp reports whether cuFileBatchIOSetUp resolved in the loaded library.
func HasBatchIOSubmit ¶
func HasBatchIOSubmit() bool
HasBatchIOSubmit reports whether cuFileBatchIOSubmit resolved in the loaded library.
func HasBufDeregister ¶
func HasBufDeregister() bool
HasBufDeregister reports whether cuFileBufDeregister resolved in the loaded library.
func HasBufRegister ¶
func HasBufRegister() bool
HasBufRegister reports whether cuFileBufRegister resolved in the loaded library.
func HasDriverClose ¶
func HasDriverClose() bool
HasDriverClose reports whether cuFileDriverClose_v2 resolved in the loaded library.
func HasDriverGetP2PFlags ¶
func HasDriverGetP2PFlags() bool
HasDriverGetP2PFlags reports whether cuFileDriverGetP2PFlags resolved in the loaded library.
func HasDriverGetProperties ¶
func HasDriverGetProperties() bool
HasDriverGetProperties reports whether cuFileDriverGetProperties resolved in the loaded library.
func HasDriverOpen ¶
func HasDriverOpen() bool
HasDriverOpen reports whether cuFileDriverOpen resolved in the loaded library.
func HasDriverSetMaxCacheSize ¶
func HasDriverSetMaxCacheSize() bool
HasDriverSetMaxCacheSize reports whether cuFileDriverSetMaxCacheSize resolved in the loaded library.
func HasDriverSetMaxDirectIOSize ¶
func HasDriverSetMaxDirectIOSize() bool
HasDriverSetMaxDirectIOSize reports whether cuFileDriverSetMaxDirectIOSize resolved in the loaded library.
func HasDriverSetMaxPinnedMemSize ¶
func HasDriverSetMaxPinnedMemSize() bool
HasDriverSetMaxPinnedMemSize reports whether cuFileDriverSetMaxPinnedMemSize resolved in the loaded library.
func HasDriverSetP2PFlags ¶
func HasDriverSetP2PFlags() bool
HasDriverSetP2PFlags reports whether cuFileDriverSetP2PFlags resolved in the loaded library.
func HasDriverSetPollMode ¶
func HasDriverSetPollMode() bool
HasDriverSetPollMode reports whether cuFileDriverSetPollMode resolved in the loaded library.
func HasExportPCIeTopology ¶
func HasExportPCIeTopology() bool
HasExportPCIeTopology reports whether cuFileExportPCIeTopology resolved in the loaded library.
func HasGetBARSizeInKB ¶
func HasGetBARSizeInKB() bool
HasGetBARSizeInKB reports whether cuFileGetBARSizeInKB resolved in the loaded library.
func HasGetParameterBool ¶
func HasGetParameterBool() bool
HasGetParameterBool reports whether cuFileGetParameterBool resolved in the loaded library.
func HasGetParameterGpuBounceBufferSlabArray ¶
func HasGetParameterGpuBounceBufferSlabArray() bool
HasGetParameterGpuBounceBufferSlabArray reports whether cuFileGetParameterGpuBounceBufferSlabArray resolved in the loaded library.
func HasGetParameterMinMaxValue ¶
func HasGetParameterMinMaxValue() bool
HasGetParameterMinMaxValue reports whether cuFileGetParameterMinMaxValue resolved in the loaded library.
func HasGetParameterPosixPoolSlabArray ¶
func HasGetParameterPosixPoolSlabArray() bool
HasGetParameterPosixPoolSlabArray reports whether cuFileGetParameterPosixPoolSlabArray resolved in the loaded library.
func HasGetParameterSizeT ¶
func HasGetParameterSizeT() bool
HasGetParameterSizeT reports whether cuFileGetParameterSizeT resolved in the loaded library.
func HasGetParameterString ¶
func HasGetParameterString() bool
HasGetParameterString reports whether cuFileGetParameterString resolved in the loaded library.
func HasGetStatsL1 ¶
func HasGetStatsL1() bool
HasGetStatsL1 reports whether cuFileGetStatsL1 resolved in the loaded library.
func HasGetStatsL2 ¶
func HasGetStatsL2() bool
HasGetStatsL2 reports whether cuFileGetStatsL2 resolved in the loaded library.
func HasGetStatsL3 ¶
func HasGetStatsL3() bool
HasGetStatsL3 reports whether cuFileGetStatsL3 resolved in the loaded library.
func HasGetStatsLevel ¶
func HasGetStatsLevel() bool
HasGetStatsLevel reports whether cuFileGetStatsLevel resolved in the loaded library.
func HasGetVersion ¶
func HasGetVersion() bool
HasGetVersion reports whether cuFileGetVersion resolved in the loaded library.
func HasHandleDeregister ¶
func HasHandleDeregister() bool
HasHandleDeregister reports whether cuFileHandleDeregister resolved in the loaded library.
func HasHandleRegister ¶
func HasHandleRegister() bool
HasHandleRegister reports whether cuFileHandleRegister resolved in the loaded library.
func HasRead ¶
func HasRead() bool
HasRead reports whether cuFileRead resolved in the loaded library.
func HasReadAsync ¶
func HasReadAsync() bool
HasReadAsync reports whether cuFileReadAsync resolved in the loaded library.
func HasReadv ¶
func HasReadv() bool
HasReadv reports whether cuFileReadv resolved in the loaded library.
func HasSetParameterBool ¶
func HasSetParameterBool() bool
HasSetParameterBool reports whether cuFileSetParameterBool resolved in the loaded library.
func HasSetParameterGpuBounceBufferSlabArray ¶
func HasSetParameterGpuBounceBufferSlabArray() bool
HasSetParameterGpuBounceBufferSlabArray reports whether cuFileSetParameterGpuBounceBufferSlabArray resolved in the loaded library.
func HasSetParameterPosixPoolSlabArray ¶
func HasSetParameterPosixPoolSlabArray() bool
HasSetParameterPosixPoolSlabArray reports whether cuFileSetParameterPosixPoolSlabArray resolved in the loaded library.
func HasSetParameterSizeT ¶
func HasSetParameterSizeT() bool
HasSetParameterSizeT reports whether cuFileSetParameterSizeT resolved in the loaded library.
func HasSetParameterString ¶
func HasSetParameterString() bool
HasSetParameterString reports whether cuFileSetParameterString resolved in the loaded library.
func HasSetStatsLevel ¶
func HasSetStatsLevel() bool
HasSetStatsLevel reports whether cuFileSetStatsLevel resolved in the loaded library.
func HasStatsReset ¶
func HasStatsReset() bool
HasStatsReset reports whether cuFileStatsReset resolved in the loaded library.
func HasStatsStart ¶
func HasStatsStart() bool
HasStatsStart reports whether cuFileStatsStart resolved in the loaded library.
func HasStatsStop ¶
func HasStatsStop() bool
HasStatsStop reports whether cuFileStatsStop resolved in the loaded library.
func HasStreamDeregister ¶
func HasStreamDeregister() bool
HasStreamDeregister reports whether cuFileStreamDeregister resolved in the loaded library.
func HasStreamRegister ¶
func HasStreamRegister() bool
HasStreamRegister reports whether cuFileStreamRegister resolved in the loaded library.
func HasUseCount ¶
func HasUseCount() bool
HasUseCount reports whether cuFileUseCount resolved in the loaded library.
func HasWrite ¶
func HasWrite() bool
HasWrite reports whether cuFileWrite resolved in the loaded library.
func HasWriteAsync ¶
func HasWriteAsync() bool
HasWriteAsync reports whether cuFileWriteAsync resolved in the loaded library.
func HasWritev ¶
func HasWritev() bool
HasWritev reports whether cuFileWritev resolved in the loaded library.
func Load ¶
Load opens the shared library from path, or from the default search list when path is empty, and binds all symbols. Callers that need to direct loading should call Load before any other function; otherwise the first call loads from the default search list.
Load is idempotent: calling it again with the same path, or with an empty path, returns nil. Calling it with a different path after a successful load returns *LibraryConflictError rather than replacing the library. After a failed load, Load retries.
func Loaded ¶
func Loaded() bool
Loaded reports whether the library is currently loaded. It does not trigger a load.
func Path ¶
func Path() string
Path returns the path or name the loaded library was opened from, or the empty string if no library is loaded.
func SetParameterBool ¶
func SetParameterBool(param CUFileBoolConfigParameter, value bool) error
SetParameterBool allows setting of cuFile configuration parameters in a program.
Based on the parameter type, the corresponding API can be chosen. Should be called before the driver opens and the values take effect after the driver is opened. If the same parameter is set multiple times, only the last parameter is kept and used. Parameter precedence (highest to lowest) is: cuFileSetParameter*() (if set), then environment variable (if exists and set), then cufile.json. These APIs are used to set configuration parameters in a programmatic way as opposed to relying on the JSON file or environment variables.
Requires CUDA 12.9 or later; see HasSetParameterBool.
- param: The parameter to set, based on parameter type
- value: The source of the parameter value
Errors:
- DriverAlreadyOpen: if the driver is already open.
- InvalidValue: if the input parameter is invalid.
Wraps cuFileSetParameterBool.
func SetParameterGpuBounceBufferSlabArray ¶
SetParameterGpuBounceBufferSlabArray wraps cuFileSetParameterGpuBounceBufferSlabArray.
Requires CUDA 13.2 or later; see HasSetParameterGpuBounceBufferSlabArray.
func SetParameterPosixPoolSlabArray ¶
SetParameterPosixPoolSlabArray sets POSIX pool slabs for compat mode I/O.
sizeValues and countValues parameters are treated as a pair. Should be set before DriverOpen is called. This API is used to set a POSIX pool array. The application can set it based on the I/O sizes it is going to be issuing and hence reduce memory fragmentation.
Requires CUDA 13.0 or later; see HasSetParameterPosixPoolSlabArray.
- sizeValues: Array of slab sizes in KB
- countValues: Array of slab counts
- len_: Length of both arrays (must be the same)
Errors:
- DriverAlreadyOpen: if the driver is already open.
- InvalidValue: if inputs are invalid.
Wraps cuFileSetParameterPosixPoolSlabArray.
func SetParameterSizeT ¶
func SetParameterSizeT(param CUFileSizeTConfigParameter, value uint) error
SetParameterSizeT allows setting of cuFile configuration parameters in a program.
Based on the parameter type, the corresponding API can be chosen. Should be called before the driver opens and the values take effect after the driver is opened. If the same parameter is set multiple times, only the last parameter is kept and used. Parameter precedence (highest to lowest) is: cuFileSetParameter*() (if set), then environment variable (if exists and set), then cufile.json. These APIs are used to set configuration parameters in a programmatic way as opposed to relying on the JSON file or environment variables.
Requires CUDA 12.9 or later; see HasSetParameterSizeT.
- param: The parameter to set, based on parameter type
- value: The source of the parameter value
Errors:
- DriverAlreadyOpen: if the driver is already open.
- InvalidValue: if the input parameter is invalid.
Wraps cuFileSetParameterSizeT.
func SetParameterString ¶
func SetParameterString(param CUFileStringConfigParameter, descStr *byte) error
SetParameterString allows setting of cuFile configuration parameters in a program.
Based on the parameter type, the corresponding API can be chosen. Should be called before the driver opens and the values take effect after the driver is opened. If the same parameter is set multiple times, only the last parameter is kept and used. Parameter precedence (highest to lowest) is: cuFileSetParameter*() (if set), then environment variable (if exists and set), then cufile.json. These APIs are used to set configuration parameters in a programmatic way as opposed to relying on the JSON file or environment variables.
Requires CUDA 12.9 or later; see HasSetParameterString.
- param: The parameter to set, based on parameter type
- descStr: The source of the parameter value
Errors:
- DriverAlreadyOpen: if the driver is already open.
- InvalidValue: if the input parameter is invalid.
Wraps cuFileSetParameterString.
func SetStatsLevel ¶
SetStatsLevel sets the level of statistics collection for cuFile operations.
This overrides the cufile.json settings for stats. Higher stats levels may impact performance. Level 0 disables statistics collection. Changes to stats level take effect for future operations. Must be called before StatsStart to take effect.
Requires CUDA 13.0 or later; see HasSetStatsLevel.
- level: Statistics level (0 = disabled, 1 = basic, 2 = detailed, 3 = verbose)
Errors:
- CU_FILE_ERROR_INVALID_VALUE
Wraps cuFileSetStatsLevel.
func StatsReset ¶
func StatsReset() error
StatsReset resets all cuFile statistics counters to zero.
This clears all accumulated statistics data across all levels. Can be called while statistics collection is active or stopped. Useful for measuring statistics over specific time periods or operation sets.
Requires CUDA 13.0 or later; see HasStatsReset.
Errors:
Wraps cuFileStatsReset.
func StatsStart ¶
func StatsStart() error
StatsStart starts collecting cuFile statistics.
The statistics level must be set with a level greater than 0 before calling this function. Statistics counters begin accumulating from this point and can be stopped and restarted without resetting counters unless StatsReset is called.
Requires CUDA 13.0 or later; see HasStatsStart.
Errors:
Wraps cuFileStatsStart.
func StatsStop ¶
func StatsStop() error
StatsStop stops collecting cuFile statistics.
Accumulated statistics remain available for querying until reset or driver close. Statistics counters are preserved and can still be queried. Collection can be restarted with StatsStart to continue accumulating. Use StatsReset to clear all counters.
Requires CUDA 13.0 or later; see HasStatsStop.
Errors:
Wraps cuFileStatsStop.
func StreamDeregister ¶
StreamDeregister This optional API deregisters the stream with the cuFile subsystem.
This API will free allocated cuFile resources associated with the stream. The API will synchronize on the stream before releasing resources. The stream pointer is expected to be a valid pointer. The stream will be automatically deregistered as part of DriverClose.
- stream: CUDA stream in which to enqueue the operation. If NULL, make this operation in the default CUDA stream
A nil error means a successful submission.
Errors:
- CU_FILE_ERROR_INVALID_VALUE: on a invalid stream specification.
- PlatformNotSupported: on unsupported platforms.
Wraps cuFileStreamDeregister.
func StreamRegister ¶
StreamRegister defines the input behavior for stream I/O APIs.
Note: Using the flag 0XF will perform best as the workflow can be optimized during submission time. This optional API registers the stream with the cuFile subsystem. This API will allocate resources to handle stream operations for cuFile. The API will synchronize on the stream before allocating resources. The stream pointer is expected to be a valid pointer.
- stream: CUDA stream in which to enqueue the operation. If NULL, make this operation in the default CUDA stream
- flags: The following are valid values: 0x0: All the I/O parameters are valid only at the time of execution. 0x1: Buffer offset value is valid at submission time. 0x2: File offset value is valid at submission time. 0x4: Size is valid at submission time. 0x8: All inputs i.e. buffer offset, file offset and size are 4K aligned. 0xf: All inputs are aligned and known at submission time
A nil error means a successful submission.
Errors:
- CU_FILE_DRIVER_ERROR: if the NVIDIA-fs driver cannot handle the request.
- CU_FILE_ERROR_INVALID_VALUE: on a invalid stream specification.
- PlatformNotSupported: on unsupported platforms.
Wraps cuFileStreamRegister.
Types ¶
type BatchHandle ¶
type BatchHandle uintptr
BatchHandle is an opaque handle for CUfileBatchHandle_t.
func BatchIOSetUp ¶
func BatchIOSetUp(nr uint32) (BatchHandle, error)
BatchIOSetUp Handle.Read.
This interface should be the first call in the sequence of batch I/O operation. This takes the maximum number of batch entries the caller intends to use and returns a CUFileBatchHandle_t which should be used by the caller for subsequent batch I/O calls. Refer to the following for more information: Handle.Write Handle.ReadAsync Handle.WriteAsync BatchHandle.IOGetStatus BatchHandle.IOCancel BatchHandle.IODestroy
- batchIdp: (Output) Will be used in subsequent batch IO calls
Errors:
- InternalError: on on any failures.
Wraps cuFileBatchIOSetUp.
func (BatchHandle) IOCancel ¶
func (b BatchHandle) IOCancel() error
IOCancel is a batch API to cancel an ongoing IO batch operation by using the batch_id that was returned by BatchHandle.IOSubmit.
This API tries to cancel an individual IO operation in the batch if possible and provides no guarantee about canceling an ongoing operation. Refer to the following for more information:
Errors:
- CU_FILE_ERROR_INVALID_VALUE: on any failures.
Wraps cuFileBatchIOCancel.
func (BatchHandle) IODestroy ¶
func (b BatchHandle) IODestroy() error
IODestroy BatchHandle.IOGetStatus.
This is a batch API that destroys a batch context and the resources that are allocated with cuFileBatchIOSetup. Refer to the following for more information: BatchHandle.IOSubmit BatchHandle.IOCancel
Wraps cuFileBatchIODestroy.
func (BatchHandle) IOGetStatus ¶
func (b BatchHandle) IOGetStatus(minNr uint32, nr *uint32, iocbp *IOEvents, timeout *Timespec) error
IOGetStatus is a batch API to monitor the status of batch IO operations by using the batch_id that was returned by BatchHandle.IOSubmit.
The operation will be canceled automatically if BatchHandle.IOCancel is called and the status will reflect CU_FILE_CANCELED for all canceled IO operations. The status of each member of the batch is queried, which would not be possible with one CUEvent. The status field of individual IO operations via IOParams entries will have undefined values before the entire batch is completed. This definition is subject to change. Refer to the following for more information:
Parameters:
- minNr: The minimum number of IO entries for which status is requested. The minNr should be greater than or equal to zero and less than or equal to *nr
- nr: This is a pointer to max requested IO entries to poll for completion and is used as an Input/Output parameter. As an input *nr must be set to pass the maximum number of IO requests to poll for. As an output, *nr returns the number of completed I/Os
- iocbp: CUFileIOEvents_t array containing the status of completed I/Os in that batch
- timeout: This parameter is used to specify the amount of time to wait for in this API, even if the minimum number of requests have not completed. If the timeout hits, it is possible that the number of returned IOs can be less than minNr
The success here refers to the completion of the API. Individual IO status and error can be obtained by examining the returned status and error in the array iocbp.
Errors:
- CU_FILE_ERROR_INVALID_VALUE: for an invalid batch ID.
Wraps cuFileBatchIOGetStatus.
func (BatchHandle) IOSubmit ¶
func (b BatchHandle) IOSubmit(nr uint32, iocbp *IOParams, flags uint32) error
IOSubmit will need to be used to submit a read/write operation on an array of GPU/CPU data pointers from their respective file handle, offset, and size bytes.
Based on the type of memory pointer, the data is transferred to/from the GPU memory by using GDS or the data is transferred to/from the CPU memory.
- This is an asynchronous call and will enqueue the operation on a batch_id provided by the cuFileIOSetup API. The operation can be monitored when using this batch_id through BatchHandle.IOGetStatus.
- The operation can be canceled by calling BatchHandle.IOCancel or destroyed by BatchHandle.IODestroy.
- The entries in the IOParams array describe individual IOs.
The bytes transacted field is valid only when the status indicates a completion.
- Operations that are enqueued with cuFile Batch APIs are FIFO ordered with respect to other work on the stream and must be completed before continuing to the next action in the stream. Operations in each batch might be reordered with respect to each other.
- The status field of individual IO operations via IOParams entries will have undefined values before the entire batch is complete. This definition is subject to change.
Refer to the following for more information:
- Handle.Read
- Handle.Write
- Handle.ReadAsync
- Handle.WriteAsync
- BatchHandle.IOGetStatus
- BatchHandle.IOCancel
- BatchHandle.IODestroy
Parameters:
- nr: The number of requests for the batch request. The value must be greater than 0 and less than or equal to max_nr specified in cuFileBatchIOSetup
- iocbp: The pointer contains the IOParams array structures of the length nr array
- flags: Reserved for future use. Should be set to 0
Errors:
- InternalError: on any failures.
Wraps cuFileBatchIOSubmit.
type BatchMode ¶
type BatchMode int32
BatchMode represents CUfileBatchMode_t.
const (
CufileBatch BatchMode = 1
)
type BindFailure ¶
BindFailure names a symbol the loaded library exports but that could not be bound, and why.
func BindFailures ¶
func BindFailures() []BindFailure
BindFailures returns the symbols the loaded library exports that could not be bound, sorted by symbol name, or nil if every exported symbol bound. Calling one of these reports *SymbolError with the same Err.
A load that reports no error can still leave symbols unbound: the library is fine and the signatures are not representable here. Call this after Load to find that out at once rather than one call site at a time. It does not trigger a load, and returns nil if none has happened.
type CUFileArrayConfigParameter ¶
type CUFileArrayConfigParameter int32
CUFileArrayConfigParameter represents CUFileArrayConfigParameter_t.
const ( CufileParamPosixPoolSlabSizeKb CUFileArrayConfigParameter = 0 CufileParamPosixPoolSlabCount CUFileArrayConfigParameter = 1 CufileParamGpuBounceBufferSlabSizeKb CUFileArrayConfigParameter = 2 CufileParamGpuBounceBufferSlabCount CUFileArrayConfigParameter = 3 )
func (CUFileArrayConfigParameter) String ¶
func (e CUFileArrayConfigParameter) String() string
String returns the constant name, or a numeric representation for unknown values.
type CUFileBoolConfigParameter ¶
type CUFileBoolConfigParameter int32
CUFileBoolConfigParameter represents CUFileBoolConfigParameter_t.
const ( CufileParamPropertiesUsePollMode CUFileBoolConfigParameter = 0 CufileParamPropertiesAllowCompatMode CUFileBoolConfigParameter = 1 CufileParamForceCompatMode CUFileBoolConfigParameter = 2 CufileParamFsMiscApiCheckAggressive CUFileBoolConfigParameter = 3 CufileParamExecutionParallelIo CUFileBoolConfigParameter = 4 CufileParamProfileNvtx CUFileBoolConfigParameter = 5 // Do not use this macro. This is deprecated now. CufileParamPropertiesAllowSystemMemory CUFileBoolConfigParameter = 6 CufileParamUsePcip2pdma CUFileBoolConfigParameter = 7 CufileParamPreferIoUring CUFileBoolConfigParameter = 8 CufileParamForceOdirectMode CUFileBoolConfigParameter = 9 CufileParamSkipTopologyDetection CUFileBoolConfigParameter = 10 CufileParamStreamMemopsBypass CUFileBoolConfigParameter = 11 CufileParamPropertiesPosixIoMode CUFileBoolConfigParameter = 12 CufileParamGdsFallbackIo CUFileBoolConfigParameter = 13 )
func (CUFileBoolConfigParameter) String ¶
func (e CUFileBoolConfigParameter) String() string
String returns the constant name, or a numeric representation for unknown values.
type CUFileSizeTConfigParameter ¶
type CUFileSizeTConfigParameter int32
CUFileSizeTConfigParameter represents CUFileSizeTConfigParameter_t.
const ( CufileParamProfileStats CUFileSizeTConfigParameter = 0 CufileParamExecutionMaxIoQueueDepth CUFileSizeTConfigParameter = 1 CufileParamExecutionMaxIoThreads CUFileSizeTConfigParameter = 2 CufileParamExecutionMinIoThresholdSizeKb CUFileSizeTConfigParameter = 3 CufileParamExecutionMaxRequestParallelism CUFileSizeTConfigParameter = 4 CufileParamPropertiesMaxDirectIoSizeKb CUFileSizeTConfigParameter = 5 CufileParamPropertiesMaxDeviceCacheSizeKb CUFileSizeTConfigParameter = 6 CufileParamPropertiesPerBufferCacheSizeKb CUFileSizeTConfigParameter = 7 CufileParamPropertiesMaxDevicePinnedMemSizeKb CUFileSizeTConfigParameter = 8 CufileParamPropertiesIoBatchsize CUFileSizeTConfigParameter = 9 CufileParamPollthresholdSizeKb CUFileSizeTConfigParameter = 10 CufileParamPropertiesBatchIoTimeoutMs CUFileSizeTConfigParameter = 11 )
func (CUFileSizeTConfigParameter) String ¶
func (e CUFileSizeTConfigParameter) String() string
String returns the constant name, or a numeric representation for unknown values.
type CUFileStringConfigParameter ¶
type CUFileStringConfigParameter int32
CUFileStringConfigParameter represents CUFileStringConfigParameter_t.
const ( CufileParamLoggingLevel CUFileStringConfigParameter = 0 CufileParamEnvLogfilePath CUFileStringConfigParameter = 1 CufileParamLogDir CUFileStringConfigParameter = 2 CufileParamRdmaTransport CUFileStringConfigParameter = 3 )
func (CUFileStringConfigParameter) String ¶
func (e CUFileStringConfigParameter) String() string
String returns the constant name, or a numeric representation for unknown values.
type CallError ¶
CallError reports that a library call returned a failure result.
Unwrap returns Result, so errors.As(err, &r) with r of type Error recovers the codes it holds.
type CufileRDMAInfo ¶
CufileRDMAInfo represents cufileRDMAInfo_t.
type Descr ¶
type Descr struct {
Type FileHandleType
Handle [1]uint64
FsOps uintptr
}
Descr represents CUfileDescr_t.
type DriverControlFlags ¶
type DriverControlFlags int32
DriverControlFlags represents CUfileDriverControlFlags_t.
const ( UsePollMode DriverControlFlags = 0 // !< use POLL mode. properties.use_poll_mode AllowCompatMode DriverControlFlags = 1 // !< allow COMPATIBILITY mode. properties.allow_compat_mode VanillaPosixIoMode DriverControlFlags = 2 // !< Vanilla posix io mode. properties.vanilla_posix_io_mode PosixIoMode DriverControlFlags = VanillaPosixIoMode // !< alias for backward compatibility FallbackIoMode DriverControlFlags = 4 // !< Fallback io mode. properties.gds_fallback_io )
func (DriverControlFlags) String ¶
func (e DriverControlFlags) String() string
String returns the constant name, or a numeric representation for unknown values.
type DriverStatusFlags ¶
type DriverStatusFlags int32
DriverStatusFlags represents CUfileDriverStatusFlags_t.
const ( LustreSupported DriverStatusFlags = 0 // !< Support for DDN LUSTRE WekafsSupported DriverStatusFlags = 1 // !< Support for WEKAFS NfsSupported DriverStatusFlags = 2 // !< Support for NFS GpfsSupported DriverStatusFlags = 3 // ! < Support for GPFS NvmeSupported DriverStatusFlags = 4 // !< Support for NVMe NvmeofSupported DriverStatusFlags = 5 // !< Support for NVMeOF ScsiSupported DriverStatusFlags = 6 // !< Support for SCSI ScalefluxCsdSupported DriverStatusFlags = 7 // !< Support for Scaleflux CSD NvmeshSupported DriverStatusFlags = 8 // !< Support for NVMesh Block Dev BeegfsSupported DriverStatusFlags = 9 // !< Support for BeeGFS NvmeP2PSupported DriverStatusFlags = 11 // !< Do not use this macro. This is deprecated now ScatefsSupported DriverStatusFlags = 12 // !< Support for ScateFS VirtiofsSupported DriverStatusFlags = 13 // !<Support for VirtioFS PanfsSupported DriverStatusFlags = 14 // !< Support for PanFS MaxTargetTypes DriverStatusFlags = 15 // !<Maximum FS supported )
func (DriverStatusFlags) String ¶
func (e DriverStatusFlags) String() string
String returns the constant name, or a numeric representation for unknown values.
type DrvProps ¶
type DrvProps struct {
Nvfs [4]uint64
Fflags uint32
MaxDeviceCacheSize uint32
PerBufferCacheSize uint32
MaxDevicePinnedMemSize uint32
MaxBatchIoSize uint32
MaxBatchIoTimeoutMsecs uint32
}
DrvProps represents CUfileDrvProps_t.
func DriverGetProperties ¶
DriverGetProperties gets the Driver session properties for GDS functionality.
The cuFileDrvProps_t structure can be queried with DriverGetProperties and selectively modified with cuFileDriverSetProperties. The structure is self-describing, and its fields are consistent with the major and minor API version parameters. This API is used to get current GDS properties and nvidia-fs driver properties and functionality, such as support for SCSI, NVMe, and NVMe-OF. This API is used to get the current nvidia-fs drivers-specific properties such as the following:
- major_version: the cuFile major version
- minor_version: the cuFile minor version
- props.nvfs.dstatusflags, which are bit flags that indicate support for the following driver features: CU_FILE_EXASCALER_SUPPORTED, a bit to check whether the DDN EXAScaler parallel filesystem solutions (based on the Lustre filesystem) client supports GDS. WekafsSupported, a bit to check whether WekaFS supports GDS.
- Props.nvfs.dcontrolflags, which are bit flags that indicate the current activation for driver features: UsePollMode, when bit is set, IO uses polling mode. AllowCompatMode, if the value is 1 compatible mode is set.
- Props.fflags, which are bit flags that indicate whether the following library features are supported: StreamsSupported, an attribute that checks whether CUDA-streams are supported. DynRoutingSupported, an attribute that checks whether dynamic routing feature is supported.
- Props.nvfs.poll_thresh_size, a maximum IO size, in KB and must be 4K-aligned, that is used for the POLLING mode.
- Props.nvfs.max_direct_io_size, a maximum GDS IO size, in KB and must be 4K-aligned, that is requested by the nvidia-fs driver to the underlying filesystem.
- Props.max_device_cache_size, a maximum GPU buffer space per device, in KB and must be 4K-aligned. Used internally, for example, to handle unaligned IO and optimal IO path routing. This value might be rounded down to the nearest GPU page size.
- Props.max_device_pinned_mem_size, a maximum buffer space, in KB and must be 4K-aligned, that is pinned and mapped to the GPU BAR space. This might be rounded down to the nearest GPU page size.
- Props.per_buffer_cache_size, a GPU bounce buffer size, in KB, used for internal pools.
Additional Information See the following for more information:
- DriverSetPollMode(bool poll, size_t poll_threshold_size)
- DriverSetMaxDirectIOSize(size_t max_direct_io_size)
- (size_t max_cache_size)
- DriverSetMaxPinnedMemSize(size_t max_pinned_memory_size)
Parameters:
- props: Pointer to the cuFile Driver properties
Errors:
- DriverNotInitialized: on failure.
- DriverVersionMismatch: on a driver version mismatch.
- InvalidValue: if input is invalid.
Wraps cuFileDriverGetProperties.
type ErrnoError ¶
type ErrnoError struct {
Func string // the C symbol called
Errno syscall.Errno // errno after the call, or 0 if not captured
}
An ErrnoError reports that Func returned -1, which means the call failed and C set errno to say why.
Errno is that errno, read on the thread that made the call before it could change. It is 0 if the binding for Func cannot capture errno.
func (*ErrnoError) Error ¶
func (e *ErrnoError) Error() string
Error reports the C symbol called and the errno it set.
func (*ErrnoError) Unwrap ¶
func (e *ErrnoError) Unwrap() error
Unwrap returns Errno, so errors.Is(err, fs.ErrNotExist) and the like test it, or nil if errno was not captured.
type Error ¶
type Error struct {
Err OpError
CuErr CudaResult
}
Error represents cufileop status string.
type FeatureFlags ¶
type FeatureFlags int32
FeatureFlags represents CUfileFeatureFlags_t.
const ( DynRoutingSupported FeatureFlags = 0 // !< Support for Dynamic routing to handle devices across the PCIe bridges BatchIoSupported FeatureFlags = 1 // !< Supported StreamsSupported FeatureFlags = 2 // !< Supported ParallelIoSupported FeatureFlags = 3 // !< Supported P2PSupported FeatureFlags = 4 // !< Support for PCI P2PDMA )
func (FeatureFlags) String ¶
func (e FeatureFlags) String() string
String returns the constant name, or a numeric representation for unknown values.
type FileHandleType ¶
type FileHandleType int32
FileHandleType represents CUfileFileHandleType.
const ( HandleTypeOpaqueFd FileHandleType = 1 // !< Linux based fd HandleTypeOpaqueWin32 FileHandleType = 2 // !< Windows based handle (unsupported) HandleTypeUserspaceFs FileHandleType = 3 // Userspace based FS )
func (FileHandleType) String ¶
func (e FileHandleType) String() string
String returns the constant name, or a numeric representation for unknown values.
type Handle ¶
type Handle uintptr
Handle is an opaque handle for CUfileHandle_t.
func HandleRegister ¶
HandleRegister registers an open file.
HandleRegister is required and performs extra checking that is memoized to provide increased performance on later cuFile operations. This API is OS agnostic.
- Given a file-descriptor will populate and return the Handle needed for issuing IO with cuFile APIs.
- A return value of anything other than Success leaves fh in an undefined state but has no other side effects.
- By default this API accepts whether the file descriptor is opened with O_DIRECT mode or non O_DIRECT mode.
Refer to the following for more information:
Parameters:
- fh: Valid pointer to the OS-neutral cuFile handle structure supplied by the user but populated and maintained by the cuFile runtime
Errors:
- DriverNotInitialized: on failure to load the driver.
- HandleAlreadyRegistered: if the file is already registered using the same file-descriptor.
- InvalidFileOpenFlag: if the file is opened with unsupported modes such as no O_APPEND, O_NOCTTY, O_NONBLOCK, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, and O_TMPFILE.
- InvalidFileType: if the file path is not valid, not a regular file, not a symbolic link, or not a device file.
- InvalidValue: if there are null or bad API arguments.
- IoNotSupported: if the filesystem is not supported.
Wraps cuFileHandleRegister.
func (Handle) Deregister ¶
Deregister The API is used to release resources that are claimed by HandleRegister.
Note: This API only logs an ERROR level message in the cufile.log file for valid inputs. This API should be invoked only after the application ensures there are no outstanding IO operations with the handle. If Handle.Deregister is called while IO on the file is in progress might result in undefined behavior.
- The user is still expected to close the file descriptor outside the cuFile subsystem after calling this API using close system call.
Closing a file handle without calling Handle.Deregister does not release the resources that are held in the cuFile library. If this API is not called, the cuFile subsystem releases the resources lazily or when the application exits. Refer to the following for more information:
It is not named Close because it returns no status.
Wraps cuFileHandleDeregister.
func (Handle) Read ¶
func (h Handle) Read(bufPtrBase uintptr, size uint, fileOffset int64, bufPtrOffset int64) (int64, error)
Read reads specified bytes from the file descriptor into the device memory or the host memory.
This API reads the data from a specified file handle at a specified offset and size bytes into the GPU memory by using GDS functionality or into the host memory based on the type of memory pointer. The API works correctly for unaligned offsets and any data size, although the performance might not match the performance of aligned reads. This is a synchronous call and blocks until the IO is complete.
Note: For the bufPtrOffset, if data will be read starting exactly from the bufPtrBase that is registered with BufRegister, bufPtrOffset should be set to 0. To read starting from an offset in the registered buffer range, the relative offset should be specified in the bufPtrOffset, and the bufPtrBase must remain set to the base address that was used in the BufRegister call. See the following for more information:
Parameters:
- bufPtrBase: Base address of buffer in device memory or host memory. For registered buffers, bufPtrBase must remain set to the base address used in the BufRegister call
- size: Size in bytes to read
- fileOffset: Offset in the file to read from
- bufPtrOffset: Offset relative to the bufPtrBase pointer to read into. This parameter should be used only with registered buffers
Read returns the count. If it is negative, Read returns 0 and an error instead: an *ErrnoError if it is -1, which reports a failure in errno and carries it, and otherwise a *CallError whose Result.Err (OpError) is the negated count. An unavailable library or symbol is also an error.
Wraps cuFileRead.
func (Handle) ReadAsync ¶
func (h Handle) ReadAsync(bufPtrBase uintptr, sizeP *uint, fileOffsetP *int64, bufPtrOffsetP *int64, bytesReadP *int64, stream driver.Stream) error
ReadAsync enqueues a read operation for the specified bytes from the cuFile handle into the device memory by using GDS functionality or to the host memory based on the type of memory pointer.
If non-NULL, the action is ordered in the stream. The current context of the caller is assumed.
- This API reads the data from the specified file handle at the specified offset and size bytes into the GPU memory using GDS functionality.
This is an asynchronous call and enqueues the operation into the specified CUDA stream and will not block the host thread for IO completion. The operation can be waited upon using cuStreamSynchronize(stream).
- The bytesReadP memory should be allocated with cuMemHostAlloc/malloc/mmap or registered with cuMemHostRegister.
The pointer to access that memory from the device can be obtained by using cuMemHostGetDevicePointer.
- Operations that are enqueued with cuFile Stream APIs are FIFO ordered with respect to other work on the stream and must be completed before continuing to the next action in the stream.
- Unless otherwise specified through StreamRegister API, file offset, buffer offset or size parameter will not be evaluated until execution time. In these scenarios, size parameters should be set to the maximum possible I/O size at the time of submission and can be set to the actual size prior to the stream I/O execution.
Refer to the following for more information:
Parameters:
- bufPtrBase: The base address of the buffer in the memory into which to read. The buffer can be allocated using either cudaMemory, cudaMallocHost, malloc, or mmap. For registered buffers, bufPtrBase must remain set to the base address used in BufRegister call
- sizeP: Pointer to size in bytes to read. If the exact size is not known at the time of I/O submission, then yo must set it to the maximum possible I/O size for that stream I/O
- fileOffsetP: Pointer to offset in the file from which to read. Unless otherwise set using StreamRegister API, this value will not be evaluated until execution time
- bufPtrOffsetP: Pointer to the offset relative to the bufPtrBase pointer from which to write. Unless otherwise set using StreamRegister API, this value will not be evaluated until execution time
- bytesReadP: Pointer to the bytes read from the specified filehandle. This pointer should be a non NULL value and *bytesReadP set to 0. After successful execution of the operation in the stream, the value *bytesReadP will contain either: The number of bytes successfully read. -1 on IO errors. All other errors return a negative integer value of the OpError enum value
- stream: CUDA stream in which to enqueue the operation. If NULL, make this operation synchronous
A nil error means a successful submission.
Errors:
- CU_FILE_CUDA_ERROR: on CUDA-specific errors. CUresult code can be obtained by using CU_FILE_CUDA_ERR(err).
- CU_FILE_DRIVER_ERROR: if the nvidia-fs driver cannot handle the request.
- CU_FILE_ERROR_INVALID_VALUE: on an input failure.
Wraps cuFileReadAsync.
func (Handle) Write ¶
func (h Handle) Write(bufPtrBase uintptr, size uint, fileOffset int64, bufPtrOffset int64) (int64, error)
Write writes specified bytes from the device memory into the file descriptor using GDS.
This API writes the data from the GPU memory or the host memory to a file specified by the file handle at a specified offset and size bytes by using GDS functionality. The API works correctly for unaligned offset and data sizes, although the performance is not on-par with aligned writes.This is a synchronous call and will block until the IO is complete.
Note: GDS functionality modified the standard file system metadata in SysMem. However, GDS functionality does not take any special responsibility for writing that metadata back to permanent storage. The data is not guaranteed to be present after a system crash unless the application uses an explicit fsync(2) call. If the file is opened with an O_SYNC flag, the metadata will be written to the disk before the call is complete. Refer to the note in Handle.Read for more information about bufPtrOffset:. Refer to the following for more information:
Parameters:
- bufPtrBase: Base address of buffer in device memory or host memory. For registered buffers, bufPtrBase must remain set to the base address used in the BufRegister call
- size: Size in bytes to which to write
- fileOffset: Offset in the file to which to write
- bufPtrOffset: Offset relative to the bufPtrBase pointer from which to write. This parameter should be used only with registered buffers
Write returns the count. If it is negative, Write returns 0 and an error instead: an *ErrnoError if it is -1, which reports a failure in errno and carries it, and otherwise a *CallError whose Result.Err (OpError) is the negated count. An unavailable library or symbol is also an error.
Wraps cuFileWrite.
func (Handle) WriteAsync ¶
func (h Handle) WriteAsync(bufPtrBase uintptr, sizeP *uint, fileOffsetP *int64, bufPtrOffsetP *int64, bytesWrittenP *int64, stream driver.Stream) error
WriteAsync Queues Handle.Write operation for the specified bytes from the device memory into the cuFile handle by using GDS.
- This API writes the data from the GPU memory to a file specified by the file handle at a specified offset and size bytes by using GDS functionality. This is an asynchronous call and enqueues the operation into the specified CUDA stream and will not block the host thread for IO completion. The operation can be waited upon by using cuStreamSynchronize(stream).
- The bytes_written pointer should be allocated with cuMemHostAlloc or registered with cuMemHostRegister, and the pointer to access that memory from the device can be obtained by using cuMemHostGetDevicePointer.
- Operations that are enqueued with cuFile Stream APIs are FIFO ordered with respect to other work on the stream and must be completed before continuing to the next action in the stream.
- Unless otherwise specified through StreamRegister API, file offset, buffer offset or size parameter will not be evaluated until execution time. In these scenarios, size parameters should be set to the maximum possible I/O size at the time of submission and can be set to the actual size prior to the stream I/O execution.
See the following for more information:
Parameters:
- bufPtrBase: The base address of the buffer in the memory from which to write. The buffer can be allocated using either cudaMemory/cudaMallocHost/malloc/mmap. For registered buffers, bufPtrBase must remain set to the base address used in the BufRegister call
- sizeP: Pointer to the size in bytes to write. If the exact size is not known at the time of I/O submission, then you must set it to the maximum possible I/O size for that stream I/O
- fileOffsetP: Pointer to the offset in the file from which to write. Unless otherwise set using StreamRegister API, this value will not be evaluated until execution time
- bufPtrOffsetP: Pointer to the offset relative to the bufPtrBase pointer from which to write. Unless otherwise set using StreamRegister API, this value will not be evaluated until execution time
- bytesWrittenP: Pointer to the bytes written to the specified filehandle.This pointer should be a non NULL value and *bytesWrittenP set to 0. After successful execution of the operation in the stream, the value *bytesWrittenP will contain either: The number of bytes successfully written. -1 on IO errors. All other errors will return a negative integer value of the OpError enum value
- stream: The CUDA stream to enqueue the operation
A nil error means a successful submission.
Errors:
- CU_FILE_CUDA_ERROR: on CUDA-specific errors. The CUresult code can be obtained by using CU_FILE_CUDA_ERR(err).
- CU_FILE_DRIVER_ERROR: if the nvidia-fs driver cannot handle the request.
- CU_FILE_ERROR_INVALID_VALUE: on an input failure.
Wraps cuFileWriteAsync.
type IOParams ¶
type IOParams struct {
// Data stores the raw bytes of the underlying C type.
Data [8]uint64
}
IOParams is the opaque form of CUfileIOParams_t, whose members Go cannot declare as fields. Its methods reach each member at the position the C compiler measured.
These members have no accessor:
- file_offset: its type has no computable size
- devPtr_offset: its type has no computable size
func (*IOParams) DevPtrBase ¶
DevPtrBase returns the devPtr_base member of CUfileIOParams_t, at byte 8.
func (*IOParams) SetDevPtrBase ¶
SetDevPtrBase sets the devPtr_base member of CUfileIOParams_t.
type LibraryAttempt ¶
LibraryAttempt records one failed attempt to open the shared library.
type LibraryConflictError ¶
type LibraryConflictError struct {
Loaded string
Requested string
// Implicit reports that the loaded library was opened lazily and no
// successful Load has since acknowledged it. A
// caller that sees this called some
// other function first, and that call took the default search list.
Implicit bool
}
LibraryConflictError reports a Load call naming a different library than the one already loaded. Only one library is loaded per process.
func (*LibraryConflictError) Error ¶
func (e *LibraryConflictError) Error() string
Error reports the conflicting library paths, and whether the library that is already loaded got there without a Load call.
type LibraryError ¶
type LibraryError struct {
Library string
Env string
Path string
Attempts []LibraryAttempt
Hint string
}
LibraryError reports that libcufile could not be opened. Attempts lists every name tried in order. Path is set when an explicit path, from Load or CUFILE_LIB_PATH, was requested and failed. Hint reports pkg-config discovery results and query failures, when discovery ran.
func (*LibraryError) Error ¶
func (e *LibraryError) Error() string
Error describes the library load attempts and their errors.
func (*LibraryError) Unwrap ¶
func (e *LibraryError) Unwrap() []error
Unwrap returns the error from each attempt.
type OpCounter ¶
OpCounter represents counter structure for tracking operation successes and failures.
type OpError ¶
type OpError int32
OpError represents cufileop status enum.
Note: on success the error code is set to @ref Success.
Note: The error code can be inspected using @ref IS_CUFILE_ERR and @ref CUFILE_ERRSTR.
Note: The error code if set to @ref CudaDriverError, then cuda error can be inspected using @ref IS_CUDA_ERR and @ref CU_FILE_CUDA_ERR.
Note: Data path errors are captured via standard error codes.
const ( Success OpError = 0 DriverNotInitialized OpError = 5001 DriverInvalidProps OpError = 5002 DriverUnsupportedLimit OpError = 5003 DriverVersionMismatch OpError = 5004 DriverVersionReadError OpError = 5005 DriverClosing OpError = 5006 PlatformNotSupported OpError = 5007 IoNotSupported OpError = 5008 DeviceNotSupported OpError = 5009 NvfsDriverError OpError = 5010 CudaDriverError OpError = 5011 CudaPointerInvalid OpError = 5012 CudaMemoryTypeInvalid OpError = 5013 CudaPointerRangeError OpError = 5014 CudaContextMismatch OpError = 5015 InvalidMappingSize OpError = 5016 InvalidMappingRange OpError = 5017 InvalidFileType OpError = 5018 InvalidFileOpenFlag OpError = 5019 DioNotSet OpError = 5020 InvalidValue OpError = 5022 MemoryAlreadyRegistered OpError = 5023 MemoryNotRegistered OpError = 5024 PermissionDenied OpError = 5025 DriverAlreadyOpen OpError = 5026 HandleNotRegistered OpError = 5027 HandleAlreadyRegistered OpError = 5028 DeviceNotFound OpError = 5029 InternalError OpError = 5030 GetnewfdFailed OpError = 5031 NvfsSetupError OpError = 5033 IoDisabled OpError = 5034 BatchSubmitFailed OpError = 5035 GpuMemoryPinningFailed OpError = 5036 BatchFull OpError = 5037 AsyncNotSupported OpError = 5038 InternalBatchSetupError OpError = 5039 InternalBatchSubmitError OpError = 5040 InternalBatchGetstatusError OpError = 5041 InternalBatchCancelError OpError = 5042 NomemError OpError = 5043 IoError OpError = 5044 InternalBufRegisterError OpError = 5045 HashOprError OpError = 5046 InvalidContextError OpError = 5047 NvfsInternalDriverError OpError = 5048 BatchNocompatError OpError = 5049 IoMaxError OpError = 5050 )
type P2PFlags ¶
type P2PFlags int32
P2PFlags represents CUfileP2PFlags_t.
const ( CufileP2pdma P2PFlags = 0 // !< Support for PCI P2PDMA CufileNvfs P2PFlags = 1 // !< Support for nvidia-fs CufileDmabuf P2PFlags = 2 // !< Support for DMA Buffer CufileC2C P2PFlags = 3 // !< Support for Chip-to-Chip (Grace-based systems) CufileNvidiaPeermem P2PFlags = 4 // !< Only for IBM Spectrum Scale and WekaFS )
func DriverGetP2PFlags ¶
func DriverGetP2PFlags(statusFlag DriverStatusFlags) (P2PFlags, error)
DriverGetP2PFlags gets the P2P flags for a specific filesystem or block device.
This API is used to query what P2P modes are supported by cuFile for a certain filesystem or block device.
Requires CUDA 13.1 or later; see HasDriverGetP2PFlags.
- statusFlag: The filesystem/device status flag (for example, LustreSupported)
- p2pFlags: The P2P flags
Errors:
- DriverNotInitialized: if the cuFile driver is not initialized.
- InvalidValue: if p2p_flags is NULL.
Wraps cuFileDriverGetP2PFlags.
type PerGpuStats ¶
type PerGpuStats struct {
Uuid [16]byte
ReadBytes uint64
ReadBwBytesPerSec uint64
ReadUtilization uint64
ReadDurationUs uint64
NTotalReads uint64
NP2pReads uint64
NNvfsReads uint64
NPosixReads uint64
NUnalignedReads uint64
NDrReads uint64
NSparseRegions uint64
NInlineRegions uint64
NReadsErr uint64
WritesBytes uint64
WriteBwBytesPerSec uint64
WriteUtilization uint64
WriteDurationUs uint64
NTotalWrites uint64
NP2pWrites uint64
NNvfsWrites uint64
NPosixWrites uint64
NUnalignedWrites uint64
NDrWrites uint64
NWritesErr uint64
NMmap uint64
NMmapOk uint64
NMmapErr uint64
NMmapFree uint64
RegBytes uint64
}
PerGpuStats represents Per-GPU statistics structure used in Level 3.
type StatsLevel1 ¶
type StatsLevel1 struct {
ReadOps OpCounter
WriteOps OpCounter
HdlRegisterOps OpCounter
HdlDeregisterOps OpCounter
BufRegisterOps OpCounter
BufDeregisterOps OpCounter
ReadBytes uint64
WriteBytes uint64
ReadBwBytesPerSec uint64
WriteBwBytesPerSec uint64
ReadLatAvgUs uint64
WriteLatAvgUs uint64
ReadOpsPerSec uint64
WriteOpsPerSec uint64
ReadLatSumUs uint64
WriteLatSumUs uint64
BatchSubmitOps OpCounter
BatchCompleteOps OpCounter
BatchSetupOps OpCounter
BatchCancelOps OpCounter
BatchDestroyOps OpCounter
BatchEnqueuedOps OpCounter
BatchPosixEnqueuedOps OpCounter
BatchProcessedOps OpCounter
BatchPosixProcessedOps OpCounter
BatchNvfsSubmitOps OpCounter
BatchP2pSubmitOps OpCounter
BatchAioSubmitOps OpCounter
BatchIouringSubmitOps OpCounter
BatchMixedIoSubmitOps OpCounter
BatchTotalSubmitOps OpCounter
BatchReadBytes uint64
BatchWriteBytes uint64
BatchReadBwBytes uint64
BatchWriteBwBytes uint64
BatchSubmitLatAvgUs uint64
BatchCompletionLatAvgUs uint64
BatchSubmitOpsPerSec uint64
BatchCompleteOpsPerSec uint64
BatchSubmitLatSumUs uint64
BatchCompletionLatSumUs uint64
LastBatchReadBytes uint64
LastBatchWriteBytes uint64
ReadvOps OpCounter
WritevOps OpCounter
ReadvBytes uint64
WritevBytes uint64
ReadvBwBytesPerSec uint64
WritevBwBytesPerSec uint64
ReadvLatAvgUs uint64
WritevLatAvgUs uint64
ReadvOpsPerSec uint64
WritevOpsPerSec uint64
ReadvLatSumUs uint64
WritevLatSumUs uint64
}
StatsLevel1 represents level 1 Statistics: Basic IO and operation counters.
func GetStatsL1 ¶
func GetStatsL1() (StatsLevel1, error)
GetStatsL1 gets Level 1 cuFile statistics.
Level 1 provides basic I/O and operation counters including read and write operations, bytes transferred, bandwidth, latency, and batch operation statistics.
Requires CUDA 13.0 or later; see HasGetStatsL1.
- stats: Pointer to StatsLevel1 structure to be filled
Errors:
- DriverNotInitialized
- CU_FILE_ERROR_INVALID_VALUE
Wraps cuFileGetStatsL1.
type StatsLevel2 ¶
type StatsLevel2 struct {
Basic StatsLevel1
ReadSizeKbHist [32]uint64
WriteSizeKbHist [32]uint64
}
StatsLevel2 represents level 2 Statistics: Includes Level 1 plus size histograms and detailed metrics.
Its layout differs across the releases this package supports, and this type has the newest. The statistics getters select a verified native layout and normalize their results; fields absent from an older layout are zero.
func GetStatsL2 ¶
func GetStatsL2() (StatsLevel2, error)
GetStatsL2 gets Level 2 cuFile statistics.
Level 2 includes all Level 1 statistics plus size histograms for read and write operations. The histograms track the distribution of I/O operation sizes, useful for analyzing I/O size patterns and optimization.
Requires CUDA 13.0 or later; see HasGetStatsL2.
- stats: Pointer to StatsLevel2 structure to be filled
Errors:
- DriverNotInitialized
- CU_FILE_ERROR_INVALID_VALUE
Wraps cuFileGetStatsL2.
type StatsLevel3 ¶
type StatsLevel3 struct {
Detailed StatsLevel2
NumGpus uint32
PerGpuStats [16]PerGpuStats
}
StatsLevel3 represents level 3 Statistics: Includes Level 2 plus per-GPU and subsystem statistics.
Its layout differs across the releases this package supports, and this type has the newest. The statistics getters select a verified native layout and normalize their results; fields absent from an older layout are zero.
func GetStatsL3 ¶
func GetStatsL3() (StatsLevel3, error)
GetStatsL3 gets Level 3 cuFile statistics.
Level 3 includes all Level 2 statistics plus per-GPU breakdown of operations, bandwidth, utilization, and buffer registration statistics. This level provides detailed analysis of which GPUs are being used, how operations are distributed across GPUs, and the type of I/O path used (P2P, NVFS, or POSIX). The per-GPU breakdown includes operation counts, bandwidth metrics, utilization percentages, and buffer registration statistics. This level has the highest performance overhead but provides the most detailed insights for performance analysis and debugging.
Requires CUDA 13.0 or later; see HasGetStatsL3.
- stats: Pointer to StatsLevel3 structure to be filled
Errors:
- DriverNotInitialized
- CU_FILE_ERROR_INVALID_VALUE
Wraps cuFileGetStatsL3.
type Status ¶
type Status int32
Status represents CUfileStatus_t.
const ( CufileWaiting Status = 0x000001 // required value prior to submission CufilePending Status = 0x000002 // once enqueued CufileInvalid Status = 0x000004 // request was ill-formed or could not be enqueued CufileCanceled Status = 0x000008 // request successfully canceled CufileComplete Status = 0x0000010 // request successfully completed CufileTimeout Status = 0x0000020 // request timed out CufileFailed Status = 0x0000040 // unable to complete )
type SymbolError ¶
SymbolError reports that a symbol is not callable.
Err distinguishes the two ways that happens. A nil Err means the loaded library does not export the symbol, which is what an installation older than the symbol looks like. A non-nil Err means the library does export it and the binding itself failed; the library is not at fault.
func (*SymbolError) Error ¶
func (e *SymbolError) Error() string
Error reports the uncallable library symbol and, when the symbol was present but could not be bound, why.
func (*SymbolError) Unwrap ¶
func (e *SymbolError) Unwrap() error
Unwrap returns the reason the symbol could not be bound, or nil when the loaded library does not export it.