{ "info": { "author": "Jed Hollom", "author_email": "Jedhollom@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7" ], "description": "# Mpimap\n\nThis package is a wrapper for `mpi4py` to allow for the easy running of functions in parallel on a single computer or on multiple nodes of a HPC cluster.\n\nThe code used to implement the `mpimap` methods will also function when no `mpi` environment is used, or only a single processor is specified.\n\n## Setup\n\nOnce imported, create an instance of the `Mpimap` class:\n\n```\nmpi = mpimap.Mpimap()\n```\n\nTo have each `mpi` process print its information, use:\n\n```\nmpi.info()\n```\n\nAt this point, all `mpi` instance still continue to process all lines within the `script.py` being run or command sent to the interpreter. To put all worker nodes into a \"listening\" state where they only accept commands sent from the head process, use:\n\n```\nmpi.start()\n```\n\nFrom this point, command in the `script.py` running or command sent to the interpreter will only be processed by the head process. To determined the status of each worker process after it has been started, use:\n\n```\nmpi.status()\n```\n\nTo kill all worker nodes once finished, use:\n\n```\nmpi.stop()\n```\n\n## Functions\n\nTo run code on each of the worker nodes once they have being \"listening\" for jobs, include the code in a function with no arguments and use:\n\n```\nmpi.run(func)\n```\n\n`Mpimap` include a `map()` function which behaves as the `builtin` version included with python:\n\n```\noutput = mpi.map(func, args)\n```\n\nThis will send a copy of the function to all worker nodes, and then queue the args list, sending values to each node not currently running a job. The input order is maintained by the output.\n\n`Mpimap` also includes the function `gmap()`. This is a special instance of `map()` that is intended for running groups of jobs where an argument returning a \"failed\" state results in all jobs within that group being canceled:\n\n```\noutput = mpi.gmap(func, args, groupind=0, failstate=None)\n```\n\nFor this function, `args` is a list of lists. The argument `groupind` determines which entry in each list run by the function is used to determine that jobs group. The argument `failstate` is the value checked to determine if the job was a success or failure.\n\nAn addition static function is included called `gmatrix`. This can be used to generate a list of all possible combinations of two lists, include an input id number and append constants to all combinations:\n\n```\nx = [1, 2, 3]\ny = [10, 20]\nconstants = ('a', 'b')\nout = mpi.gmatrix(x, y, *constants)\n```\n\nThis example would return:\n\n```\n>>> out\n[('0', 1, 10, 'a', 'b'),\n('1', 1, 20, 'a', 'b'),\n('2', 2, 10, 'a', 'b'),\n('3', 2, 20, 'a', 'b'),\n('4', 3, 10, 'a', 'b'),\n('5', 3, 20, 'a', 'b')]\n```\n\n## Example\n\nTo test the provided functions and check the difference in processing time between `builtin.map()` and `mpimap.map()`, run the example python script:\n\n```\nmpirun -n python example.py\n```\n\nThe full working example is given here:\n\n```\nimport mpimap\nimport time\n\ndef func_cheap(*args):\n\t\"\"\"Do nothing\"\"\"\n\treturn\n\n\ndef func_expensive(n):\n\t\"\"\"Basic factorising problem\"\"\"\n\tfactors = set([])\n\tfor i in xrange(n - 1):\n\t\ti = i + 1\n\t\t# Skip factors\n\t\tif i in factors:\n\t\t\tcontinue\n\t\t# Find factors\n\t\tif n % i == 0:\n\t\t\tfactors.add(i)\n\t\t\tfactors.add(n / i)\n\n\treturn sorted(factors)\n\n\n# Build mpi\nmpi = mpimap.Mpimap(sleep=0, debug=False)\nmpi.info()\nmpi.start()\n\n# Run function on all nodes\nmpi.run(func_cheap)\n\n# Set up function and arguments\nargs = range(5000, 10000)\n\n# Not in parallel\nt0 = time.time()\nres = map(func_expensive, args)\ndt = time.time() - t0\nprint '\\nNon Parallel: {}'.format(dt)\n\n# Parallel\nt0 = time.time()\nres = mpi.map(func_expensive, args)\ndt = time.time() - t0\nprint '\\nParallel: {}\\n'.format(dt)\n\nmpi.stop()\nmpi.exit()\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://gitlab.com/Wokpak/mpimap", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "mpimap", "package_url": "https://pypi.org/project/mpimap/", "platform": "", "project_url": "https://pypi.org/project/mpimap/", "project_urls": { "Homepage": "http://gitlab.com/Wokpak/mpimap" }, "release_url": "https://pypi.org/project/mpimap/1.0.4/", "requires_dist": [ "multiprocessing", "mpi4py", "dill" ], "requires_python": "", "summary": "Parallel function mapping using mpi4py", "version": "1.0.4" }, "last_serial": 4563462, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "9050be4ae2840848156d13e2bd05fb0a", "sha256": "efeebe9a37934ba7f469a219e429d4cf0a9c0ee4258bcf910035389c40f7c636" }, "downloads": -1, "filename": "mpimap-1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "9050be4ae2840848156d13e2bd05fb0a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3694, "upload_time": "2018-12-04T14:14:23", "url": "https://files.pythonhosted.org/packages/28/54/51382b5df1bc71ce5c82e07c9fc1f224777e2fc8840378604b35c20560d7/mpimap-1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "049ff129bc5fd9d07774303554b525e1", "sha256": "4000491f0c9781bb372eb70b54dea8f88c9caeeb71a5217f7fac172c5f8a8afb" }, "downloads": -1, "filename": "mpimap-1.0.tar.gz", "has_sig": false, "md5_digest": "049ff129bc5fd9d07774303554b525e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3307, "upload_time": "2018-12-04T14:14:25", "url": "https://files.pythonhosted.org/packages/a9/4b/280cf2bf8a5e9530c10e1fde77c725c001a99e5a3f34d0cffe4bcd311ba9/mpimap-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "95423a3a1a047a75ab076f64959cb32c", "sha256": "8f6fdeb8c66d6b76419566b7091f582494f82effd48423fa1a45eab809862f27" }, "downloads": -1, "filename": "mpimap-1.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "95423a3a1a047a75ab076f64959cb32c", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5219, "upload_time": "2018-12-04T15:04:10", "url": "https://files.pythonhosted.org/packages/89/04/f2bebd8dcc0df0f69b0a00cff1d4d778f98cf77930198da408d865af4f67/mpimap-1.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5a899557547ff5248bb34688c7967585", "sha256": "87280a340bd27334333c25bd165d5d670ee2b8f1634d2f7b162101226aff35b1" }, "downloads": -1, "filename": "mpimap-1.0.1.tar.gz", "has_sig": false, "md5_digest": "5a899557547ff5248bb34688c7967585", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5065, "upload_time": "2018-12-04T15:04:11", "url": "https://files.pythonhosted.org/packages/46/c8/76907f05729132b731ca5ef0ae8883090ac4eb137fa54e4dbe5284d3b163/mpimap-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "8d97094dcae91b18566c50f271478833", "sha256": "3ac33e94b4a22be30e497e3d38706cf8aff182874b71cdcc1ad4f3e2d1fb27a9" }, "downloads": -1, "filename": "mpimap-1.0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "8d97094dcae91b18566c50f271478833", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5218, "upload_time": "2018-12-04T15:09:55", "url": "https://files.pythonhosted.org/packages/a0/ca/8b938c646c077fb4dc4568827a588bb8f4387642466dee94b3dbe728c5cc/mpimap-1.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61b60d1a64b578259a774f099271983e", "sha256": "2c25d5de1bb879fa404caeefb2d11e1794145b3b7eef722482b864941e2eb9a3" }, "downloads": -1, "filename": "mpimap-1.0.2.tar.gz", "has_sig": false, "md5_digest": "61b60d1a64b578259a774f099271983e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5067, "upload_time": "2018-12-04T15:09:57", "url": "https://files.pythonhosted.org/packages/43/94/2a90f57b038e4e684cb93a6ed460c2bd8983b574dc8b2714a7112eda80fd/mpimap-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "fff0ae48ceb849e81a46d7b2e009bf5c", "sha256": "1f1854469c6c9f78e14904ae383f8f3bdbac737c87a51aa966e72674818e470f" }, "downloads": -1, "filename": "mpimap-1.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "fff0ae48ceb849e81a46d7b2e009bf5c", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5147, "upload_time": "2018-12-04T15:17:15", "url": "https://files.pythonhosted.org/packages/9d/08/9c1f92a18e957ee42b69004aa0d42566e2905c93f1bcb6e7c78dda875977/mpimap-1.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5c45246cf17a9b13c35730a267822dde", "sha256": "887d8e72749f9c5a038f24d50ae68edb6eb1e6dbffa51a7992225a43b06f4d81" }, "downloads": -1, "filename": "mpimap-1.0.3.tar.gz", "has_sig": false, "md5_digest": "5c45246cf17a9b13c35730a267822dde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4982, "upload_time": "2018-12-04T15:17:17", "url": "https://files.pythonhosted.org/packages/0b/14/73628904ddf18dff0b37b11e9507ec901cfa3ccfd58bda01649ebaab57ab/mpimap-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "20d94f4e8902d4ab36a954c917f66b3d", "sha256": "1e631421a6dff083bf30759537334f54967c76c41d8d8514e701d8518d60910b" }, "downloads": -1, "filename": "mpimap-1.0.4-py2-none-any.whl", "has_sig": false, "md5_digest": "20d94f4e8902d4ab36a954c917f66b3d", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5178, "upload_time": "2018-12-05T11:32:39", "url": "https://files.pythonhosted.org/packages/0e/12/22135dde54ecb6c3c16ecdbf0cf4bee88de44fc802df1d8a29e22897b399/mpimap-1.0.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9fec25e6d670ada19b3e6e5b9bf953ae", "sha256": "fef13a63100b2d5f90c2890a45d2964b8d76d5460d7703adc5ff554b4580c2cc" }, "downloads": -1, "filename": "mpimap-1.0.4.tar.gz", "has_sig": false, "md5_digest": "9fec25e6d670ada19b3e6e5b9bf953ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5025, "upload_time": "2018-12-05T11:32:40", "url": "https://files.pythonhosted.org/packages/27/22/e9f6fcd21a60a360b81c31720c1953eddd7293cb21d1dd7d466de43a1596/mpimap-1.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "20d94f4e8902d4ab36a954c917f66b3d", "sha256": "1e631421a6dff083bf30759537334f54967c76c41d8d8514e701d8518d60910b" }, "downloads": -1, "filename": "mpimap-1.0.4-py2-none-any.whl", "has_sig": false, "md5_digest": "20d94f4e8902d4ab36a954c917f66b3d", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5178, "upload_time": "2018-12-05T11:32:39", "url": "https://files.pythonhosted.org/packages/0e/12/22135dde54ecb6c3c16ecdbf0cf4bee88de44fc802df1d8a29e22897b399/mpimap-1.0.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9fec25e6d670ada19b3e6e5b9bf953ae", "sha256": "fef13a63100b2d5f90c2890a45d2964b8d76d5460d7703adc5ff554b4580c2cc" }, "downloads": -1, "filename": "mpimap-1.0.4.tar.gz", "has_sig": false, "md5_digest": "9fec25e6d670ada19b3e6e5b9bf953ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5025, "upload_time": "2018-12-05T11:32:40", "url": "https://files.pythonhosted.org/packages/27/22/e9f6fcd21a60a360b81c31720c1953eddd7293cb21d1dd7d466de43a1596/mpimap-1.0.4.tar.gz" } ] }