## config files

### tmux

```
bind-key b send-prefix

set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
set -g status-right ""

unbind '%'
bind '|' split-window -h -c "#{pane_current_path}"

unbind '"'
bind '-' split-window -v -c "#{pane_current_path}"

bind -r m resize-pane -Z

set -g base-index 1

set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection
unbind -T copy-mode-vi MouseDragEnd1Pane
```

### .bashrc

```bash
# export HOME=/mnt/debugger/wjh

[ -z "$PS1" ] && return

export TERM=xterm-256color

if [ -f ~/.dircolors ]; then
    eval "$(dircolors -b ~/.dircolors)"
else
    eval "$(dircolors -b)"
fi

alias ls='ls --color=auto -F'
alias ll='ls -lh --color=auto'
alias la='ll -a'
alias grep='grep --color=auto'
alias df='df -h'
alias du='du -h'

export PS1='\[\e[01;32m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\$ '

HISTSIZE=10000
HISTFILESIZE=20000
shopt -s histappend
export HISTCONTROL=ignoredups:erasedups

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

unset color_prompt force_color_prompt

use() {
  source /mnt/debugger/wjh/.venv/$1/bin/activate
}

proxyOn() {
  p="http://ipads:ipads123@127.0.0.1:11235"
  export http_proxy=$p https_proxy=$p all_proxy=$p
}

proxyOff() {
  unset http_proxy https_proxy all_proxy
}
```

### create user

```bash
#!/bin/bash
# 使用方法: sudo ./create_user.sh <用户名> <密码> <home目录路径>

# 检查是否以root权限运行
if [ "$(id -u)" != "0" ]; then
   echo "此脚本必须以root权限运行。请使用sudo执行。" 1>&2
   exit 1
fi

# 检查参数数量
if [ $# -lt 3 ]; then
    echo "错误: 需要提供至少三个参数 - 用户名、密码和home目录路径"
    echo "用法: $0 <用户名> <密码> <home目录路径> [<uid>]"
    exit 1
fi

USERNAME=$1
PASSWORD=$2
HOME_DIR=$3
USER_ID=$4

# 创建用户并指定home目录
useradd -m -d "$HOME_DIR" -s /bin/bash "$USERNAME" -u $USER_ID
echo "用户 $USERNAME 已创建，home目录为 $HOME_DIR"

# 设置用户密码
echo "$USERNAME:$PASSWORD" | chpasswd
echo "用户 $USERNAME 的密码已设置"

# 赋予sudo权限 (适用于Ubuntu/Debian系统)
usermod -aG sudo "$USERNAME"
echo "用户 $USERNAME 已添加到sudo组，拥有管理员权限"

# 对于CentOS/RHEL系统，应使用以下命令代替上面的命令
# usermod -aG wheel "$USERNAME"

echo "用户创建完成！可以使用以下命令验证:"
echo "su - $USERNAME"
echo "sudo -l"
```

## AIBank

申请理由：
```
服务百炼在线模型推理任务，缩短推理服务的 TTFT 与 TPOT，节省推理资源。

1. 基于 vLLM 测试 MoE 的 expert 负载不均衡特性
2. 优化 vLLM 的 MoE 部分的性能
3. 测试 MoE 的性能，分析 MoE 部分的提升效果
```

```
服务百炼在线模型推理任务，实现动态的模型资源池切换，节省推理资源。

1. 在异构硬件（H20、H800、5090 等）上测试 vLLM serve 不同模型（30B、235B 等）的性能并分析
2. 依据性能分析结果，在异构硬件上做模型推理的服务配置调优，让任一模型在任一硬件上能够得到最优的推理配置
3. 为异构资源池上模型流量的切换与动态调整做指导，为不同模型在给定流量需求下分配最优的硬件资源池，让不同模型的总资源需求量尽可能减少，从而优化整体的资源利用率
```

### setup

```
curl -LsSf https://astral.sh/uv/install.sh | sh
```



