Skip to content

Commit b70011c

Browse files
committed
s
1 parent ffcc0b4 commit b70011c

File tree

5 files changed

+256
-1
lines changed

5 files changed

+256
-1
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* [Makefile编写规则](./docs/makefile/makefile.md)
3131
* [Prometheus应用监控](./docs/prometheus/prometheus.md)
3232
* [搜索技巧](./docs/tools/search-skill.md)
33+
* [Supervisor](./docs/tools/supervisord.md)
3334

3435
## Markdown
3536

@@ -166,6 +167,7 @@
166167
* [文本-语音转换技术问答](./docs/ai/text-speech-conversion.md)
167168
* [虚拟数字人](./docs/ai/digital-human.md)
168169
* [ai-awesome](./docs/ai/ai-awesome.md)
170+
* [cuda入门](./docs/cuda/cuda-start.md)
169171

170172
## 炼丹
171173

docs/ai/ai-awesome.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
11
# AI Awesome
22

3+
## AI系统
4+
5+
| 名称 | 介绍 | 是否需要联网 |
6+
| --- | --- | --- |
7+
| 联想小天 | 联想小天是一款基于AI的智能语音助手,可实现语音交互、语音控制、语音识别、语音合成等功能。 | 需要 |
8+
| 天天向上 | 天天向上是一款基于AI的智能学习应用,可实现语音交互、语音控制、语音识别、语音合成等功能。 | 需要 |
9+
| 知音云 | 知音云是一款基于AI的智能语音助手,可实现语音交互、语音控制、语音识别、语音合成等功能。 | 需要 |
10+
| 腾讯AI开放平台 | 腾讯AI开放平台是一款基于AI的开放平台,可实现语音交互、语音控制、语音识别、语音合成等功能。 | 需要 |
11+
| 百度AI开放平台 | 百度AI开放平台是一款基于AI的开放平台,可实现语音交互、语音控制、语音识别、语音合成等功能。 | 需要 |
12+
| 阿里云机器学习 | 阿里云机器学习是一款基于AI的开放平台,可实现语音交互、语音控制、语音识别、语音合成等功能。 | 需要 |
13+
| 腾讯机器人 | 腾讯机器人是一款基于AI的智能对话机器人,可实现语音交互、语音控制、语音识别、语音合成等功能。 | 需要 |
14+
| 图灵机器人 | 图灵机器人是一款基于AI的智能对话机器人,可实现语音交互、语音控制、语音识别、语音合成等功能。 | 需要 |
15+
| 微软小冰 | 微软小冰是一款基于AI的智能语音助手,可实现语音交互、语音控制、语音识别、语音合成等功能。 | 需要 |
16+
317
## 图片识别
418

519
1. [GOT-OCR2.0](https://github.com/Ucas-HaoranWei/GOT-OCR2.0)
620

721
| 项目名称 | 项目地址 | 介绍 | 论文 |
822
| --- | --- | --- | --- |
9-
| GOT-OCR2.0 | https://github.com/Ucas-HaoranWei/GOT-OCR2.0 | Official code implementation of General OCR Theory: Towards OCR-2.0 via a Unified End-to-end Model | https://arxiv.org/abs/2409.01704 |
23+
| GOT-OCR2.0 | https://github.com/Ucas-HaoranWei/GOT-OCR2.0 | Official code implementation of General OCR Theory: Towards OCR-2.0 via a Unified End-to-end Model | https://arxiv.org/abs/2409.01704 |
24+
25+
26+
## 大模型
27+
28+
| 模型名称 | 规格 | 特点和用途 |
29+
| --- | --- | --- |
30+
| BERT | 12-layer, 768-hidden, 12-heads, 110M parameters | 1) 预训练任务:Masked Language Modeling (MLM) 2) 文本分类任务:Text Classification 3) 序列标注任务:Named Entity Recognition (NER) 4) 文本匹配任务:Question Answering (QA) |
31+
| RoBERTa | 12-layer, 768-hidden, 12-heads, 1.5B parameters | 1) 预训练任务:Masked Language Modeling (MLM) 2) 文本分类任务:Text Classification 3) 序列标注任务:Named Entity Recognition (NER) 4) 文本匹配任务:Question Answering (QA) |
32+
| GPT-2 | 12-layer, 768-hidden, 12-heads, 1.5B parameters | 1) 预训练任务:Language Modeling (LM) 2) 文本生成任务:Text Generation 3) 文本分类任务:Text Classification 4) 序列标注任务:Named Entity Recognition (NER) 5) 文本匹配任务:Question Answering (QA) |
33+
| T5 | 12-layer, 768-hidden, 12-heads, 1.5B parameters | 1) 预训练任务:Language Modeling (LM) 2) 文本生成任务:Text Generation 3) 文本分类任务:Text Classification 4) 序列标注任务:Named Entity Recognition (NER) 5) 文本匹配任务:Question Answering (QA) |
34+
| GPT-3 | 12-layer, 1024-hidden, 16-heads, 175B parameters | 1) 预训练任务:Language Modeling (LM) 2) 文本生成任务:Text Generation 3) 文本分类任务:Text Classification 4) 序列标注任务:Named Entity Recognition (NER) 5) 文本匹配任务:Question Answering (QA) |

