Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mkumakech authored Oct 22, 2021
1 parent d76351c commit a805ddf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions BIT 322.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"cells":[{"metadata":{},"cell_type":"markdown","source":"<h2> BIT 322 Distributed System Development lab activity </h2>"},{"metadata":{"trusted":true},"cell_type":"code","source":"# Parallelizing with Pool.starmap_async()","execution_count":7,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"import multiprocessing as mp\npool = mp.Pool(mp.cpu_count())","execution_count":8,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"results = [4,5,6,7,9,8,2,1]\ndef howmany_within_range2(i, row, minimum, maximum):\n results = pool.starmap_async(howmany_within_range2, [(i, row, 4, 8) for i, row in enumerate(data)]).get()\n# With map, use `howmany_within_range_rowonly` instead\n# results = pool.map_async(howmany_within_range_rowonly, [row for row in data]).get()\npool.close()\nprint(results[:10])","execution_count":9,"outputs":[{"output_type":"stream","text":"[4, 5, 6, 7, 9, 8, 2, 1]\n","name":"stdout"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"},"language_info":{"name":"python","version":"3.6.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":5}

0 comments on commit a805ddf

Please sign in to comment.