cufile

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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")
}

Index

Examples

Constants

View Source
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

func BufDeregister(bufPtrBase uintptr) error

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

func BufRegister(bufPtrBase uintptr, length uint, flags int32) error

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:

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:

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

func DriverSetMaxCacheSize(maxCacheSize uint) error

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:

Wraps cuFileDriverSetMaxCacheSize.

func DriverSetMaxDirectIOSize

func DriverSetMaxDirectIOSize(maxDirectIoSize uint) error

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:

Wraps cuFileDriverSetMaxDirectIOSize.

func DriverSetMaxPinnedMemSize

func DriverSetMaxPinnedMemSize(maxPinnedSize uint) error

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:

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.

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

func DriverSetPollMode(poll bool, pollThresholdSize uint) error

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:

Wraps cuFileDriverSetPollMode.

func ExportPCIeTopology

func ExportPCIeTopology(filename *byte) error

ExportPCIeTopology wraps cuFileExportPCIeTopology.

Requires CUDA 13.2 or later; see HasExportPCIeTopology.

func GetBARSizeInKB

func GetBARSizeInKB(gpuIndex int32) (uint, error)

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:

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:

Wraps cuFileGetParameterBool.

func GetParameterGpuBounceBufferSlabArray

func GetParameterGpuBounceBufferSlabArray(sizeValues *uint, countValues *uint, len_ int32) error

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.

Errors:

Wraps cuFileGetParameterMinMaxValue.

func GetParameterPosixPoolSlabArray

func GetParameterPosixPoolSlabArray(sizeValues *uint, countValues *uint, len_ int32) error

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:

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:

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:

Wraps cuFileGetParameterString.

func GetStatsLevel

func GetStatsLevel() (int32, error)

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

func GetVersion() (int32, error)

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:

Wraps cuFileGetVersion.

func Has

func Has(symbol string) bool

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

func Load(path string) error

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:

Wraps cuFileSetParameterBool.

func SetParameterGpuBounceBufferSlabArray

func SetParameterGpuBounceBufferSlabArray(sizeValues *uint, countValues *uint, len_ int32) error

SetParameterGpuBounceBufferSlabArray wraps cuFileSetParameterGpuBounceBufferSlabArray.

Requires CUDA 13.2 or later; see HasSetParameterGpuBounceBufferSlabArray.

func SetParameterPosixPoolSlabArray

func SetParameterPosixPoolSlabArray(sizeValues *uint, countValues *uint, len_ int32) error

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:

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:

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:

Wraps cuFileSetParameterString.

func SetStatsLevel

func SetStatsLevel(level int32) error

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

func StreamDeregister(stream driver.Stream) error

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

func StreamRegister(stream driver.Stream, flags uint32) error

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.

func UseCount

func UseCount() (int, error)

UseCount wraps cuFileUseCount. The error reports an unavailable library or symbol.

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:

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.

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:

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:

Wraps cuFileBatchIOSubmit.

type BatchMode

type BatchMode int32

BatchMode represents CUfileBatchMode_t.

const (
	CufileBatch BatchMode = 1
)

func (BatchMode) String

func (e BatchMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type BindFailure

type BindFailure struct {
	Symbol string
	Err    error
}

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

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

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

String returns the constant name, or a numeric representation for unknown values.

type CallError

type CallError struct {
	Func   string // the C symbol called
	Result Error
}

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.

func (*CallError) Error

func (e *CallError) Error() string

Error reports the C symbol called and the result it returned.

func (*CallError) Unwrap

func (e *CallError) Unwrap() error

Unwrap returns the result the call reported.

type CudaResult

type CudaResult int32

CudaResult is a CUDA driver result code.

type CufileRDMAInfo

type CufileRDMAInfo struct {
	Version int32
	DescLen int32
	DescStr uintptr
}

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

func DriverGetProperties() (DrvProps, error)

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:

Parameters:

  • props: Pointer to the cuFile Driver properties

Errors:

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.

func (Error) Error

func (r Error) Error() string

Error reports a cufile operation failure.

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

func HandleRegister(descr *Descr) (Handle, error)

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

func (h Handle) Deregister() error

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) Readv

