Skip to content

Improve all-in-memory file copy architecture (Python at least) #12641

Closed

Description

@quaeler

Current file copy (at least via Python tf.gfile.Copy (gfile.py→ file_io.py → file_io.i)) involves copying the source contents into memory, and then writing memory to the destination. For scenarios like #12630 which is working with an 11GB asset, this is unacceptable design.

file_system.h's WritableFile is not stubbed to allow anything like a streaming, though its RandomAccessFile is. (not entirely, entirely, true - i suppose WriteableFile.Append(const StringPiece& data) could be employed in a streamable fashion -ish.)

To cull the Python low hanging fruit, at least, please implement file_io.i using a regular streaming design instead of the above described current design.

Activity

  1. yongtang commented on Aug 28, 2017

    @yongtang
    Member

    Created a PR #12658 for that.

  2. added
    type:feature
    on Aug 30, 2017
  3. jart commented on Aug 30, 2017

    @jart
    Contributor

    Slurping the whole file into memory and writing it back out isn't exactly optimal. Streaming would be great. What would be even better is the sendfile system call, which does it entirely in kernel space. If would be terrific if @rohan100jain was able to implement that when src and dst are Unix FS, and do streaming otherwise.

  4. added and removed
    type:feature
    on Aug 30, 2017
  5. yongtang commented on Aug 31, 2017

    @yongtang
    Member

    The implementation of CopyFile in PR #12658 has been updated with calling sendfile in Linux for posix file systems. Please take a look.

  6. tensorflowbutler commented on Dec 20, 2017

    @tensorflowbutler
    Member

    It has been 14 days with no activity and this issue has an assignee.Please update the label and/or status accordingly.

  7. tensorflowbutler commented on Jan 3, 2018

    @tensorflowbutler
    Member

    It has been 14 days with no activity and this issue has an assignee.Please update the label and/or status accordingly.

  8. tensorflowbutler commented on Jan 18, 2018

    @tensorflowbutler
    Member

    Nagging Assignee: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

  9. tensorflowbutler commented on Feb 6, 2018

    @tensorflowbutler
    Member

    Nagging Assignee: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

  10. jart commented on Feb 6, 2018

    @jart
    Contributor

    There's a PR somewhere adding in-kernel sendfile copy support I spent a lot of time helping to review a while back. I don't know what the status of that is, but I hope the author is generous enough to bring it to completion, because it'd be a great notch in his belt because this isn't an easy problem to solve.

  11. quaeler commented on Feb 6, 2018

    @quaeler
    ContributorAuthor

    It's the PR cited above - #12658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions