{"id":18485951,"url":"https://github.com/helmholtz-analytics/mpi4torch","last_synced_at":"2025-04-08T19:33:02.897Z","repository":{"id":42661111,"uuid":"273531696","full_name":"helmholtz-analytics/mpi4torch","owner":"helmholtz-analytics","description":"An MPI wrapper for the pytorch tensor library that is automatically differentiable","archived":false,"fork":false,"pushed_at":"2023-03-27T14:32:22.000Z","size":141,"stargazers_count":9,"open_issues_count":2,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-19T22:02:45.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://mpi4torch.readthedocs.io","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helmholtz-analytics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-19T15:50:46.000Z","updated_at":"2025-02-11T21:27:40.000Z","dependencies_parsed_at":"2024-11-06T12:51:49.415Z","dependency_job_id":"c437d4bb-f72b-4170-ae93-e70abc8c4382","html_url":"https://github.com/helmholtz-analytics/mpi4torch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helmholtz-analytics%2Fmpi4torch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helmholtz-analytics%2Fmpi4torch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helmholtz-analytics%2Fmpi4torch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helmholtz-analytics%2Fmpi4torch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helmholtz-analytics","download_url":"https://codeload.github.com/helmholtz-analytics/mpi4torch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247912789,"owners_count":21017045,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T12:47:15.671Z","updated_at":"2025-04-08T19:33:02.545Z","avatar_url":"https://github.com/helmholtz-analytics.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"![mpi4torch Logo](./doc/_static/img/mpi4torch-logo-extrawhitespace.png)\n\n--------------------------------------------------------------------------------\n\nmpi4torch is an automatic-differentiable wrapper of MPI functions for the pytorch tensor library.\n\nMPI stands for Message Passing Interface and is the de facto standard communication interface on\nhigh-performance computing resources. To facilitate the usage of pytorch on these resources an MPI wrapper\nthat is transparent to pytorch's automatic differentiation (AD) engine is much in need. This library tries\nto bridge this gap.\n\n# Installation\n\nmpi4torch is also hosted on PyPI. However, due to the ABI-incompatibility of the different MPI implementations it\nis not provided as a binary wheel and needs to be built locally. Hence, you should have an appropriate C++ compiler\ninstalled, as well as the  **development files of your MPI library** be present. The latter are usually provided\nthrough the *module system* of your local cluster, and you should consult the manuals of your cluster for this,\nor through the package manager of your Linux distribution.\n\nOnce the dependencies have been satisfied the installation can be triggered by the usual\n```\n    pip install mpi4torch\n```\n\n# Usage\n\nIt is **highly advised** to first read [the basic usage chapter of the documentation](https://mpi4torch.readthedocs.io/en/latest/basic_usage.html)\nbefore jumping into action, since there are some implications of the pytorch AD design on the usage of mpi4torch.\nIn other words, there are some footguns lurking!\n\nYou have been warned, but if you insist on an easy usage example, consider the following code snippet,\nwhich is an excerpt from [examples/simple_linear_regression.py](examples/simple_linear_regression.py)\n\n```python\n   comm = mpi4torch.COMM_WORLD\n\n   def lossfunction(params):\n       # average initial params to bring all ranks on the same page\n       params = comm.Allreduce(params, mpi4torch.MPI_SUM) / comm.size\n\n       # compute local loss\n       localloss = torch.sum(torch.square(youtput - some_parametrized_function(xinput, params)))\n\n       # sum up the loss among all ranks\n       return comm.Allreduce(localloss, mpi4torch.MPI_SUM)\n```\n\nHere we have parallelized a loss function simply by adding two calls to `Allreduce`. For a more thorough\ndiscussion of the example see [here](https://mpi4torch.readthedocs.io/en/latest/examples.html#simple-data-parallel-example).\n\n# Tests\n\nRunning tests is as easy as\n```\n    mpirun -np 2 nose2\n```\n\n# Project Status\n\n[![Tests](https://github.com/helmholtz-analytics/mpi4torch/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/helmholtz-analytics/mpi4torch/actions/workflows/test.yml)\n[![Documentation Status](https://readthedocs.org/projects/mpi4torch/badge/?version=latest)](https://mpi4torch.readthedocs.io/en/latest/?badge=latest)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelmholtz-analytics%2Fmpi4torch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelmholtz-analytics%2Fmpi4torch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelmholtz-analytics%2Fmpi4torch/lists"}