docs/cuda/cuda-start.md

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# CUDA 入门
2+
3+
## config cuda
4+
export LD_LABRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.6/lib64
5+
export PATH=$PATH:/usr/local/cuda-11.6/bin
6+
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-11.6
7+
export PATH=/usr/local/cuda/bin:$PATH
8+
9+
10+
## 核函数(Kernel function)
11+
12+
外观:
13+
14+
1. 核函数在GPU上进行并行执行。
15+
2. 核函数外观要注意两点:
16+
- 必须用限定词__global__修饰符。
17+
- 核函数返回值必须是void。
18+
19+
特点:
20+
21+
1. 核函数只能访问GPU内存
22+
2. 核函数不能使用变长参数
23+
3. 核函数不能使用静态变量
24+
4. 核函数不能使用函数指针
25+
5. 核函数具有异步性
26+
27+
28+
2. 核函数的输入参数是全局内存中的数据,输出参数是全局内存中的数据。
29+
3. 核函数的执行时间由GPU硬件决定,通常是微秒级。
30+
4. 核函数的编程语言是CUDA C。
31+
5. 核函数的执行效率高于CPU上的函数,因为GPU的并行性可以提高计算效率。
32+
6. 核函数的编程难度较低,只需要熟悉CUDA C语言即可。
33+
34+
## CUDA编程模型
35+
36+
1. CUDA编程模型是一种并行编程模型,它将程序分解为多个核函数,每个核函数运行在一个线程块上。
37+
2. 线程块是一组线程,它们共享同一块全局内存。
38+
3. 线程块的大小由硬件决定,通常是128、256、512、1024或2048个线程。
39+
4. 线程块的数量由硬件决定,通常是由GPU的核心数决定的。
40+
5. 线程块之间可以并行执行,因此可以提高计算效率。
41+
6. CUDA编程模型的编程难度较高,需要熟悉CUDA C语言、CUDA运行时库、CUDA编程模型、GPU硬件架构等知识。
42+
43+
## CUDA编程模型的基本步骤
44+
45+
1. 编写核函数,在CUDA C语言中定义。
46+
2. 编译核函数,将核函数编译成可执行文件。
47+
3. 加载核函数,将可执行文件加载到GPU上。
48+
4. 创建线程块,在GPU上创建线程块。
49+
5. 启动线程块,启动线程块中的线程。
50+
6. 等待线程块完成,等待线程块中的线程完成计算。
51+
7. 释放资源,释放线程块、全局内存等资源。
52+
53+
## CUDA编程模型的基本代码示例
54+
55+
```
56+
#include <stdio.h>
57+
#include <cuda_runtime.h>
58+
59+
__global__ void add(int *a, int *b, int *c) {
60+
int i = threadIdx.x;
61+
c[i] = a[i] + b[i];
62+
}
63+
64+
int main() {
65+
int a[10], b[10], c[10];
66+
int *dev_a, *dev_b, *dev_c;
67+
size_t size = sizeof(int) * 10;
68+
69+
// 申请设备内存
70+
cudaMalloc((void**)&dev_a, size);
71+
cudaMalloc((void**)&dev_b, size);
72+
cudaMalloc((void**)&dev_c, size);
73+
74+
// 向设备内存中拷贝数据
75+
cudaMemcpy(dev_a, a, size, cudaMemcpyHostToDevice);
76+
cudaMemcpy(dev_b, b, size, cudaMemcpyHostToDevice);
77+
78+
// 启动核函数
79+
add<<<1, 10>>>(dev_a, dev_b, dev_c);
80+
81+
// 等待核函数完成
82+
cudaDeviceSynchronize();
83+
84+
// 从设备内存中拷贝数据
85+
cudaMemcpy(c, dev_c, size, cudaMemcpyDeviceToHost);
86+
87+
// 释放设备内存
88+
cudaFree(dev_a);
89+
cudaFree(dev_b);
90+
cudaFree(dev_c);
91+
92+
// 输出结果
93+
for (int i = 0; i < 10; i++) {
94+
printf("%d + %d = %d\n", a[i], b[i], c[i]);
95+
}
96+
97+
return 0;
98+
}
99+
```
100+
101+
102+
参考:https://www.bilibili.com/video/BV1sM4y1x7of?spm_id_from=333.788.videopod.episodes&vd_source=665e35db8f931ad6292d3b95f67d4554&p=2
103+

docs/git/dailygit.md