func (h Handle) Readv(iov *IOVec, iovcnt uint, fileOffset int64, flags uint32) (int64, error)

Readv wraps cuFileReadv.

Requires CUDA 13.4 or later; see HasReadv.

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.

func (Handle) Writev

func (h Handle) Writev(iov *IOVec, iovcnt uint, fileOffset int64, flags uint32) (int64, error)

Writev wraps cuFileWritev.

Requires CUDA 13.4 or later; see HasWritev.

type IOEvents

type IOEvents struct {
	Cookie uintptr
	Status Status
	Ret    uint
}

IOEvents represents CUfileIOEvents_t.

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) Cookie

func (i *IOParams) Cookie() uintptr

Cookie returns the cookie member of CUfileIOParams_t, at byte 56.

func (*IOParams) DevPtrBase

func (i *IOParams) DevPtrBase() uintptr

DevPtrBase returns the devPtr_base member of CUfileIOParams_t, at byte 8.

func (*IOParams) Fh

func (i *IOParams) Fh() Handle

Fh returns the fh member of CUfileIOParams_t, at byte 40.

func (*IOParams) Mode

func (i *IOParams) Mode() BatchMode

Mode returns the mode member of CUfileIOParams_t, at byte 0.

func (*IOParams) Opcode

func (i *IOParams) Opcode() Opcode

Opcode returns the opcode member of CUfileIOParams_t, at byte 48.

func (*IOParams) SetCookie

func (i *IOParams) SetCookie(v uintptr)

SetCookie sets the cookie member of CUfileIOParams_t.

func (*IOParams) SetDevPtrBase

func (i *IOParams) SetDevPtrBase(v uintptr)

SetDevPtrBase sets the devPtr_base member of CUfileIOParams_t.

func (*IOParams) SetFh

func (i *IOParams) SetFh(v Handle)

SetFh sets the fh member of CUfileIOParams_t.

func (*IOParams) SetMode

func (i *IOParams) SetMode(v BatchMode)

SetMode sets the mode member of CUfileIOParams_t.

func (*IOParams) SetOpcode

func (i *IOParams) SetOpcode(v Opcode)

SetOpcode sets the opcode member of CUfileIOParams_t.

func (*IOParams) SetSize

func (i *IOParams) SetSize(v uint)

SetSize sets the size member of CUfileIOParams_t.

func (*IOParams) Size

func (i *IOParams) Size() uint

Size returns the size member of CUfileIOParams_t, at byte 32.

type IOVec

type IOVec struct {
	Base uintptr
	Len  uint
}

IOVec represents CUfileIOVec_t.

type LibraryAttempt

type LibraryAttempt struct {
	Name string // path or soname passed to dlopen
	Err  error
}

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

type OpCounter struct {
	Ok  uint64
	Err uint64
}

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
)

func (OpError) String

func (e OpError) String() string

String returns the constant name, or a numeric representation for unknown values.

type Opcode

type Opcode int32

Opcode represents CUfileOpcode_t.

const (
	CufileRead  Opcode = 0
	CufileWrite Opcode = 1
)

func (Opcode) String

func (e Opcode) String() string

String returns the constant name, or a numeric representation for unknown values.

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:

Wraps cuFileDriverGetP2PFlags.

func (P2PFlags) String

func (e P2PFlags) String() string

String returns the constant name, or a numeric representation for unknown values.

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.

Errors:

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.

Errors:

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.

Errors:

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
)

func (Status) String

func (e Status) String() string

String returns the constant name, or a numeric representation for unknown values.

type SymbolError

type SymbolError struct {
	Symbol string
	Err    error
}

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.

type Timespec

type Timespec struct {
	Sec  int64
	Nsec int64
	// contains filtered or unexported fields
}

Timespec is a Linux timespec value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL