Skip to content

Commit 927680e

Browse files
authored
fix: Resolve compilation warnings in xtask
fix: Resolve compilation warnings in xtask
2 parents 2a76cdc + e78fd63 commit 927680e

File tree

6 files changed

+355
-80
lines changed

6 files changed

+355
-80
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ cargo xtask learn learning-lm-rs --submodule https://github.com/LearningInfiniTe
4444
# 配置 rustlings 课程
4545
cargo xtask learn rustlings --submodule https://github.com/rust-lang/rustlings.git
4646

47+
# 配置 learning-cxx 课程
4748
cargo xtask learn learning-cxx --submodule
4849

4950
# 评测 learning-lm-rs 课程

eval_result.json

Lines changed: 157 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,178 @@
11
{
22
"exercises": [
33
{
4-
"name": "f16_overflow.rs",
5-
"result": false
4+
"name": "exercise00",
5+
"result": true
6+
},
7+
{
8+
"name": "exercise01",
9+
"result": true
10+
},
11+
{
12+
"name": "exercise02",
13+
"result": true
14+
},
15+
{
16+
"name": "exercise03",
17+
"result": true
18+
},
19+
{
20+
"name": "exercise04",
21+
"result": true
22+
},
23+
{
24+
"name": "exercise05",
25+
"result": true
26+
},
27+
{
28+
"name": "exercise06",
29+
"result": true
30+
},
31+
{
32+
"name": "exercise07",
33+
"result": true
34+
},
35+
{
36+
"name": "exercise08",
37+
"result": true
38+
},
39+
{
40+
"name": "exercise09",
41+
"result": true
642
},
743
{
8-
"name": "f16_basics.rs",
9-
"result": false
44+
"name": "exercise10",
45+
"result": true
46+
},
47+
{
48+
"name": "exercise11",
49+
"result": true
50+
},
51+
{
52+
"name": "exercise12",
53+
"result": true
54+
},
55+
{
56+
"name": "exercise13",
57+
"result": true
58+
},
59+
{
60+
"name": "exercise14",
61+
"result": true
62+
},
63+
{
64+
"name": "exercise15",
65+
"result": true
66+
},
67+
{
68+
"name": "exercise16",
69+
"result": true
70+
},
71+
{
72+
"name": "exercise17",
73+
"result": true
74+
},
75+
{
76+
"name": "exercise18",
77+
"result": true
78+
},
79+
{
80+
"name": "exercise19",
81+
"result": true
1082
},
1183
{
12-
"name": "attention_score.rs",
84+
"name": "exercise20",
1385
"result": true
1486
},
1587
{
16-
"name": "gradient_compute.rs",
88+
"name": "exercise21",
1789
"result": true
1890
},
1991
{
20-
"name": "layer_norm.rs",
21-
"result": false
92+
"name": "exercise22",
93+
"result": true
94+
},
95+
{
96+
"name": "exercise23",
97+
"result": true
98+
},
99+
{
100+
"name": "exercise24",
101+
"result": true
102+
},
103+
{
104+
"name": "exercise25",
105+
"result": true
106+
},
107+
{
108+
"name": "exercise26",
109+
"result": true
110+
},
111+
{
112+
"name": "exercise27",
113+
"result": true
114+
},
115+
{
116+
"name": "exercise28",
117+
"result": true
118+
},
119+
{
120+
"name": "exercise29",
121+
"result": true
122+
},
123+
{
124+
"name": "exercise30",
125+
"result": true
126+
},
127+
{
128+
"name": "exercise31",
129+
"result": true
130+
},
131+
{
132+
"name": "exercise32",
133+
"result": true
134+
},
135+
{
136+
"name": "exercise33",
137+
"result": true
138+
},
139+
{
140+
"name": "exercise34",
141+
"result": true
142+
},
143+
{
144+
"name": "exercise35",
145+
"result": true
146+
},
147+
{
148+
"name": "exercise36",
149+
"result": true
150+
},
151+
{
152+
"name": "exercise37",
153+
"result": true
154+
},
155+
{
156+
"name": "exercise38",
157+
"result": true
158+
},
159+
{
160+
"name": "exercise39",
161+
"result": true
162+
},
163+
{
164+
"name": "exercise40",
165+
"result": true
22166
},
23167
{
24-
"name": "multi_head_attention.rs",
168+
"name": "exercise41",
25169
"result": true
26170
}
27171
],
28172
"statistics": {
29-
"total_exercations": 6,
30-
"total_succeeds": 3,
31-
"total_failures": 3,
32-
"total_time": 2
173+
"total_exercations": 42,
174+
"total_succeeds": 42,
175+
"total_failures": 0,
176+
"total_time": 17
33177
}
34178
}

