Class CuFile

java.lang.Object
ai.rapids.cudf.CuFile

public class CuFile extends Object
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 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

      public static void writeDeviceMemoryToFile(File path, long file_offset, long address, long length)
      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

      public static long appendDeviceBufferToFile(File path, BaseDeviceMemoryBuffer buffer)
      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

      public static long appendDeviceMemoryToFile(File path, long address, long length)
      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

      public static void readFileToDeviceMemory(long address, long length, File path, long fileOffset)
      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.