+30
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,34 @@ git tag -d tag-name
2323
2. 删除远程tag
2424
```
2525
git push origin :refs/tags/tag-name
26+
```
27+
28+
# git maintenance start
29+
30+
git maintenance start,用于自动启动 Git 仓库的后台维护任务。这个命令会在你的系统上安排定期的 Git 维护任务,这些任务包括:
31+
32+
清理:Git的垃圾收集器会清理那些不再需要的文件和对象,以减少仓库的大小;
33+
压缩:Git会重新打包你的对象。这个过程会将多个小文件合并成一个大文件,从而提高Git的性能;
34+
修复:如果Git仓库出现了问题,Git会检查和修复它。
35+
36+
如果你想要停止后台的维护任务,你可以运行 git maintenance stop 命令。这对于代码仓库很大的场景非常有用!试一试吧。
37+
38+
如下待验证:
39+
40+
```
41+
Git maintenance命令的基本用法
42+
git maintenance命令提供了一种灵活的方式来优化Git仓库。通过指定不同的子命令,可以运行一个或多个维护任务。如果指定了--task选项,则按指定的顺序运行这些任务;如果没有指定,则根据maintenance.<task>.enabled配置选项来确定要运行的任务。默认情况下,只有maintenance.gc.enabled配置为true的任务会被运行‌1。
43+
44+
Git maintenance命令的子命令
45+
‌gc‌:运行垃圾收集器,清理未使用的对象和松散的对象。
46+
‌prune‌:删除远程跟踪分支和标签,这些分支和标签不再存在于远程仓库中。
47+
‌fsck‌:检查仓库的完整性和一致性。
48+
‌repack‌:重新打包仓库的对象,以减少磁盘空间占用并提高性能。
49+
‌filter-branch‌:重新写历史,例如删除敏感信息或重写提交历史。
50+
‌filter-repo‌:使用BFG Repo-Cleaner工具清理大型仓库。
51+
启用和维护Git maintenance的步骤
52+
‌启用维护任务‌:可以通过配置文件设置哪些维护任务在每次提交时自动运行。例如,将maintenance.gc.enabled设置为true,以便在每次提交时运行垃圾收集器。
53+
‌手动运行维护任务‌:使用git maintenance start命令并指定要运行的子命令,例如git maintenance start gc prune fsck。
54+
‌定期运行维护任务‌:可以通过cron作业或其他调度工具定期运行维护任务,以确保仓库保持最佳状态。
55+
通过合理使用和维护Git maintenance命令和子命令,可以显著提升Git仓库的性能和稳定性,减少因仓库过大而导致的性能问题。
2656
```

docs/tools/supervisord.md

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# supervisord
2+
3+
## 安装
4+
5+
```
6+
pip install supervisor
7+
```
8+
9+
## 生成配置
10+
11+
```
12+
echo_supervisord_conf > /etc/supervisord.conf
13+
```
14+
15+
## 开启配置项
16+
17+
```
18+
[include]
19+
files = supervisord.d/*.ini
20+
```
21+
22+
## 创建配置文件夹
23+
24+
```
25+
/etc/supervisord.d
26+
```
27+
28+
## 配置
29+
30+
例如创建一个frp服务的配置文件:
31+
32+
```
33+
vi /etc/supervisord.d/frp.ini
34+
```
35+
36+
配置:
37+
38+
```
39+
[program:frps]
40+
command=/你的文件夹/frps -c /你的文件夹/frps.toml
41+
autostart=true
42+
autorestart=false
43+
stderr_logfile=/你的文件夹/logs/frp.log
44+
stdout_logfile=/你的文件夹/logs/frp.log
45+
#user=test
46+
```
47+
48+
## 启动
49+
50+
```
51+
supervisord -c /etc/supervisord.conf
52+
```
53+
54+
## 配置成开机启动
55+
56+
```
57+
cd /usr/lib/systemd/system/
58+
```
59+
60+
新建系统服务配置文件:
61+
62+
```
63+
vi supervisord.service
64+
```
65+
66+
配置例如下面:
67+
68+
```
69+
[Unit]
70+
Description=Supervisor daemon
71+
72+
[Service]
73+
Type=forking
74+
ExecStart=/root/miniconda3/bin/supervisord -c /etc/supervisor/supervisord.conf
75+
ExecStop=/root/miniconda3/bin/supervisorctl shutdown
76+
ExecReload=/root/miniconda3/bin/supervisorctl reload
77+
KillMode=process
78+
Restart=on-failure
79+
RestartSec=42s
80+
81+
[Install]
82+
WantedBy=multi-user.target
83+
```
84+
85+
设置开机自启:
86+
87+
```
88+
systemctl enable supervisord
89+
```
90+
91+
验证是否开机自启动:
92+
93+
```
94+
systemctl is-enabled supervisord
95+
```

0 commit comments

Comments
 (0)