gpuMapFile (Function)

Signature: gpuMapFile(path: string, offset: int, count: int) -> Result<GpuBuffer<t0>, Error>

Description: Maps count elements of a file, starting at a byte offset, as a read-only GpuBuffer of the requested numeric type. Nothing is copied: on unified memory the GPU reads the file's own pages.

Parameters

  • path (string): The file to map
  • offset (int): The byte offset, a multiple of the element width
  • count (int): How many elements to map

Returns: Result<GpuBuffer<t0>, Error>

Example

let weights: Result<GpuBuffer<float32>, Error> = gpuMapFile("weights.bin", 0, 1024)
print("mapped")
let weights: Result<GpuBuffer<float32>, Error> = gpuMapFile ("weights.bin", 0, 1024)
print "mapped"