```
IdentityFile ~/.ssh/gahow_main
ServerAliveInterval 180
ServerAliveCountMax 3

Host ali
        HostName 47.83.188.3
        User gahow
```


```
ssh -f -N -D 1080 ali

curl --socks5 127.0.0.1:1080 https://ifconfig.me

export SSL_CERT_FILE=$(python -m certifi)

curl http://ipinfo.io
```



``` bash
cd "$HOME/.vscode-server/extensions/openai.chatgpt-0.4.15/bin/linux-x86_64"

# keep the original
mv codex codex.real

# wrapper that forces a proxy and then calls the original
cat > codex <<'EOF'
#!/usr/bin/env bash
export HTTPS_PROXY="http://localhost:7890"
export HTTP_PROXY="http://localhost:7890"
export NO_PROXY="http://localhost:7890"
# ------------------------------------------------
HERE="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
exec "$HERE/codex.real" "$@"
EOF
chmod +x codex
```



```
networksetup -setv6off Wi-Fi
curl ipinfo.io


<html><body><p align="center"><a href="http://portal.wifi.alibaba-inc.com/loginPage-custom?random=c9ca5299-e5cf-4750-8a97-93010063568b&ap_mac=40%3A1A%3A58%3A2A%3A81%3A70&sign_method=hmac_sha256&ssid=alibaba-guest&sta_mac=9A%3A89%3A66%3ABB%3A08%3A5A&timestamp=1761019558780&version=1.0&sign=5C396F5000AA6AF0CCC4EE9C0BC0F95B68E208D9522F23CA97AC3FA4AE56C8CF">如果浏览器不能自动跳转，请点击这里.</a><br><a href="http://portal.wifi.alibaba-inc.com/loginPage-custom?random=c9ca5299-e5cf-4750-8a97-93010063568b&ap_mac=40%3A1A%3A58%3A2A%3A81%3A70&sign_method=hmac_sha256&ssid=alibaba-guest&sta_mac=9A%3A89%3A66%3ABB%3A08%3A5A&timestamp=1761019558780&version=1.0&sign=5C396F5000AA6AF0CCC4EE9C0BC0F95B68E208D9522F23CA97AC3FA4AE56C8CF">If the browser cannot be redirected automatically, please click here.</a></body></html>
```




```
pmset -g

sudo pmset -a sleep 0
sudo pmset -a disablesleep 1

sudo pmset -a disablesleep 0
sudo pmset -a sleep 10

pmset displaysleepnow
```



```bash
sudo apt install rclone
rclone config
rclone lsf mydav:
rclone mkdir mydav:/newfoler/xx
rclone copy /path/to/file mydav:/folder/
rclone sync /path/to/localdir mydav:/folder
```


# Dash vllm

`unset VLLM_CACHE_ROOT`



```json
{
  "memory_cache": "100G",
  "rdma": "1",
  "enable-nvidia-ibgda": "true",
  "enable-nvidia-gdrcopy": "true",
  "global_dynamic_batching": {
    "enabled": true,
    "scheduler_type": "cache-aware-batching",
    "scheduler_config": {
      "max_batch_size": 128,
      "max_token_num": 1000000,
      "request_seize_threshold": 20,
      "prefix_match_weight": 10,
      "load_weight": 20,
      "prefill_concurrency": 2,
      "long_context": {
        "long_context_threshold": 30000,
        "long_context_proportion": 0.1,
        "max_long_context_proportion": 0.3
      },
      "enable_global_batching_optimization": true
    },
    "request_transmission": "grpc",
    "response_transmission": "grpc",
    "preferred_batch_size": 0,
    "token_capacity": 0,
    "max_queue_delay": 100,
    "bucket_strategy": "",
    "bucket_count": 1,
    "bucket_thresholds": []
  },
  "turbo": {
    "env": {
      "DashScope_Service_GracefulShutdown_WaitSeconds": 300,
      "DashScope_Api_Cache_Aware_EnableLengthIsolated": true
    }
  },
  "termination_grace_period": 300
}
```


