Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tfmoraes
Created April 19, 2011 18:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfmoraes/929168 to your computer and use it in GitHub Desktop.
Save tfmoraes/929168 to your computer and use it in GitHub Desktop.
Testing numpy memmap with multiprocessing
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import multiprocessing
import numpy as np
def print_matrix(matrix):
print matrix
def main():
matrix = np.memmap('test.dat', dtype='int16', mode='w+', shape=(100, 100))
p = multiprocessing.Process(target=print_matrix, args=(matrix,))
p.start()
p.join()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment