Adding multiline/IOV APIs
In some cases a user needs to write a list of binary data (like using writelines). It would be useful to have an API like this when working with multiple frames.
Similarly it might be handy to have some kind of API for reading in data to multiple buffers. There is not exactly an analogous API in Python. Though socket.recvmsg_into is close (so might be a starting point).
This can be particularly helpful if the GIL is released in the background as there can be one API call that releases the GIL as opposed to a couple in rapid succession.
@madsbk do you know whether something like this is possible today?
I think this is possible using the non-blocking API, pread and pwrite. At least, we do release the GIL when calling IOFuture.get():
https://github.com/rapidsai/kvikio/blob/branch-23.08/python/kvikio/_lib/libkvikio.pyx#L23
Interesting was thinking more of things like preadv & pwritev
This way one could give a list of Array-like objects to KvikIO, which could in turn covert them into an iovec-like object under-the-hood
I think that is a good idea but I would suggest that preadv and pwritev just returns a list of futures. Then we can have a waitall functions that waits on all futures in a list.
The preadv / pwritev option is a good idea we should consider
Another suggestion the GDS team made to us is potentially using the cuFile batched API. As Mads mentioned offline, we have a C++ implementation in KvikIO ( https://github.com/rapidsai/kvikio/pull/220 ). Though currently this is not exposed in Python
Let's continue this in https://github.com/rapidsai/kvikio/issues/204