# Trace

Some Observations
- 很多请求在 tool call 之后，携带 tool response 的 content 作为 input
```
<|im_start|>system\n{user_sys}{bailian_sys_prompt}<|im_end|>
<|im_start|>user\n{user_content}<|im_end|>
<|im_start|>assistant\n<think><|im_end|>

<|im_start|>user\n<tool_response>\n{tool_content}<\tool_response><|im_end|>
```
- thinking 下 input_length < 8k，但 input_length + output_length > 8k 的占比不小，多轮对话少（因为只从一个 cluster 内采集）
```
thinking: cnt=1845, cnt / len(data)=0.16394170961435933
coder: cnt=1871, cnt / len(data)=0.012262580450654747
```



字段：

- thinking

```
__tag__:__hostname__
__tag__:__pack_id__
__tag__:__path__
__tag__:__receive_time__
__tag__:__service_name__
__tag__:__user_defined_id__
__tag__:_container_ip_
__tag__:_container_name_
__tag__:_image_name_
__tag__:_namespace_
__tag__:_pod_name_
__tag__:_pod_uid_
__tag__:eci_id
__time__
__topic__
cluster_name
cluster_type
data_name
data_type
data_version
env
framework_type
framework_version
ip
model_name
model_version
program_name
program_version
region
request_count
request_data_size
request_data_url
request_id
request_params
request_params.header
request_params.header.attributes
request_params.header.attributes.app_id
request_params.header.attributes.baggage
request_params.header.attributes.model
request_params.header.attributes.subuser_id
request_params.header.attributes.traceparent
request_params.header.attributes.traceparent_new
request_params.header.attributes.tracestate
request_params.header.attributes.user_id
request_params.header.attributes.workspace_id
request_params.header.attributes.x-dashscope-apikeyid
request_params.header.attributes.x-dashscope-apikeyloc
request_params.header.attributes.x-dashscope-app
request_params.header.attributes.x-dashscope-bwid
request_params.header.attributes.x-dashscope-inner-enableestimatedusage
request_params.header.attributes.x-dashscope-inner-flow-control
request_params.header.attributes.x-dashscope-inner-logging-policy
request_params.header.attributes.x-dashscope-inner-model-type
request_params.header.attributes.x-dashscope-inner-request-priority
request_params.header.attributes.x-dashscope-inner-requestreadytime
request_params.header.attributes.x-dashscope-inner-streammode
request_params.header.attributes.x-dashscope-inner-timeout
request_params.header.attributes.x-dashscope-inner-user-meta
request_params.header.attributes.x-dashscope-inner-user-meta.dashscope_connector_user_type
request_params.header.attributes.x-dashscope-requestid
request_params.header.attributes.x-dashscope-service
request_params.header.attributes.x-dashscope-sse
request_params.header.attributes.x-dashscope-subuid
request_params.header.attributes.x-dashscope-uid
request_params.header.attributes.x-dashscope-workspace
request_params.header.attributes.x-ds-request-priority
request_params.header.attributes.x-ds-virtual-service
request_params.header.attributes.x-ds-virtual-service-version
request_params.header.request_id
request_params.payload
request_params.payload.input
request_params.payload.input.messages
request_params.payload.input.messages.content
request_params.payload.input.messages.name
request_params.payload.input.messages.reasoning_content
request_params.payload.input.messages.role
request_params.payload.input.messages.tool_call_id
request_params.payload.input.messages.tool_calls
request_params.payload.input.messages.tool_calls.function
request_params.payload.input.messages.tool_calls.function.arguments
request_params.payload.input.messages.tool_calls.function.arguments.code
request_params.payload.input.messages.tool_calls.function.name
request_params.payload.input.messages.tool_calls.id
request_params.payload.input.messages.tool_calls.index
request_params.payload.input.messages.tool_calls.type
request_params.payload.parameters
request_params.payload.parameters.enable_thinking
request_params.payload.parameters.extra_body
request_params.payload.parameters.extra_body.ignore_datainspection_error
request_params.payload.parameters.ignore_datainspection_error
request_params.payload.parameters.incremental_output
request_params.payload.parameters.max_tokens
request_params.payload.parameters.presence_penalty
request_params.payload.parameters.result_format
request_params.payload.parameters.temperature
request_params.payload.parameters.tools
request_params.payload.parameters.tools.function
request_params.payload.parameters.tools.function.description
request_params.payload.parameters.tools.function.name
request_params.payload.parameters.tools.function.parameters
request_params.payload.parameters.tools.function.parameters.properties
request_params.payload.parameters.tools.function.parameters.properties.code
request_params.payload.parameters.tools.function.parameters.properties.code.description
request_params.payload.parameters.tools.function.parameters.properties.code.type
request_params.payload.parameters.tools.function.parameters.properties.query
request_params.payload.parameters.tools.function.parameters.properties.query.description
request_params.payload.parameters.tools.function.parameters.properties.query.type
request_params.payload.parameters.tools.function.parameters.properties.url
request_params.payload.parameters.tools.function.parameters.properties.url.description
request_params.payload.parameters.tools.function.parameters.properties.url.type
request_params.payload.parameters.tools.function.parameters.required
request_params.payload.parameters.tools.function.parameters.type
request_params.payload.parameters.tools.type
request_params.payload.parameters.top_p
request_params.payload.resources
response_count
response_data_size
response_params
response_params.header
response_params.header.attributes
response_params.header.attributes.request_uuid
response_params.header.attributes.x-ds-backend-first-request-time
response_params.header.attributes.x-ds-backend-first-response-time
response_params.header.finished
response_params.header.request_id
response_params.header.status_code
response_params.header.status_message
response_params.header.status_name
response_params.payload
response_params.payload.output
response_params.payload.output.choices
response_params.payload.output.choices.finish_reason
response_params.payload.output.choices.index
response_params.payload.output.choices.message
response_params.payload.output.choices.message.content
response_params.payload.output.choices.message.reasoning_content
response_params.payload.output.choices.message.role
response_params.payload.output.choices.message.tool_calls
response_params.payload.output.choices.message.tool_calls.function
response_params.payload.output.choices.message.tool_calls.function.arguments
response_params.payload.output.choices.message.tool_calls.function.arguments.code
response_params.payload.output.choices.message.tool_calls.function.name
response_params.payload.output.choices.message.tool_calls.id
response_params.payload.output.choices.message.tool_calls.index
response_params.payload.output.choices.message.tool_calls.type
response_params.payload.usage
response_params.payload.usage.cached_tokens
response_params.payload.usage.input_tokens
response_params.payload.usage.output_tokens
response_params.payload.usage.output_tokens_details
response_params.payload.usage.output_tokens_details.reasoning_tokens
response_params.payload.usage.total_tokens
service_group
service_id
service_name
session_error
session_id
status_code
status_message
status_name
time
total_cost_time
__source__
```