exercises/learning-cxx

Submodule learning-cxx updated 43 files

report/index.html

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>训练营项目报告</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<nav>
11+
<div class="logo">训练营项目</div>
12+
<ul>
13+
<li><a href="#usage">使用说明</a></li>
14+
<li><a href="#extension">扩展指南</a></li>
15+
<li><a href="#features">技术特点</a></li>
16+
</ul>
17+
</nav>
18+
<header>
19+
<h1>训练营项目产品手册</h1>
20+
<p>一个用于管理和评测编程练习的基于Rust的工具</p>
21+
</header>
22+
<main>
23+
<section id="usage">
24+
<h2><span class="icon">🚀</span> 产品使用说明</h2>
25+
<p>本工具提供了一套命令行接口,用于管理和评测不同课程的练习。</p>
26+
<h3>配置新课程</h3>
27+
<p>使用 <code>learn</code> 命令来克隆和配置一个新的课程仓库作为 git submodule。</p>
28+
<pre><code>cargo xtask learn --course &lt;课程名称&gt; --submodule &lt;课程仓库Git地址&gt;</code></pre>
29+
<p>例如,要配置一个名为 `my-rust-course` 的课程,可以运行:</p>
30+
<pre><code>cargo xtask learn --course my-rust-course --submodule https://github.com/user/my-rust-course.git</code></pre>
31+
32+
<h3>评测练习</h3>
33+
<p>使用 <code>eval</code> 命令来评测练习。可以评测所有课程,也可以指定单个课程。</p>
34+
<p>评测所有课程:</p>
35+
<pre><code>cargo xtask eval</code></pre>
36+
<p>评测指定课程:</p>
37+
<pre><code>cargo xtask eval --course &lt;课程名称&gt;</code></pre>
38+
<p>评测结果将显示在终端,并保存到项目根目录下的 <code>eval_result.json</code> 文件中。</p>
39+
</section>
40+
41+
<section id="extension">
42+
<h2><span class="icon">🧩</span> 如何拓展新课程评测</h2>
43+
<p>系统可以方便地扩展以支持新的课程类型。目前的实现支持 `learning-lm-rs`、`learning-cxx` 和其他基于 `rustlings` 的课程。</p>
44+
<p>要添加对新课程类型的支持,需要修改 <code>xtask/src/eval.rs</code> 文件:</p>
45+
<ol>
46+
<li><code>eval.rs</code> 中为你的新课程类型添加一个新的评测函数,例如 <code>eval_my_course(&self, course_path: &Path) -> Result&lt;(...)&gt;</code></li>
47+
<li>
48+
<code>run_eval</code> 函数的 <code>match</code> 语句中,添加一个新的分支来调用你的评测函数。
49+
<pre><code>// in xtask/src/eval.rs, inside run_eval function
50+
let (results, succeeds, failures, exercations) = match course_name {
51+
"learning-lm-rs" => self.eval_learning_lm(&path)?,
52+
"learning-cxx" => self.eval_learning_cxx(&path)?,
53+
"my-new-course" => self.eval_my_course(&path)?, // 添加新的分支
54+
_ => self.eval_rustlings(&path)?
55+
};</code></pre>
56+
</li>
57+
</ol>
58+
<p>新的评测函数需要实现具体的评测逻辑,例如运行测试、检查输出来确定练习的通过状态,并返回一个包含练习结果、成功数、失败数和总数的元组。</p>
59+
</section>
60+
61+
<section id="features">
62+
<h2><span class="icon">💡</span> 技术特点</h2>
63+
<ul>
64+
<li><strong>基于 Rust 构建:</strong> 核心工具链使用 Rust 编写,确保了高性能和内存安全。</li>
65+
<li><strong>可扩展的评测引擎:</strong> 通过模块化的设计,可以轻松地为不同语言或框架的课程添加新的评测逻辑。</li>
66+
<li><strong>命令行接口:</strong> 使用 <code>clap</code> 库提供清晰、易用的命令行接口。</li>
67+
<li><strong>Git Submodule 集成:</strong> 课程作为 Git 子模块进行管理,方便版本控制和分发。</li>
68+
<li><strong>结构化输出:</strong> 评测结果以 JSON 格式输出,方便与其他工具或系统集成。</li>
69+
</ul>
70+
</section>
71+
</main>
72+
<footer>
73+
<p>报告生成于 &copy; 2025</p>
74+
</footer>
75+
</body>
76+
</html>

0 commit comments

Comments
 (0)