From 3caeee010448cafbff09e87a214796dd0b9564a7 Mon Sep 17 00:00:00 2001 From: chantsztung <16242707+chantsztung@user.noreply.gitee.com> Date: Fri, 19 Sep 2025 09:52:44 +0000 Subject: [PATCH] improve README doc Signed-off-by: chantsztung <16242707+chantsztung@user.noreply.gitee.com> --- README.md | 236 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 136 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 389225a9..4492b7f6 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,146 @@ -# EulerCopilot Tune安装使用指南 +# EulerCopilot Tune 安装与使用指南 -### 项目简介 -EulerCopilot Tune通过采集系统、微架构、应用等维度的指标数据,结合大模型和定制化的prompt工程,针对不同应用的可调参数给出可靠的参数推荐,同时根据推荐的参数运行benchmark,与baseline做对比并计算出推荐参数对应用性能的提升值。 +## 项目简介 +EulerCopilot Tune 通过采集系统、微架构、应用等维度的指标数据,结合大模型和定制化的 prompt 工程,针对不同应用的可调参数给出可靠的参数推荐。同时,根据推荐的参数运行 benchmark,与 baseline 进行对比,并计算出推荐参数对应用性能的提升值。 -### 软件架构 -软件架构说明 +## 安装部署 +提供三种安装方式,包括源码安装、源码服务方式安装以及RPM包安装。 -### 安装部署 +### 方法一:源码安装 -#### 方法一:源码安装 +#### 1. 获取 gitee 源码 +* 下载地址 https://gitee.com/openeuler/A-Tune/tree/euler-copilot-tune/ +* 分支指定为 euler-copilot-tune +```bash +git clone -b euler-copilot-tune https://gitee.com/openeuler/A-Tune.git +cd A-Tune +``` -1. 下载gitee源码,gitee代码仓地址: -https://gitee.com/openeuler/A-Tune/tree/euler-copilot-tune/ -(注意:分支指定为euler-copilot-tune) -2. 安装其他依赖 +#### 2. 安装系统依赖 +* 安装 python venv 依赖(调优程序运行机器) ```bash -#1.调优程序运行机器安装python venv依赖 yum install python3-devel krb5-devel -#2.目标应用所在机器安装调优依赖并重启sysstat +``` +* 安装调优依赖并重启 sysstat(目标应用所在机器) +```bash yum install sysstat perf systemctl start sysstat ``` -3. 调优程序运行机器安装python依赖: -```BASH -#1.创建并加载python venv + +#### 3. 创建虚拟环境 & 安装依赖(调优程序运行机器) +* 创建并激活虚拟环境 venv +```bash python3 -m venv venv source venv/bin/activate - -#2.安装python依赖包 +``` +* 安装python依赖包 +```bash pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple ``` -### 使用指南 +#### 4. 修改配置文件 +* 在项目的 config 文件夹中修改配置文件,具体内容参考使用指南 + +#### 5. 运行 EulerCopilot Tune +```bash +export PYTHONPATH="`pwd`:$PYTHONPATH" +python3 src/start_tune.py +``` + +### 方法二:源码服务方式安装 +#### 1. 获取 gitee 源码(同方法一) + +#### 2. 安装系统服务 +* 进入项目目录执行 +```bash +python setup.py install +``` + +#### 3. 修改配置文件 +* 在 /etc/euler-copilot-tune 目录修改配置文件,具体内容参考使用指南 + +#### 4. 启动服务 +* 开启调优主程序 +```bash +euler-copilot-tune +``` + +* 启动 MCP servers +```bash +systemctl start tune-mcpserver +journalctl -xe -u tune-mcpserver --all -f +``` + +* 启动 OpenAPI +```bash +systemctl start tune-openapi +journalctl -xe -u tune-openapi --all -f +``` + +### 方法三:RPM 包方式安装 +#### 1. 下载 RPM 包 +* 地址:[https://eulermaker.compass-ci.openeuler.openatom.cn/package/download?osProject=houxu:openEuler-24.03-LTS-SP2:epol&packageName=euler-copilot-tune](https://gitee.com/link?target=https%3A%2F%2Feulermaker.compass-ci.openeuler.openatom.cn%2Fpackage%2Fdownload%3FosProject%3Dhouxu%3AopenEuler-24.03-LTS-SP2%3Aepol%26packageName%3Deuler-copilot-tune) + +#### 2. 设置pip镜像源 +* 由于RPM 安装过程需要使用 pip 下载资源,为了加快安装速度,推荐设置镜像源 +```bash +pip config set global.index-url https://repo.huaweicloud.com/repository/pypi/simple/ + +# 清华大学TUNA镜像源: https://pypi.tuna.tsinghua.edu.cn/simple +# 阿里云镜像源: http://mirrors.aliyun.com/pypi/simple/ +# 中国科学技术大学镜像源: https://mirrors.ustc.edu.cn/pypi/simple/ +# 华为云镜像源: https://repo.huaweicloud.com/repository/pypi/simple/ +# 腾讯云镜像源:https://mirrors.cloud.tencent.com/pypi/simple/ +``` + +#### 3. 安装 RPM 包 +备注:不要在python虚拟环境中执行,在系统环境下安装pip包 +* x86 架构 +```bash +dnf install euler-copilot-tune-1.0-1.oe2403sp2.x86_64.rpm +``` +* ARM 架构 +```bash +dnf install euler-copilot-tune-1.0-1.oe2403sp2.aarch64.rpm +``` +* 查看详细日志 +安装过程中会在Running scriptlet: euler-copilot-tune-1.0-1.x86_64 处停留较长时间,此处是在pip安装对应依赖包,可以通过如下命令查看详细日志 +```bash +tail -f /pip_install.log +``` +* 如果按照完成后出现pip包安装失败情况,请单独执行如下命令进行安装: +```bash +pip install fastapi numpy openai paramiko pydantic pyyaml scikit-learn tqdm uvicorn requests langchain langchain-openai email-validator httpx tabulate gssapi pandas faiss-cpu pyfiglet mcp + +``` + +#### 4. 修改配置文件 +* 在 /etc/euler-copilot-tune 目录修改配置文件,具体内容参考使用指南 + +#### 5. 启动服务 +* 开启调优主程序 +```bash +euler-copilot-tune +``` + +* 启动 MCP servers +```bash +systemctl start tune-mcpserver +journalctl -xe -u tune-mcpserver --all -f +``` -1. 准备env yaml,放入项目的config/.env.yaml中,具体格式如下: +* 启动 OpenAPI +```bash +systemctl start tune-openapi +journalctl -xe -u tune-openapi --all -f +``` +## 使用指南 +### 配置文件准备 +* 修改.env.yaml 配置文件内容(项目 config 文件下) +```bash +vim config/.env.yaml +``` +* 具体格式如下: ```YAML LLM_KEY: "YOUR_LLM_KEY" LLM_URL: "YOUR_LLM_URL" @@ -69,7 +176,11 @@ feature: ``` -2. 完善app_config.yaml,放入项目的config/app_config.yaml中(重点是补充set_param_template、get_param_template、benchmark脚本),具体内容如下: +* 完善 app_config.yaml(项目 config 文件下) + --> 重点补充 set_param_template、 get_param_template、 benchmark 脚本 + set_param_template:根据调优结果修改应用参数,用于后续测试效果 + get_param_template:获取应用参数 + recover_workload:恢复集群 ```YAML mysql: user: "root" @@ -153,98 +264,23 @@ redis: benchmark: "$EXECUTE_MODE:local sh $SCRIPTS_DIR/redis/parse_benchmark.sh $host_ip $port " performance_metric: "QPS" - ``` -其中: -set_param_template:根据调优结果修改应用参数,用于后续测试效果 -get_param_template:获取应用参数 -recover_workload: 恢复集群 -benchmark:benchmark脚本,格式如下: +* benchmark 脚本具体内容如下: ```bash #(必须有)用于通知框架可以执行指标采集的标识 echo 1 > /tmp/euler-copilot-fifo -#benchmark具体执行 +# benchmark 具体执行 cd /root/spark_auto_deploy_arm/spark_test sh tpcds_test_1t_spark331_linearity_2p.sh > /home/cxm/spark_benchmark.log 2>&1 -#(必须有)计算并输出相应的performance_metric的语句 +#(必须有)计算并输出相应的 performance_metric 的语句 cd /home/cxm time_taken=$(grep "time_taken:" "spark_benchmark.log" | sed -E 's/.*time_taken:([0-9.]+)s.*/\1/' | paste -sd+ | bc | xargs printf "%.2f") echo $time_taken ``` -3. 运行EulerCopilot -```bash -export PYTHONPATH="`pwd`:$PYTHONPATH" -python3 src/start_tune.py - -``` -#### 方法二:源码服务方式安装 - -##### 1、安装服务 - -​ 进入项目目录,执行python setup.py install - -##### 2、在/etc/euler-copilot-tune 目录修改配置文件,具体内容参考上面源码部署方式 - -##### 3、启动服务 - -~~~bash -#命令行执行如下命令 -#开启调优 -euler-copilot-tune -#开启mcpserver 日志通过执行 journalctl -xe -u tune-mcpserver --all -f 查看 -systemctl start tune-mcpserver -#开启openapi 日志通过执行 journalctl -xe -u tune-openapi --all -f 查看 -systemctl start tune-openapi -~~~ - - - -#### 方法三:rpm包方式安装 - -##### 1、下载rpm包 - -地址:[https://eulermaker.compass-ci.openeuler.openatom.cn/package/download?osProject=houxu:openEuler-24.03-LTS-SP2:epol&packageName=euler-copilot-tune](https://gitee.com/link?target=https%3A%2F%2Feulermaker.compass-ci.openeuler.openatom.cn%2Fpackage%2Fdownload%3FosProject%3Dhouxu%3AopenEuler-24.03-LTS-SP2%3Aepol%26packageName%3Deuler-copilot-tune) - -##### 2、安装rpm包 - -``` -#由于rpm安装过程需要使用pip下载资源,为了加快安装速度,推荐设置镜像源 -pip config set global.index-url https://repo.huaweicloud.com/repository/pypi/simple/ - -清华大学TUNA镜像源: https://pypi.tuna.tsinghua.edu.cn/simple -阿里云镜像源: http://mirrors.aliyun.com/pypi/simple/ -中国科学技术大学镜像源: https://mirrors.ustc.edu.cn/pypi/simple/ -华为云镜像源: https://repo.huaweicloud.com/repository/pypi/simple/ -腾讯云镜像源:https://mirrors.cloud.tencent.com/pypi/simple/ - -#开始安装 -x86: dnf install euler-copilot-tune-1.0-1.oe2403sp2.x86_64.rpm -arm: dnf install euler-copilot-tune-1.0-1.oe2403sp2.aarch64.rpm -备注:不要在python虚拟环境中执行,在系统环境下安装pip包 -#安装过程中会在Running scriptlet: euler-copilot-tune-1.0-1.x86_64 处停留较长时间,此处是在pip安装对应依赖包 -#可以通过如下命令查看详细日志 -tail -f /pip_install.log -#如果按照完成后出现pip包安装失败情况,请单独执行如下命令进行安装 -pip install fastapi numpy openai paramiko pydantic pyyaml scikit-learn tqdm uvicorn requests langchain langchain-openai email-validator httpx tabulate gssapi pandas faiss-cpu pyfiglet mcp -``` - -##### 3、在/etc/euler-copilot-tune 目录修改配置文件,具体内容参考上面源码部署方式 - -##### 4、启动服务 - -~~~bash -#命令行执行如下命令 -#开启调优 -euler-copilot-tune -#开启mcpserver 日志通过执行 journalctl -xe -u tune-mcpserver --all -f 查看 -systemctl start tune-mcpserver -#开启openapi 日志通过执行 journalctl -xe -u tune-openapi --all -f 查看 -systemctl start tune-openapi -~~~ -### 常见问题解决 +## 常见问题解决 见 [FAQ.md](./FAQ.md) \ No newline at end of file -- Gitee