Package ai.rapids.cudf
Class CuFile
java.lang.Object
ai.rapids.cudf.CuFile
JNI wrapper for accessing the cuFile API.
Using this wrapper requires GPUDirect Storage (GDS)/cuFile to be installed in the target environment, and the jar to be built with `USE_GDS=ON`. Otherwise it will throw an exception when loading.
The Java APIs are experimental and subject to change.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic long
appendDeviceBufferToFile
(File path, BaseDeviceMemoryBuffer buffer) Append a device buffer to a given file path synchronously.static long
appendDeviceMemoryToFile
(File path, long address, long length) Append device memory to a given file path synchronously.static boolean
Check if the libcufilejni library is loaded.static void
readFileToDeviceBuffer
(BaseDeviceMemoryBuffer buffer, File path, long fileOffset) Read a file into a device buffer synchronously.static void
readFileToDeviceMemory
(long address, long length, File path, long fileOffset) Read a file into device memory synchronously.static void
writeDeviceBufferToFile
(File path, long file_offset, BaseDeviceMemoryBuffer buffer) Write a device buffer to a given file path synchronously.static void
writeDeviceMemoryToFile
(File path, long file_offset, long address, long length) Write device memory to a given file path synchronously.
-
Constructor Details
-
CuFile
public CuFile()
-
-
Method Details
-
libraryLoaded
public static boolean libraryLoaded()Check if the libcufilejni library is loaded.- Returns:
- true if the libcufilejni library has been successfully loaded.
-
writeDeviceBufferToFile
public static void writeDeviceBufferToFile(File path, long file_offset, BaseDeviceMemoryBuffer buffer) Write a device buffer to a given file path synchronously.This method is NOT thread safe if the path points to the same file on disk.
- Parameters:
path
- The file path to copy to.file_offset
- The file offset from which to write the buffer.buffer
- The device buffer to copy from.
-
writeDeviceMemoryToFile
Write device memory to a given file path synchronously.This method is NOT thread safe if the path points to the same file on disk.
- Parameters:
path
- The file path to copy to.file_offset
- The file offset from which to write the buffer.address
- The device memory address to copy from.length
- The length to copy.
-
appendDeviceBufferToFile
Append a device buffer to a given file path synchronously.This method is NOT thread safe if the path points to the same file on disk.
- Parameters:
path
- The file path to copy to.buffer
- The device buffer to copy from.- Returns:
- The file offset from which the buffer was appended.
-
appendDeviceMemoryToFile
Append device memory to a given file path synchronously.This method is NOT thread safe if the path points to the same file on disk.
- Parameters:
path
- The file path to copy to.address
- The device memory address to copy from.length
- The length to copy.- Returns:
- The file offset from which the buffer was appended.
-
readFileToDeviceBuffer
public static void readFileToDeviceBuffer(BaseDeviceMemoryBuffer buffer, File path, long fileOffset) Read a file into a device buffer synchronously.This method is NOT thread safe if the path points to the same file on disk.
- Parameters:
buffer
- The device buffer to copy into.path
- The file path to copy from.fileOffset
- The file offset from which to copy the content.
-
readFileToDeviceMemory
Read a file into device memory synchronously.This method is NOT thread safe if the path points to the same file on disk.
- Parameters:
address
- The device memory address to read into.length
- The length to read.path
- The file path to copy from.fileOffset
- The file offset from which to copy the content.
-