{"id":13533165,"url":"https://github.com/datenlord/async-rdma","last_synced_at":"2025-04-01T21:31:59.336Z","repository":{"id":39635328,"uuid":"345942619","full_name":"datenlord/async-rdma","owner":"datenlord","description":"Easy to use RDMA API in Rust async","archived":false,"fork":false,"pushed_at":"2023-11-21T04:51:31.000Z","size":570,"stargazers_count":341,"open_issues_count":17,"forks_count":40,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-23T17:36:53.996Z","etag":null,"topics":["async","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datenlord.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":"Contributing.md","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}},"created_at":"2021-03-09T08:56:40.000Z","updated_at":"2024-04-23T10:00:54.000Z","dependencies_parsed_at":"2023-11-21T05:39:32.913Z","dependency_job_id":"195c4eff-5b00-4217-bb60-eea8c271e65c","html_url":"https://github.com/datenlord/async-rdma","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datenlord%2Fasync-rdma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datenlord%2Fasync-rdma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datenlord%2Fasync-rdma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datenlord%2Fasync-rdma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datenlord","download_url":"https://codeload.github.com/datenlord/async-rdma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246713288,"owners_count":20821869,"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":["async","rust"],"created_at":"2024-08-01T07:01:17.177Z","updated_at":"2025-04-01T21:31:58.818Z","avatar_url":"https://github.com/datenlord.png","language":"Rust","funding_links":[],"categories":["Software","Rust"],"sub_categories":["Trends"],"readme":"# async-rdma\n\n\nA framework for writing RDMA applications with high-level abstraction and asynchronous APIs.\n\n[![Join the chat at https://gitter.im/datenlord/async-rdma](https://badges.gitter.im/datenlord/async-rdma.svg)](https://gitter.im/datenlord/async-rdma?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Crates.io][crates-badge]][crates-url]\n[![Docs][docs-badge]][docs-url]\n[![GPL licensed][gpl-badge]][gpl-url]\n[![Build Status][actions-badge]][actions-url]\n\n[crates-badge]: https://img.shields.io/crates/v/async-rdma.svg\n[crates-url]: https://crates.io/crates/async-rdma\n[docs-badge]: https://docs.rs/async-rdma/badge.svg\n[docs-url]: https://docs.rs/async-rdma/\n[gpl-badge]: https://img.shields.io/badge/license-GPLv3.0-blue.svg\n[gpl-url]: https://github.com/datenlord/async-rdma/blob/master/LICENSE\n[actions-badge]: https://github.com/datenlord/async-rdma/actions/workflows/ci.yml/badge.svg\n[actions-url]: https://github.com/datenlord/async-rdma/actions\n\nIt provides a few major components:\n\n* Tools for establishing connections with rdma endpoints such as `RdmaBuilder`.\n\n* High-level APIs for data transmission between endpoints including `read`,\n`write`, `send`, `receive`.\n\n* High-level APIs for rdma memory region management including `alloc_local_mr`,\n`request_remote_mr`, `send_mr`, `receive_local_mr`, `receive_remote_mr`.\n\n* A framework including `agent` and `event_listener` working behind APIs for memory\nregion management and executing rdma requests such as `post_send` and `poll`.\n\nThe [ChangeLog] file contains a brief summary of changes for each release.\n\n[ChangeLog]: https://github.com/datenlord/async-rdma/blob/master/ChangeLog.md\n\n## Environment Setup\n\nThis section is for RDMA novices who want to try this library.\n\nYou can skip if your Machines have been configured with RDMA.\n\nNext we will configure the RDMA environment in an Ubuntu20.04 VM.\nIf you are using another operating system distribution, please search and replace the relevant commands.\n\n### 1. Check whether the current kernel supports RXE\n\nRun the following command and if the CONFIG_RDMA_RXE = `y` or `m`, the current operating system supports RXE.\nIf not you need to search how to recompile the kernel to support RDMA.\n\n```shell\ncat /boot/config-$(uname -r) | grep RXE\n```\n\n### 2. Install Dependencies\n\n```shell\nsudo apt install -y libibverbs1 ibverbs-utils librdmacm1 libibumad3 ibverbs-providers rdma-core libibverbs-dev iproute2 perftest build-essential net-tools git librdmacm-dev rdmacm-utils cmake libprotobuf-dev protobuf-compiler clang curl\n```\n\n### 3. Configure RDMA netdev\n\n(1) Load kernel driver\n\n```shell\nmodprobe rdma_rxe\n```\n\n(2) User mode RDMA netdev configuration.\n\n```shell\nsudo rdma link add rxe_0 type rxe netdev ens33\n```\n\n`rxe_0` is the RDMA device name, and you can name it whatever you want. `ens33` is the name of the network device. The name of the network device may be different in each VM, and we can see it by running command \"ifconfig\".\n\n(3) Check the RDMA device state\n\nRun the following command and check if the state is `ACTIVE`.\n\n```shell\nrdma link\n```\n\n(4) Test it\n\nIb_send_bw is a program used to test the bandwidth of `RDMA SEND` operations.\n\nRun the following command in a terminal.\n\n```shell\nib_send_bw -d rxe_0\n```\n\nAnd run the following command in another terminal.\n\n```shell\nib_send_bw -d rxe_0 localhost\n```\n\n### 4. Install Rust\n\n```shell\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\nsource $HOME/.cargo/env\n```\n\n### 5. Try an example\n\n```shell\ngit clone https://github.com/datenlord/async-rdma.git\ncd async-rdma\ncargo run --example rpc\n```\n\nif run rpc example failed, you can try run it with sudo permission.\n\n```shell\ncargo build --example rpc\nsudo ./target/debug/examples/rpc\n```\n\n## Example\n\nA simple example: client request a remote memory region and put data into this remote\nmemory region by rdma `write`.\nAnd finally client `send_mr` to make server aware of this memory region.\nServer `receive_local_mr`, and then get data from this mr.\n\n```rust\nuse async_rdma::{LocalMrReadAccess, LocalMrWriteAccess, RdmaBuilder};\nuse portpicker::pick_unused_port;\nuse std::{\n    alloc::Layout,\n    io::{self, Write},\n    net::{Ipv4Addr, SocketAddrV4},\n    time::Duration,\n};\n\nasync fn client(addr: SocketAddrV4) -\u003e io::Result\u003c()\u003e {\n    let layout = Layout::new::\u003c[u8; 8]\u003e();\n    let rdma = RdmaBuilder::default().connect(addr).await?;\n    // alloc 8 bytes remote memory\n    let mut rmr = rdma.request_remote_mr(layout).await?;\n    // alloc 8 bytes local memory\n    let mut lmr = rdma.alloc_local_mr(layout)?;\n    // write data into lmr\n    let _num = lmr.as_mut_slice().write(\u0026[1_u8; 8])?;\n    // write the second half of the data in lmr to the rmr\n    rdma.write(\u0026lmr.get(4..8).unwrap(), \u0026mut rmr.get_mut(4..8).unwrap())\n        .await?;\n    // send rmr's meta data to the remote end\n    rdma.send_remote_mr(rmr).await?;\n    Ok(())\n}\n\n#[tokio::main]\nasync fn server(addr: SocketAddrV4) -\u003e io::Result\u003c()\u003e {\n    let rdma = RdmaBuilder::default().listen(addr).await?;\n    // receive mr's meta data from client\n    let lmr = rdma.receive_local_mr().await?;\n    let data = *lmr.as_slice();\n    println!(\"Data written by the client using RDMA WRITE: {:?}\", data);\n    assert_eq!(data, [[0_u8; 4], [1_u8; 4]].concat());\n    Ok(())\n}\n\n#[tokio::main]\nasync fn main() {\n    let addr = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), pick_unused_port().unwrap());\n    std::thread::spawn(move || server(addr));\n    tokio::time::sleep(Duration::new(1, 0)).await;\n    client(addr)\n        .await\n        .map_err(|err| println!(\"{}\", err))\n        .unwrap();\n}\n\n```\n\n## Getting Help\n\nFirst, see if the answer to your question can be found in the found [API doc] or [Design doc]. If the answer is not here, please open an issue and describe your problem in detail.\n\n[Design doc]: https://github.com/datenlord/async-rdma/tree/master/doc\n[API doc]: https://docs.rs/async-rdma/0.2.0/async_rdma/\n\n## Related Projects\n\n* [`rdma-sys`]: Rust bindings for RDMA fundamental libraries: libibverbs-dev and librdmacm-dev.\n\n[`rdma-sys`]: https://github.com/datenlord/rdma-sys\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatenlord%2Fasync-rdma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatenlord%2Fasync-rdma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatenlord%2Fasync-rdma/lists"}