kvikio
kvikio copied to clipboard
Add `seek` and `tell` to Python `CuFile` object
To make it easier to drop CuFile objects in where other Python file objects are accepted, it would be nice to have seek and tell methods. This would allow a user to go to a file offset and also check what file offset they are at.
I think it could be a good idea, but it will require some smart chunking under the hood. This is because all of our reads and writes (incl. all of the cuFile API) takes ranges.
Could we simply store an off_t offset inside the CuFile object that we then simply do some integer math with to determine where to read and write from?
Or is there some existing behavior under-the-hood that would complicate this approach?
Sorry, yes that would work. I was more thinking of using it together with https://github.com/rapidsai/kvikio/issues/577 where stream read and write would not use GDS or parallel IO if we don't do something clever :)