leenldk 发布的文章

包含 $$n$$ 个量子比特的系统用 $$2^{n}$$ 个复数 $$\alpha_{i}$$ 表示
状态为向量 $$(\alpha_{0...00}, \alpha_{0...01}, ...\alpha_{1...11})^T$$
对量子比特 i 的单比特操作,相当于对只有下标 i 位不同的两个状态乘矩阵操作
$$ (a'_{b_0b_1...b_{i-1}0...b_{n-1}}, a'_{b_0b_1...b_{i-1}1...b_{n-1}}) $$

目前问题:
服务器上用公网IPv4的 v2ray 在校园网中可以正常使用,在移动网络下无法连接

服务器代理

在本地使用 remote port forwarding 将本地 7890 端口 forward 到 gorgon 7890 端口
在 gorgon 上使用 remote port forwarding 将本地 7890 端口 forward 到 i1 7890 端口 ssh -R 7890:localhost:7890 e1.sc.team
在 i1 上 export ALL_PROXY="127.0.0.1:7890" 使用代理

wsl 代理

cat /etc/resolv.conf 查看 dns nameserver
export ALL_PROXY="http://$nameserver:7890

翻墙wifi

基本策略:需要翻墙的设备A和提供翻墙的手机B连接同一wifi的局域网,设备A配置代理到手机B,手机B运行翻墙软件并允许局域网的连接。
由于局域网问题,wifi不能由校园网提供,目前解决方案使用手机C开启热点提供wifi

可行的方法:
手机C开启热点,同时热点走校园网wifi
手机B连接手机C热点,使用 v2rayNG,配置文件使用blog,设置允许局域网的连接
设备A连接手机C热点,设置代理端口为 手机B v2rayNG HTTP代理端口,代理服务器为手机B在局域网中 IP。

已知 ios 转日区若当前在日本 IP 则可以不绑定支付方式。

linux 服务器翻墙

服务器安装 v2ray
注意 wget 不支持 socks5 协议,测试时请使用 curl

v2ray 配置文件如下:

{
  "inbounds": [
    {
      "port": local_port, // 监听端口
      "protocol": "socks", // 入口协议为 SOCKS 5
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      },
      "settings": {
        "auth": "noauth"  //socks的认证设置,noauth 代表不认证,由于 socks 通常在客户端使用,所以这里不认证
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "vmess", // 出口协议
      "settings": {
        "vnext": [
          {
            "address": "server_ip", // 服务器地址,请修改为你自己的服务器 IP 或域名
            "port": server_port,  // 服务器端口
            "users": [
              {
                "id": "server_uuid",  // 用户 ID,必须与服务器端配置相同
                "alterId": server_alterId // 此处的值也应当与服务器相同
              }
            ]
          }
        ]
      }
    }
  ]
}

然后 export http_proxy=socks5://127.0.0.1:[local_port]

ELF : executable and linkable format
四类 ELF : 可执行文件,object file, shared library, core dump

单个 source code 转 单个 object file
object file 静态链接转 static library(.a)
object file 动态链接转 dynamic/shared library(.so)

nm -Du :列出需要外界提供的 symbol
export LD_DEBUG=libs : 输出 library 查找过程
export LD_DEBUG=symbols : 输出 symbol 查找过程
LD_PRELOAD 环境变量:最先查找符号

编译时:

编译 so :
gcc -g -fPIC -c foo.c
gcc -shared foo.o -o libfoo.so

链接:
gcc -g -o main main.c libfoo.so
gcc -g -o main main.c -lfoo -L.
效果相同
-L{$DIR} : 查找 DIR 路径

real name : libX.so.A.B.C
soname : 软链接 libX.so.A -> libX.so.A.B.C
linker name : 软链接 libX.so -> libX.so.A
编译时 -soname (-Wl,-soname,libfoo.so.2) 选项使 ldconfig 时产生 soname 软链接

-Wl,-rpath,`pwd` # 编译时添加 rpath寻找路径

compiler : 程序转汇编
assembler : 汇编转机器码
linker : 把多个 object file 合成为单个 executable, library file 或 另一个 object file

CPU 结构:
threads per core : 超线程
cores per socket : 每个 socket 核数
sockets

MPI

每个 mpi 进程有 affinity mask,长度为 CPU cores
--bind-to core : affinity mask 中只有对应 core 一位被 set
--bind-to socket : affinity mask 中 socket 对应 所有 core 被 set
--bind-to none

多机

hostfile :

i1 slots=2 max-slots=8
i2 slots=2 max-slots=8
`which mpirun`  -np 2 --host i1:1,i2:1 hostname
`which mpirun` -np 4 --hostfile ./hostfile hostname

使用脚本时开头要加 #!/bin/bash

OMP

OMP_DISPLAY_ENV=true 输出 OMP 绑定情况
OMP_PLACES=threads, OMP_PLACES=cores,
OMP_PLACES=sockets

hyperthread cpu 分布:/sys/devices/system/cpu/cpu0/topology$ cat thread_siblings_list

似乎该恢复这个系列了

shell 脚本的执行方式目前看起来是 依次从脚本中读入一行,执行一行。因此不要在运行中途改脚本。