gpuIota (Function)

Signature: gpuIota(n: int) -> Result<GpuBuffer<int>, Error>

Description: Returns the index buffer [0, n), or Error for a negative count, byte-size overflow or allocation failure. Zero succeeds with an empty buffer.

Parameters

  • n (int): The element count

Returns: Result<GpuBuffer<int>, Error>

Example

match gpuIota(4) {
    Success { value } => match fromGpu(value) {
        Success { value } => forEachList(value, print)
        Error { message } => print(message)
    }
    Error { message } => print(message)
}  // 0, 1, 2, 3