{"id":19705838,"url":"https://github.com/llnl/ygm","last_synced_at":"2026-01-23T07:27:32.575Z","repository":{"id":37079538,"uuid":"244682928","full_name":"LLNL/ygm","owner":"LLNL","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-28T22:16:21.000Z","size":1008,"stargazers_count":36,"open_issues_count":17,"forks_count":24,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-28T23:27:20.481Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LLNL.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-MIT","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,"zenodo":null}},"created_at":"2020-03-03T16:14:26.000Z","updated_at":"2025-03-26T09:35:14.000Z","dependencies_parsed_at":"2023-11-29T00:22:33.587Z","dependency_job_id":"436b902c-0228-403b-bc88-edb0301122ad","html_url":"https://github.com/LLNL/ygm","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2Fygm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2Fygm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2Fygm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2Fygm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LLNL","download_url":"https://codeload.github.com/LLNL/ygm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251540224,"owners_count":21605866,"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-11T21:30:50.513Z","updated_at":"2026-01-23T07:27:32.535Z","avatar_url":"https://github.com/LLNL.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is YGM?\n\nYGM is an asynchronous communication library designed for irregular communication patterns. It is built on a\ncommunicator abstraction, much like MPI, but communication is handled asynchronously and is initiated by senders without\nany interaction with receivers. YGM features\n* **Message buffering** - Increases application throughput.\n* **Fire-and-Forget RPC Semantics** - A sender provides the function and function arguments for execution on a specified\n  destination rank through an `async` call. This function will complete on the destination rank at an unspecified time\n  in the future, but YGM does not explicitly make the sender aware of this completion.\n* **Storage Containers** - YGM provides a collection of distributed storage containers with asynchronous\n  interfaces, used for many common distributed memory operations. Containers are designed to partition data, allowing\ninsertions to occur from any rank. Data is accessed through collective `for_all` operations that execute a user-provided\nfunction on every stored object, or, when a particular piece of data's location is known, `visit`-type operations that\nperform a user-provided function only on the desired data. These containers are found\n[here](/include/ygm/container/).\n\n# Getting Started\n\n## Requirements\n* C++17 - GCC versions 8, 9 and 10 are tested. Your mileage may vary with other compilers.\n* [Cereal](https://github.com/USCiLab/cereal) - C++ serialization library\n* MPI\n* Optionally, Boost 1.77 to enable Boost.JSON support.  \n\n\n## Using YGM with CMake\nYGM is a header-only library that is easy to incorporate into a project through CMake. Adding the following to\nCMakeLists.txt will install YGM and its dependencies as part of your project:\n```\nset(DESIRED_YGM_VERSION 0.4)\nfind_package(ygm ${DESIRED_YGM_VERSION} CONFIG)\nif (NOT ygm_FOUND)\n    FetchContent_Declare(\n        ygm\n        GIT_REPOSITORY https://github.com/LLNL/ygm\n        GIT_TAG v${DESIRED_YGM_VERSION}\n    )\n    FetchContent_GetProperties(ygm)\n    if (ygm_POPULATED)\n        message(STATUS \"Found already populated ygm dependency: \"\n                       ${ygm_SOURCE_DIR}\n        )\n    else ()\n        set(JUST_INSTALL_YGM ON)\n        set(YGM_INSTALL ON)\n        FetchContent_Populate(ygm)\n        add_subdirectory(${ygm_SOURCE_DIR} ${ygm_BINARY_DIR})\n        message(STATUS \"Cloned ygm dependency \" ${ygm_SOURCE_DIR})\n    endif ()\nelse ()\n    message(STATUS \"Found installed ygm dependency \" ${ygm_DIR})\nendif ()\n```\n\n# Anatomy of a YGM Program\nHere we will walk through a basic \"hello world\" YGM program. The [examples directory](/examples/) contains several other\nexamples, including many using YGM's storage containers.\n\nTo begin, headers for a YGM communicator are needed\n``` C++\n#include \u003cygm/comm.hpp\u003e\n```\n\nAt the beginning of the program, a YGM communicator must be constructed. It will be given `argc` and `argv` like\n`MPI_Init`, and it has an optional third argument that specifies the aggregate size (in bytes) allowed for all send\nbuffers before YGM begins flushing sends. Here, we will make a buffer with 32MB of aggregate send buffer space.\n``` C++\nygm::comm world(\u0026argc, \u0026argv, 32*1024*1024);\n```\n\nNext, we need a lambda to send through YGM. We'll do a simple hello\\_world type of lambda.\n``` C++\nauto hello_world_lambda = [](const std::string \u0026name) {\n\tstd::cout \u003c\u003c \"Hello \" \u003c\u003c name \u003c\u003c std::endl;\n};\n```\n\nFinally, we use this lambda inside of our `async` calls. In this case, we will have rank 0 send a message to rank 1,\ntelling it to greet the world\n``` C++\nif (world.rank0()) {\n\tworld.async(1, hello_world_lambda, std::string(\"world\"));\n}\n```\n\nThe full, compilable version of this example is found [here](/examples/hello_world.cpp). Running it prints a single\n\"Hello world\".\n\n# Potential Pitfalls\n\n## Allowed Lambdas\nThere are two distinct classes of lambdas that can be given to YGM: *remote lambdas* and *local lambdas*, each of which\nhas different requirements.\n\n### Remote Lambdas\nA *remote lambda* is any lambda that may potentially be executed on a different rank. These lambdas are identified as\nbeing those given to a `ygm::comm` or any of the storage containers through a function prefixed by `async_`.\n\nThe defining feature of remote lambdas is they **must not** capture any variables; all variables must be provided as\narguments. This limitation is due to the lack of\nability for YGM to inspect and extract these arguments when serializing messages to be sent to other ranks.\n\n### Local Lambdas\nA *local lambda* is any lambda that is guaranteed not to be sent to a remote rank. These lambdas are identified as being\nthose given to a `for_all` operation on a storage container.\n\nThe defining feature of local lambdas is that all arguments besides what is stored in the container must be captured.\nInternally, these lambdas may be given to a [`std::for_each`](https://en.cppreference.com/w/cpp/algorithm/for_each) that\niterates over the container's elements stored locally on each rank.\n\n# License\nYGM is distributed under the MIT license.\n\nAll new contributions must be made under the MIT license.\n\nSee [LICENSE-MIT](LICENSE-MIT), [NOTICE](NOTICE), and [COPYRIGHT](COPYRIGHT) for\ndetails.\n\nSPDX-License-Identifier: MIT\n\n# Release\nLLNL-CODE-789122\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllnl%2Fygm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllnl%2Fygm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllnl%2Fygm/lists"}