Created
March 20, 2014 10:48
-
-
Save piskvorky/9661228 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
# load a 10k x 10k array (800MB) previously stored with | |
# numpy.save('/tmp/x.npy', numpy.random.rand(10000, 10000)) | |
shared = [numpy.load('/tmp/x.npy', mmap_mode='r') for _ in range(10)] | |
# touch all elements in all 10 copies of the same mmap'ed array | |
print [x.sum() for x in shared] | |
# ...resident/real mem spikes at 10x 800MB, nothing shared? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment