code server安装使用教程

1. 安装

1.1. 下载code-server安装包

类似这种文件:code-server-3.10.2-linux-amd64.tar.gz

解压:tar -xvf code-server-3.10.2-linux-amd64.tar.gz

1.2 (可选)建立软连接

ln -s path/to/code-server-3.10.2-linux-amd64/bin/code-server code-server

1.3 建立运行脚本

vim run_vscode.sh

写入如下内容,PASSWORD自己设置,最后行8445是端口号,需要网络设置。

PASSWORD=your_passwod
TZ=Asia/Shanghai
export PASSWORD=$PASSWORD
export SUDO_PASSWORD=$PASSWORD
export TZ=$TZ
nohup ./code-server --bind-addr=0.0.0.0:8445 &

2. 使用

启动:

nohup sh run_vscode.sh > vscode_log.txt 2>&1 &

然后可以在浏览器打开。

关闭方法:

(1)ps aux | grep code

(2)kill -9 the_pid

3. 编程插件

按需下载扩展程序:GitLens; Python;C/C++;
cpptools-linux(如需要手动安装,则先下载包,然后如下图所示)

4. 调试方法

调试前编译

在终端里用cmake编译好(可以直接使用VSCode Server里的终端,不需要另开窗口)

创建或修改调试配置

推荐cpp配置文件内容(.vscode/launch.json):

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "(gdb) Launch",
      "type": "cppdbg",
      "request": "launch",
      "program": "your/program",
      "args": ["-k1 v1", "-k2 v2"],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [{"name":"CUDA_VISIBLE_DEVICES", "value": "4"}],
      "externalConsole": false,
      "MIMode": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

推荐python分布式训练配置文件内容(.vscode/launch.json):

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: distributed",
      "type": "python",
      "request": "launch",
      "program": "path/to/env/lib/python3.7/site-packages/torch/distributed/launch.py",
      "console": "integratedTerminal",
      "env": {"CUDA_VISIBLE_DEVICES": "0"},
      "args": [
        "--nproc_per_node=1",
        "examples/run_funsd.py",
        "--model_name_or_path=microsoft/layoutlmv2-base-uncased",
        "--output_dir=/tmp/test-ner",
        "--do_train",
        "--do_predict",
        "--max_steps=1000",
        "--warmup_ratio=0.1",
        "--fp16"
      ],
      "justMyCode": false,
    }
  ]
}

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值