Skip to content

Commit a4451c8

Browse files
kyle-yh-kimj-xiong
authored andcommitted
Update bindings/rust/README.md to reflect the recommended build process.
Signed-off-by: Kyle Kim <[email protected]>
1 parent 1a749cb commit a4451c8

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ resolver = "3"
1515
[workspace.package]
1616
version = "0.1.0"
1717
edition = "2024"
18-
description = "Lightweight Rust bindings for Libfabric - a communication API for high-performance parallel and distributed applications."
18+
description = "The official distribution of lightweight Rust bindings for Libfabric - a communication API for high-performance parallel and distributed applications, by the OFI Working Group."
1919
authors = [
2020
"Libfabric Developers <[email protected]>",
2121
]

bindings/rust/README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# ofi-libfabric-sys
2+
3+
The official distribution of lightweight Rust bindings for Libfabric - a communication API for high-performance parallel and distributed applications, by the OFI Working Group.
4+
15
### Motivation
26

37
Increasing number of HPC networking code is being written in Rust. Naturally, to
@@ -14,15 +18,19 @@ unit upon compilation.
1418
### Build
1519

1620
```
21+
// Not strictly necessary for the build process, but necessary for running the built library.
22+
LD_LIBRARY_PATH={your_directory_containing_libfabric.so}
23+
1724
// Clean the existing build.
1825
cargo clean
1926
20-
// Build, using the Libfabric binary that is compiled on-the-fly.
21-
cargo build --features vendored
27+
// [Recommended] Build, using the already installed Libfabric.
28+
PKG_CONFIG_PATH={your_directory_containing_libfabric.pc} cargo build
2229
23-
// Build, using the already installed Libfabric.
24-
// You may be required to set `PKG_CONFIG_PATH` env variable to point towards `libfabric.pkg` file.
25-
cargo build
30+
// [Only for library development] Build, using the Libfabric binary that is compiled on-the-fly.
31+
// The vendored option is not supported for library import scenario (imported under Cargo.toml).
32+
// Rather, it is meant for developers building the ofi-libfabric-sys library under the libfabric repo.
33+
cargo build --features vendored
2634
2735
// Unit-tests.
2836
cargo test
@@ -37,6 +45,8 @@ Add the crate dependency under your Rust application's `Cargo.toml` file. Then;
3745

3846
```rust
3947
use ofi_libfabric_sys::bindgen as ffi;
48+
use std::ffi::CString;
49+
use std::ptr;
4050

4151
fn test_get_info() {
4252
unsafe {
@@ -45,10 +55,10 @@ fn test_get_info() {
4555
assert_eq!(hints.is_null(), false);
4656

4757
(*hints).caps = ffi::FI_MSG as u64;
48-
(*hints).mode = ff::FI_CONTEXT;
58+
(*hints).mode = ffi::FI_CONTEXT;
4959
(*(*hints).ep_attr).type_ = ffi::fi_ep_type_FI_EP_RDM;
5060
(*(*hints).domain_attr).mr_mode = ffi::FI_MR_LOCAL as i32;
51-
let prov_name = CString::new("efa").unwrap();
61+
let prov_name = CString::new("tcp").unwrap();
5262
(*(*hints).fabric_attr).prov_name = prov_name.into_raw() as *mut i8;
5363

5464
// Get Fabric info based on the hints.
@@ -80,7 +90,7 @@ fn test_get_info() {
8090

8191
- `build.rs`: The actual build script for the bindgen.
8292
- `src/lib.rs`: The generated binding is copy-pasted programmatically and
83-
publicly exported under `bindings` namespace.
93+
publicly exported under `bindgen` namespace.
8494
- `wrapper.[ch]`: Wrapper source files that simply calls the static inline
8595
functions. This way, an isolated translation unit for each static inline
8696
function is made, for which the Rust bindgen is able to link against it.

0 commit comments

Comments
 (0)