Skip to content

Commit 1009675

Browse files
committed
feat: add workflow of Threading
1 parent 8c6a7cd commit 1009675

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

.github/workflows/Threading.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: threading
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
reasoning:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
components: clippy
21+
override: true
22+
23+
- name: Repl
24+
run: |
25+
cargo build --features="repl" --release
26+
27+
- name: Threading
28+
run: |
29+
./target/release/3body -V
30+
./target/release/3body -c '给 cx 以 程心(); 给 研制曲率飞船 以 法则() { 给 掩体纪年 以 5; 面壁 (掩体纪年 <= 11) { 冬眠(1000); 广播(["研制曲率飞船", 掩体纪年]); 掩体纪年 = 掩体纪年 + 1; } } 给 星环公司 以 [cx.thread(研制曲率飞船), cx.thread(研制曲率飞船), cx.thread(研制曲率飞船), cx.thread(研制曲率飞船), cx.thread(研制曲率飞船)]; 冬眠(12000)'

interpreter/src/evaluator/builtins.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ use llm::{load_progress_callback_stdout as load_callback, InferenceParameters, M
1919
use llm_base::InferenceRequest;
2020
#[cfg(feature="sophon")]
2121
use std::{convert::Infallible, io::Write, path::Path};
22-
use std::time::Duration;
2322
#[cfg(feature="sophon")]
2423
use spinoff;
25-
use crate::evaluator::object::Object::Native;
2624

2725
pub fn new_builtins() -> HashMap<String, Object> {
2826
let mut builtins = HashMap::new();
@@ -367,15 +365,13 @@ fn three_body_threading(args: Vec<Object>) -> Object {
367365
.build()
368366
.unwrap();
369367

370-
// 在 LocalSet 中安排任务
371368
local_set.spawn_local(async move {
372369
let mut ev = Evaluator {
373370
env: Rc::new(RefCell::new(Env::from(new_builtins()))),
374371
};
375372
ev.eval(&stmts);
376373
});
377374

378-
// 运行 LocalSet 直到其中的任务完成
379375
rt.block_on(local_set);
380376
});
381377

@@ -657,8 +653,5 @@ mod tests {
657653
}
658654
}
659655

660-
#[test]
661-
#[cfg(feature="threading")]
662-
fn test_three_body_threading() {
663-
}
656+
664657
}

0 commit comments

Comments
 (0)