- thinking-info
```
=== 发现的字段列表 ===
__tag__:__hostname__
__tag__:__pack_id__
__tag__:__path__
__tag__:__receive_time__
__tag__:__service_name__
__tag__:__user_defined_id__
__tag__:_container_ip_
__tag__:_container_name_
__tag__:_image_name_
__tag__:_namespace_
__tag__:_pod_name_
__tag__:_pod_uid_
__tag__:eci_id
__time__
__topic__
chunk_index
context
context.extra_params
context.extra_params.baggage
context.extra_params.cache_control
context.extra_params.ds_header_attributes
context.extra_params.ds_header_attributes.X-DashScope-APP-EXTRA-INFO
context.extra_params.ds_header_attributes.X-DashScope-EUID
context.extra_params.ds_header_attributes.X-DashScope-Inner-StreamMode
context.extra_params.ds_header_attributes.X-DashScope-Inner-Timeout
context.extra_params.ds_header_attributes.app_id
context.extra_params.ds_header_attributes.baggage
context.extra_params.ds_header_attributes.model
context.extra_params.ds_header_attributes.model_service_id
context.extra_params.ds_header_attributes.subuser_id
context.extra_params.ds_header_attributes.traceparent
context.extra_params.ds_header_attributes.traceparent_new
context.extra_params.ds_header_attributes.tracestate
context.extra_params.ds_header_attributes.user_id
context.extra_params.ds_header_attributes.workspace_id
context.extra_params.ds_header_attributes.x-dashscope-apikeyid
context.extra_params.ds_header_attributes.x-dashscope-apikeyloc
context.extra_params.ds_header_attributes.x-dashscope-app
context.extra_params.ds_header_attributes.x-dashscope-app-extra-info
context.extra_params.ds_header_attributes.x-dashscope-avgtpsrequestsnum
context.extra_params.ds_header_attributes.x-dashscope-bwid
context.extra_params.ds_header_attributes.x-dashscope-datainspection
context.extra_params.ds_header_attributes.x-dashscope-euid
context.extra_params.ds_header_attributes.x-dashscope-inner-batch-id
context.extra_params.ds_header_attributes.x-dashscope-inner-enableestimatedusage
context.extra_params.ds_header_attributes.x-dashscope-inner-flow-control
context.extra_params.ds_header_attributes.x-dashscope-inner-logging-policy
context.extra_params.ds_header_attributes.x-dashscope-inner-model-type
context.extra_params.ds_header_attributes.x-dashscope-inner-request-priority
context.extra_params.ds_header_attributes.x-dashscope-inner-requestreadytime
context.extra_params.ds_header_attributes.x-dashscope-inner-streammode
context.extra_params.ds_header_attributes.x-dashscope-inner-timeout
context.extra_params.ds_header_attributes.x-dashscope-inner-timeout-heartbeat-interval
context.extra_params.ds_header_attributes.x-dashscope-inner-user-meta
context.extra_params.ds_header_attributes.x-dashscope-inner-user-meta.dashscope_connector_user_type
context.extra_params.ds_header_attributes.x-dashscope-loggingconsent
context.extra_params.ds_header_attributes.x-dashscope-requestid
context.extra_params.ds_header_attributes.x-dashscope-service
context.extra_params.ds_header_attributes.x-dashscope-sse
context.extra_params.ds_header_attributes.x-dashscope-subuid
context.extra_params.ds_header_attributes.x-dashscope-uid
context.extra_params.ds_header_attributes.x-dashscope-workspace
context.extra_params.ds_header_attributes.x-dashscope-workspaceid
context.extra_params.ds_header_attributes.x-ds-llm-input-tokens
context.extra_params.ds_header_attributes.x-ds-llm-response-format
context.extra_params.ds_header_attributes.x-ds-llm-thinking
context.extra_params.ds_header_attributes.x-ds-request-priority
context.extra_params.ds_header_attributes.x-ds-virtual-service
context.extra_params.ds_header_attributes.x-ds-virtual-service-version
context.extra_params.incremental_output
context.extra_params.service_id
context.extra_params.stop
context.extra_params.stop_token_ids
context.extra_params.traceparent
context.extra_params.tracestate
context.input_text
context.model_serving_params
context.model_serving_params.do_sample
context.model_serving_params.early_stopping
context.model_serving_params.eos_token_id
context.model_serving_params.head_response_per_tokens
context.model_serving_params.input_ids
context.model_serving_params.length_penalty
context.model_serving_params.logprobs
context.model_serving_params.max_new_think_tokens
context.model_serving_params.max_new_tokens
context.model_serving_params.min_length
context.model_serving_params.n
context.model_serving_params.no_repeat_ngram_size
context.model_serving_params.num_beams
context.model_serving_params.presence_penalty
context.model_serving_params.repetition_penalty
context.model_serving_params.seed
context.model_serving_params.temperature
context.model_serving_params.top_k
context.model_serving_params.top_logprobs
context.model_serving_params.top_p
ds_service_id
ds_service_name
interval
interval.cost
interval.type
message
request_id
step
time
timestamp
total_chunks
user_id
__source__
```


