Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rk3568 remote dataflow #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ dora-rs/rs-latency-old/target/
**/*.pyc

**/**/target/
**/**/.cargo
**/**/install
**/**/log
**/**/build
Expand Down
2 changes: 2 additions & 0 deletions dora-rs/rs-latency/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target."armv7-unknown-linux-musleabi"]
rustflags = "-C target-feature=-crt-static"
89 changes: 76 additions & 13 deletions dora-rs/rs-latency/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 54 additions & 5 deletions dora-rs/rs-latency/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,62 @@
## Remote Dataflow
## Prepare dora for rk3568
Quickest way:
```
wget https://github.com/dora-rs/dora/releases/download/v0.3.5/dora-v0.3.5-armv7-unknown-linux-musleabihf.zip
unzip dora-v0.3.5-armv7-unknown-linux-musleabihf.zip
```
Manual:
```bash
git clone https://github.com/dora-rs/dora.git
cd dora
docker pull messense/rust-musl-cross:armv7-musleabi
docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:armv7-musleabi bash
# in docker container
rustup target list
rustup target add armv7-unknown-linux-musleabi
cargo build -p dora-cli --release --target armv7-unknown-linux-musleabi
```
## Send dora to rk3568:
```bash
# in host machine
hdc file send target/armv7-unknown-linux-musleabi/release/dora /data
hdc shell
cd data
chmod +x dora
# start dora
./dora up
./dora check
```
## Compile node and sink
```bash
cd dora-benchmark/dora-rs/rs-latency
cargo build --release --all
docker pull messense/rust-musl-cross:armv7-musleabi
docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:armv7-musleabi bash
# in docker container
cargo build --release --all --target armv7-unknown-linux-musleabi
# in host machine
hdc file send target/armv7-unknown-linux-musleabi/release/benchmark-example-sink /data
hdc shell

To run remote dataflow
# in rk3568
cd /data
chmod +x benchmark-example-sink
```
## Run remote dataflow

```bash
dora destroy
# in host machine
dora coordinator &
dora daemon --machine-id A &
dora daemon --machine-id B --local-listen-port 53292 &
dora daemon --machine-id B &

# in rk3568
./dora daemon --machine-id A --coordinator-addr <host-ip>:53290 &

# in host machine
cd dora-benchmark/dora-rs/rs-latency
dora start remote_dataflow.yml

# in rk3568
cd /data
cat timer.csv
```
2 changes: 1 addition & 1 deletion dora-rs/rs-latency/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dora-node-api = { workspace = true }
dora-node-api = { workspace = true }
eyre = "0.6.8"
futures = "0.3.21"
rand = "0.8.5"
Expand Down
2 changes: 0 additions & 2 deletions dora-rs/rs-latency/node/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use dora_node_api::Event;
use dora_node_api::{self, arrow::array::UInt64Array, dora_core::config::DataId, DoraNode};
use rand::Rng;
use std::time::Duration;
use uhlc::system_time_clock;

fn main() -> eyre::Result<()> {
Expand All @@ -10,7 +9,6 @@ fn main() -> eyre::Result<()> {

let (mut node, mut events) = DoraNode::init_from_env()?;
let sizes = [1, 10 * 512, 100 * 512, 1000 * 512, 10000 * 512];

// test latency first
for size in sizes {
for _ in 0..100 {
Expand Down
10 changes: 7 additions & 3 deletions dora-rs/rs-latency/remote_dataflow.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
nodes:
- id: rust-node
_unstable_deploy:
machine: A
machine: B
custom:
build: cargo build -p benchmark-example-node --release
path: ./target/release/benchmark-example-node
inputs:
Expand All @@ -11,9 +12,12 @@ nodes:
- throughput
- id: rust-sink
_unstable_deploy:
machine: B
machine: A
local: false
working_dir: /data
custom:
build: cargo build -p benchmark-example-sink --release
path: ./target/release/benchmark-example-sink
path: ./benchmark-example-sink
inputs:
latency: rust-node/latency
throughput: rust-node/throughput
Expand Down
4 changes: 3 additions & 1 deletion dora-rs/rs-latency/sink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dora-node-api = { workspace = true }
dora-node-api = { workspace = true }
eyre = "0.6.8"
rand = "0.8.5"
uhlc = "0.5.1"
bytemuck = "1.12"
csv = "1.1.6"
sysinfo = "0.30.13"
once_cell = "1.19.0"
19 changes: 11 additions & 8 deletions dora-rs/rs-latency/sink/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ use dora_node_api::arrow::array::{AsArray, PrimitiveArray};
use dora_node_api::arrow::datatypes::UInt64Type;
use dora_node_api::{self, DoraNode, Event};
use eyre::ContextCompat;
use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::time::{Duration, Instant};
use uhlc::system_time_clock;
use uhlc::HLC;
use sysinfo::System;
use uhlc::{system_time_clock, HLC};

static LANGUAGE: &str = "Rust";
static PLATFORM: &str = "[email protected]";
static NAME: &str = "dora-rs daemon Rust";
static PLATFORM: Lazy<String> = Lazy::new(|| {
let sys = System::new_all();
if let Some(cpu) = sys.cpus().first() {
format!("{}@{:.2}GHz", cpu.brand(), cpu.frequency() as f64 / 1_000.0)
} else {
"Unknown".to_string()
}
});

fn main() -> eyre::Result<()> {
let (_node, mut events) = DoraNode::init_from_env()?;
Expand All @@ -35,7 +43,6 @@ fn main() -> eyre::Result<()> {
for size in sizes {
root_vec.insert(size, vec![0u64; size]);
}

while let Some(event) = events.recv() {
match event {
Event::Input {
Expand All @@ -49,7 +56,6 @@ fn main() -> eyre::Result<()> {
let array = array.values();
let time_u64 = array.get(0).context("could not slice data")?;
let t_send = uhlc::NTP64(*time_u64);

// .to_vec() Data Latency
// let _owned_data = array.to_vec();

Expand All @@ -58,9 +64,7 @@ fn main() -> eyre::Result<()> {
// .get_mut(&data.len())
// .unwrap()
// .copy_from_slice(array);

let t_received = system_time_clock();

latencies.push((t_received - t_send).to_duration());
let data_len = data.len() * 8;
if data_len != current_size {
Expand Down Expand Up @@ -103,7 +107,6 @@ fn record_results(
.unwrap();
let mut wtr = Writer::from_writer(file);
let name = std::env::var("NAME").unwrap_or_else(|_| NAME.to_string());

wtr.write_record(&[
date.to_string(),
LANGUAGE.to_string(),
Expand Down