Replies: 1 comment
-
Hi @sswam. I'll try and modify this text to be a bit more accurate. This comment is actually slightly outdated. Thanks for the link on That being said, you can use mmapped buffers (so zero-copy) to create those tensors in both libraries. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In your readme under Notes -> Zero-copy, it says:
POSIX mmap accepts a flag MAP_PRIVATE to create a private copy-on-write mapping. This works on Linux, MacOS, BSD, etc. Windows has an equivalent function CreateFileMapping which also supports copy on write.
Numpy has a function numpy.lib.format.open_memmap which abstracts over these two implementations. Here's an article describing how to use copy-on-write mmap from numpy: https://pythonspeed.com/articles/reduce-memory-array-copies/
I don't know how to do this in pytorch, but surely it's possible.
Beta Was this translation helpful? Give feedback.
All reactions