- coder

```
===== Chat Session Analysis (FAST) =====
Mode: strict
Total requests: 151817
Total sessions: 75146
Mean turns per session: 2.020

===== Turn Distribution =====
turns=  1  sessions=65024
turns=  2  sessions=3367
turns=  3  sessions=1814
turns=  4  sessions=997
turns=  5  sessions=725
turns=  6  sessions=487
turns=  7  sessions=334
turns=  8  sessions=262
turns=  9  sessions=198
turns= 10  sessions=164
turns= 11  sessions=148
turns= 12  sessions=132
turns= 13  sessions=81
turns= 14  sessions=70
turns= 15  sessions=78
turns= 16  sessions=62
turns= 17  sessions=72
turns= 18  sessions=67
turns= 19  sessions=55
turns= 20  sessions=52
turns= 21  sessions=35
turns= 22  sessions=51
turns= 23  sessions=40
turns= 24  sessions=37
turns= 25  sessions=42
turns= 26  sessions=28
turns= 27  sessions=28
turns= 28  sessions=28
turns= 29  sessions=22
turns= 30  sessions=24
turns= 31  sessions=31
turns= 32  sessions=17
turns= 33  sessions=23
turns= 34  sessions=11
turns= 35  sessions=15
turns= 36  sessions=23
turns= 37  sessions=12
turns= 38  sessions=11
turns= 39  sessions=20
turns= 40  sessions=18
turns= 41  sessions=10
turns= 42  sessions=20
turns= 43  sessions=19
turns= 44  sessions=21
turns= 45  sessions=19
turns= 46  sessions=11
turns= 47  sessions=7
turns= 48  sessions=12
turns= 49  sessions=13
turns= 50  sessions=6
turns= 51  sessions=8
turns= 52  sessions=6
turns= 53  sessions=13
turns= 54  sessions=14
turns= 55  sessions=7
turns= 56  sessions=12
turns= 57  sessions=12
turns= 58  sessions=10
turns= 59  sessions=4
turns= 60  sessions=3
turns= 61  sessions=11
turns= 62  sessions=5
turns= 63  sessions=4
turns= 64  sessions=6
turns= 65  sessions=6
turns= 66  sessions=6
turns= 67  sessions=6
turns= 68  sessions=7
turns= 69  sessions=3
turns= 70  sessions=7
turns= 71  sessions=5
turns= 72  sessions=9
turns= 73  sessions=3
turns= 74  sessions=9
turns= 75  sessions=8
turns= 76  sessions=2
turns= 77  sessions=3
turns= 78  sessions=2
turns= 79  sessions=3
turns= 80  sessions=4
turns= 81  sessions=3
turns= 82  sessions=3
turns= 83  sessions=6
turns= 84  sessions=2
turns= 85  sessions=5
turns= 86  sessions=6
turns= 87  sessions=6
turns= 88  sessions=1
turns= 89  sessions=3
turns= 91  sessions=4
turns= 92  sessions=3
turns= 93  sessions=4
turns= 94  sessions=2
turns= 96  sessions=2
turns= 97  sessions=3
turns= 98  sessions=2
turns= 99  sessions=4
turns=100  sessions=4
turns=101  sessions=2
turns=102  sessions=3
turns=103  sessions=2
turns=106  sessions=2
turns=107  sessions=1
turns=110  sessions=2
turns=112  sessions=3
turns=113  sessions=1
turns=116  sessions=1
turns=117  sessions=1
turns=118  sessions=1
turns=119  sessions=1
turns=120  sessions=1
turns=121  sessions=2
turns=122  sessions=2
turns=125  sessions=1
turns=126  sessions=1
turns=128  sessions=2
turns=132  sessions=1
turns=134  sessions=1
turns=136  sessions=1
turns=137  sessions=1
turns=142  sessions=1
turns=144  sessions=1
turns=156  sessions=2
turns=157  sessions=1
turns=160  sessions=2
turns=185  sessions=1
turns=220  sessions=1
```


```
===== Chat Session Analysis (FAST) =====
Mode: strict
Total requests: 10913
Total sessions: 10605
Mean turns per session: 1.029

===== Turn Distribution =====
turns=  1  sessions=10474
turns=  2  sessions=69
turns=  3  sessions=25
turns=  4  sessions=17
turns=  5  sessions=9
turns=  6  sessions=2
turns=  7  sessions=1
turns=  8  sessions=1
turns=  9  sessions=2
turns= 12  sessions=2
turns= 13  sessions=1
turns= 14  sessions=1
turns= 17  sessions=1
```

- Thinking V2
```
===== Chat Session Analysis (FAST) =====
Mode: strict
Total requests: 10913
Total sessions: 9611
Mean turns per session: 1.135

===== Turn Distribution =====
turns=  1  sessions=9083
turns=  2  sessions=263
turns=  3  sessions=101
turns=  4  sessions=49
turns=  5  sessions=39
turns=  6  sessions=35
turns=  7  sessions=14
turns=  8  sessions=8
turns=  9  sessions=6
turns= 10  sessions=3
turns= 11  sessions=3
turns= 12  sessions=2
turns= 14  sessions=2
turns= 15  sessions=1
turns= 18  sessions=1
turns= 36  sessions=1
```

- Coder V2
```
turns=  1  sessions=106901
turns=  2  sessions=3770
turns=  3  sessions=1897
turns=  4  sessions=925
turns=  5  sessions=668
turns=  6  sessions=417
turns=  7  sessions=270
turns=  8  sessions=216
turns=  9  sessions=142
turns= 10  sessions=116
turns= 11  sessions=95
turns= 12  sessions=86
turns= 13  sessions=54
turns= 14  sessions=45
turns= 15  sessions=53
turns= 16  sessions=32
turns= 17  sessions=35
turns= 18  sessions=31
turns= 19  sessions=23
turns= 20  sessions=22
turns= 21  sessions=14
turns= 22  sessions=25
turns= 23  sessions=22
turns= 24  sessions=16
turns= 25  sessions=16
turns= 26  sessions=13
turns= 27  sessions=11
turns= 28  sessions=9
turns= 29  sessions=13
turns= 30  sessions=8
turns= 31  sessions=6
turns= 32  sessions=2
turns= 33  sessions=3
turns= 34  sessions=7
turns= 35  sessions=5
turns= 36  sessions=4
turns= 37  sessions=4
turns= 38  sessions=3
turns= 39  sessions=8
turns= 40  sessions=6
turns= 41  sessions=3
turns= 42  sessions=6
turns= 43  sessions=3
turns= 44  sessions=3
turns= 45  sessions=4
turns= 46  sessions=1
turns= 48  sessions=3
turns= 49  sessions=4
turns= 50  sessions=1
turns= 51  sessions=2
turns= 52  sessions=3
turns= 53  sessions=1
turns= 54  sessions=4
turns= 55  sessions=5
turns= 56  sessions=2
turns= 57  sessions=1
turns= 58  sessions=1
turns= 59  sessions=1
turns= 60  sessions=2
turns= 61  sessions=1
turns= 62  sessions=3
turns= 66  sessions=1
turns= 68  sessions=1
turns= 69  sessions=3
turns= 70  sessions=1
turns= 71  sessions=1
turns= 72  sessions=1
turns= 73  sessions=1
turns= 80  sessions=1
turns= 81  sessions=1
turns= 85  sessions=1
turns= 98  sessions=1
turns=100  sessions=1
turns=102  sessions=1
turns=103  sessions=1
```


# Dashscope

```bash
mkdir -p ~/.ssh
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFFpGJiuu2lGzQd1cmqSYBAO5sL0gc3+RSQKm9IbMUte Gahow Wang <gahow.wang@gmail.com>" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
```

```bash
echo "Port 10022" >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
if [[ -z "$(which service 2>/dev/null)" ]]; then /usr/sbin/sshd; else service ssh restart; fi
```

```bash
sudo apt update && sudo apt install --no-install-recommends nodejs npm -y
sudo npm i -g @openai/codex
```

```bash
sudo rm /usr/lib/python3.12/sitecustomize.py
```

```bash
echo "IdentityFile ~/.ssh/gahow_main" >> ~/.ssh/config
echo "sk" > ~/.ssh/gahow_main
chmod 600 gahow_main
```


```bash
proxyOn() {
  p="http://127.0.0.1:7890"
  export http_proxy=$p https_proxy=$p all_proxy=$p
}

proxyOff() {
  unset http_proxy https_proxy all_proxy
}
>> ~/.bashrc
```

```bash
git lfs install

git clone git@ipads.se.sjtu.edu.cn:wangjh/auto-tuner.git
git checkout feat/agent
git submodule update --init
```

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
export UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple
uv sync

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install ripgrep
```

```bash
./build_replayer.sh
```




- copy file
```bash
#!/usr/bin/env bash
set -u
set -o pipefail

HOST="29cb1b48db8-cdu78.cn-wulanchabu.nas.aliyuncs.com"
SRC_ROOT="nfs://${HOST}/wjh"
DST_ROOT="/dashscope/caches/application/wjh"

PARALLEL=256
RETRY=3

mkdir -p "${DST_ROOT}"

tmp_root=$(mktemp)
tmp_auto=$(mktemp)
tmp_dotdirs=$(mktemp)

trap 'rm -f "$tmp_root" "$tmp_auto" "$tmp_dotdirs"' EXIT


copy_one() {

    rel="$1"
    src="nfs://${HOST}/wjh/${rel}"
    dst="${DST_ROOT}/${rel}"

    # ---- resume support ----
    if [ -f "$dst" ]; then
        echo "[SKIP] already exists $rel"
        return 0
    fi

    mkdir -p "$(dirname "$dst")"

    i=1
    while [ "$i" -le "$RETRY" ]; do

        echo "[COPY] ${rel} (try $i/$RETRY)"

        if nfs-cat "$src" > "${dst}.tmp"; then
            mv "${dst}.tmp" "$dst"
            return 0
        fi

        rm -f "${dst}.tmp"

        i=$((i+1))
        sleep 1

    done

    echo "[FAIL] ${rel}" >&2
}

export HOST DST_ROOT RETRY
export -f copy_one


echo "===== Step 1: root regular files ====="

nfs-ls "${SRC_ROOT}" \
| awk '$1 ~ /^-/ {print $NF}' \
| grep -Ev '\.venv|\.cache' \
> "$tmp_root"


echo "===== Step 2: auto-tuner recursive ====="

nfs-ls -R "${SRC_ROOT}/auto-tuner" \
| awk '$1 ~ /^-/ {print "auto-tuner/" $NF}' \
| grep -Ev '\.venv|\.cache' \
> "$tmp_auto"


echo "===== Step 3: dot directories ====="

nfs-ls "${SRC_ROOT}" \
| awk '$1 ~ /^d/ && $NF ~ /^\./ {print $NF}' \
| grep -Ev '\.venv|\.cache' \
> "$tmp_dotdirs"


echo "===== Step 4: scan dot dirs ====="

while read d
do

    echo "[DOTDIR] $d"

    nfs-ls -R "${SRC_ROOT}/${d}" \
    | awk -v p="$d/" '$1 ~ /^-/ {print p $NF}' \
    | grep -Ev '\.venv|\.cache'

done < "$tmp_dotdirs" >> "$tmp_auto"


echo "===== Step 5: copy ====="

cat "$tmp_root" "$tmp_auto" \
| awk '!seen[$0]++' \
| xargs -P "$PARALLEL" -I {} bash -c 'copy_one "$1"' _ {}


echo "===== DONE ====="
```


