Z:\shaojiemike\Documents\文献\计算机网络
目录下。这里先使用fjw的脚本。register.py
,获得私钥和分配的ip1 | [Interface] |
main.sh
修改包的3个字节。apt-get install nftables
/etc/default/warp-helper
文件填写对应的wg-conf
里Endpoint。比如: ROUTING_ID=11,45,14
UPSTREAM=[2606:4700:d0::a29f:c001]:500
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2. 最后开启路由表,Root权限运行` ip route add default dev warp proto static scope link table default`
## WARP on OpenWRT
* 目的:为了防止大量流量通过WARP,导致被官方封禁,所以只在OpenWRT上配置WARP分流github的流量。
* 实现思路:
* 运行python脚本,通过github的API获得所有的github域名ip,
* 使用iptables的warp_out表,将目的地址为github域名ip路由到WARP的虚拟网卡上。
### WARP Wireguard Establishment
```bash
python register.py #自动生成warp-op.conf,warp.conf和warp-helper
mv warp-helper /etc/default
# cat main.sh
# cat warp-op.conf
vim /etc/config/network #填写warp-op.conf内容,默认只转发172.16.0.0/24来测试连接
ifup warp #启动warp, 代替wg-quick up warp.conf
bash main.sh #启动防火墙实现报文头关键三字节修改
nft list ruleset #查看防火墙,是否配置成功
wg #查看warp状态,测试是否连接成果
这时还没创建warp_out路由表,所以还不能通过WARP出数据。
1 | #/etc/config/network |
然后WebUI点击apply 或者命令行运行ifconfig warp down && ifup
添加了WARP的网络出口后,路由器不在只是通过WAN出数据。防火墙需要更新:
wget --bind-address=WARP_ip
来模拟10: from all lookup main suppress_prefixlength 1
1000: from all lookup warp_out
,优先级10001 | root@tsjOp:~/warp# ip rule |
1 | cd ip_route |
对所有github域名的ip执行类似ip ro add 192.30.252.0/22 dev warp proto static table warp_out
操作。
1 | mtr www.github.com |
修改/etc/rc.local
1 | # Put your custom commands here that should be executed once |
基于1.1.1.1 的安装windows版本直接白嫖
暂无
暂无
https://gist.github.com/iBug/3107fd4d5af6a4ea7bcea4a8090dcc7e
glados
历史上,Linux 的启动一直采用init进程。
下面的命令用来启动服务。
1 | $ sudo /etc/init.d/apache2 start |
这种方法有两个缺点。
一是启动时间长。init进程是串行启动,只有前一个进程启动完,才会启动下一个进程。
二是启动脚本复杂。init进程只是执行启动脚本,不管其他事情。脚本需要自己处理各种情况,这往往使得脚本变得很长。
Systemd 就是为了解决这些问题而诞生的。它的设计目标是,为系统的启动和管理提供一套完整的解决方案。
根据 Linux 惯例,字母d是守护进程(daemon)的缩写。 Systemd 这个名字的含义,就是它要守护整个系统。
使用了 Systemd,就不需要再用init了。Systemd 取代了initd,成为系统的第一个进程(PID 等于 1),其他进程都是它的子进程。
Systemd 的优点是功能强大,使用方便,缺点是体系庞大,非常复杂。事实上,现在还有很多人反对使用 Systemd,理由就是它过于复杂,与操作系统的其他部分强耦合,违反”keep simple, keep stupid”的Unix 哲学。
systemctl是 Systemd 的主命令,用于管理系统。
systemctl - Control the systemd system and service manager
1 | systemctl is-enabled servicename.service #查询服务是否开机启动 |
Systemd 默认从目录/etc/systemd/system/
读取配置文件。但是,里面存放的大部分文件都是符号链接,指向目录/usr/lib/systemd/system/
,真正的配置文件存放在那个目录。
systemctl enable
命令用于在上面两个目录之间,建立符号链接关系。
1 | $ sudo systemctl enable [email protected] |
如果配置文件里面设置了开机启动,systemctl enable
命令相当于激活开机启动。
与之对应的,systemctl disable
命令用于在两个目录之间,撤销符号链接关系,相当于撤销开机启动。
1 | > $ sudo systemctl disable [email protected] |
配置文件的后缀名,就是该 Unit 的种类,比如sshd.socket
。如果省略,Systemd 默认后缀名为.service
,所以sshd
会被理解成sshd.service
。
1 | $ systemctl reload webhook.service |
Simple 类型不能reload
https://blog.csdn.net/qq_40741855/article/details/104984071
https://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-commands.html
All developers should start with Nsight Systems to identify the largest optimization opportunities. Nsight Systems provides developers a system-wide visualization of an applications performance. Developers can optimize bottlenecks to scale efficiently across any number or size of CPUs and GPUs; from large servers to our smallest SoC. For further optimizations to compute kernels developers should use Nsight Compute or to further optimize a graphics workloads, use Nsight Graphics.
Nsight Compute is an interactive kernel profiler for CUDA applications. It provides detailed performance metrics and API debugging via a user interface and command line tool. Nsight Compute also provides customizable and data-driven user interface and metric collection that can be extended with analysis scripts for post-processing results.
Nsight Graphics is a standalone application for the debugging, profiling, and analysis of graphics applications on Microsoft Windows and Linux. It allows you to optimize the performance of your Direct3D 11, Direct3D 12, DirectX Raytracing 1.1, OpenGL, Vulkan, and KHR Vulkan Ray Tracing Extension based applications.
cat /proc/sys/kernel/perf_event_paranoid
sudo sh -c 'echo 2 >/proc/sys/kernel/perf_event_paranoid'
重启会重置sudo sh -c 'echo kernel.perf_event_paranoid=2 > /etc/sysctl.d/local.conf'
运行 nsight-sys
,可以从整体上看GPU,CPU资源的使用情况,和分辨出热点函数和kernel,但是对于为什么是热点给不出具体分析。
勾选了CUDA-trace, GPU Metrics选项
大致2到3倍时间:默认采样率,单独运行52s, Nsight-sys模拟需要135s。
GPU Metrics选项能看出 PCIE, GPU DRAM Bandwidth, Warp的使用情况。
将鼠标放在上面会有具体的数值或者名称的解释,(正在使用的Warps)
由于没有根据kernel function区分,很难读。为此提供了NVTX来给代码打标签
具体分析见 Deploy Stable Diffusion to A100
默认kernel模式,会根据 function的调度关系,将程序划分为kernel
1 | # recommand running under sudo |
目测模拟时间慢百倍。
nv-nsight-cu-cli -> ncu
下面是一个使用样例:
1 | /usr/local/NVIDIA-Nsight-Compute/nv-nsight-cu-cli -o mnist -f --csv --profile-from-start off /usr/bin/python3 mnist.py |
其中-o是为了输出.nsight-cuprof-report文件用于后续的可视化查看,-f为强制覆盖原有文件,–csv可是在console输出除 timeline 以外数据的时候以逗号分隔数据,方便拷贝至csv文件, –profile-from-start的使用方法和Nsight System以及nvprof一样。其余flag选项可见文档。
上面的例子会生成mnist.nsight-cuprof-report文件。
注意
最前面的可执行文件需要绝对路径,如上面的python3需要使用 /usr/bin/python3。
生成过程中可能会产生很大的临时文件(几十G)。如果本次磁盘空间不够,可以设置如下环境变量来调整存储临时文件的地址。没有找到能直接使用 Nsight Compute 修改临时文件地址的方式。
1 | export /TMPDIR=/path/for/tmp |
https://www.freesion.com/article/34871449930/
为了显示原代码makefile添加 -g -G
选项
对应CmakeList.txt
1 | target_compile_options(better PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda |
https://blog.csdn.net/yan31415/article/details/109491749
我不明白我的SMEM怎么不是从DRAM来的, 而且峰值怎么这么低?
这个错误也是令人迷惑
The memory access pattern for loads from L1TEX to L2 is not optimal. The granularity of an L1TEX request to L2 is a 128 byte cache line. That is 4 consecutive 32-byte sectors per L2 request. However, this kernel only accesses an average of 3.7 sectors out of the possible 4 sectors per cache line. Check the Source Counters section for uncoalesced loads and try to minimize how many cache lines need to be accessed per memory request.
不知道为什么有1%和2% 的bank conflict
可以看到 SMEM, Register,Block Size是怎么影响GPU Warp的分配调度的。
上图没有拖累,吃满了64个warp。
关于if语句
if语句只要warp里执行相同就行。
可以提示出不连续访问的地方。(这里是这样设计的,已经避免了绝大部分的不连续访问)
显示stall最多的指令是什么以及在等待什么。还有执行最多的指令
假如 file mismatched 手动选择文件就行
stall的信息,感觉就这些有点用。(其中sb是scoreboard的意思)
有两种汇编
请看PTX SASS一文
可以通过指令执行数或者采样率来得知,执行最多的指令。
鼠标悬停可以知道具体命令的含义
1 | sdata[Regular_local_index]=arr_data[Regular_global_index]; |
该从DRAM里读取到SMEM的指令对应的PTX和SASS代码
1 | cvt.f32.u16 d, a; // convert 16-bit unsigned to 32-bit float |
为了隐藏延迟?
直接原因是PTX翻译成SASS。一条mov变多条了
老一代debugger工具,逐渐被Nsight淘汰
1 | nvprof # 命令行,nsys 之前的名称叫做 nvprof |
在more里有建议
1 | nvprof --analysis-metrics -o nbody-analysis.nvprof ./nbody --benchmark -numdevices=2 -i=1 |
1 | Warning: Failed to get OpenGL version. OpenGL version 2.0 or higher is required. |
解决办法
1 | sudo apt-get install libxcb-xinerama0 |
1 | qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. |
按照说明 export QT_DEBUG_PLUGINS=1
再次运行, 显示具体问题
1 | Cannot load library /staff/shaojiemike/Install/cuda_11.7.0_515.43.04_linux/nsight-compute-2022.2.0/host/linux-desktop-glibc_2_11_3-x64/Plugins/platforms/libqxcb.so: (libxcb-xinput.so.0: cannot open shared object file: No such file or directory) |
解决 sudo apt-get install libxcb-xinput0
ERR_NVGPUCTRPERM - The user does not have permission to profile on the target device
要用sudo,或者最新的NV
1 | $ sudo ncu-ui |
解决办法(原因是sudo相当于切换到root用户,丢失了xauth信息)
1 | $ xauth list |
原因是 软件对GPU的支持是逐步的需要安装最新的。
不支持的Nsight的可以尝试老的debugger工具 CUDA Visual Profiler
Pascal support was deprecated, then dropped from Nsight Compute after Nsight Compute 2019.5.1.
The profiling tools that support Pascal in the CUDA Toolkit 11.1 and later are nvprof
and visual profiler
.
暂无
NVTX问题
https://developer.nvidia.com/tools-overview
https://www.365seal.com/y/zyn1yxJQn3.html
[^1]: Usage of NVTX
1 | tinymediamanager_service: |
VNC 网页默认密码 password
进入容器内bash,安装字体
1 | docker exec -it tinymediamanager bash |
然后先将字体改成最后几个, 然后再改语言。
然后restart容器。注意不是重启stack(会删除容器,重启创建
利用网络挂载文件夹,用tMM软件刮削.
要注意动漫属于电视剧
基础命名规则如下:
1 | 剧集英文名 (上映年份)/这是文件夹 |
其中Specials里,视频文件后的S00表示这是“特典”,后面的E01代表“第几个特典”。
请根据TheTVDB里的数据确定你的ova视频的编号。
在DNS索引网站查看域名的中国服务器IP地址
实际ping速度,修改win10的hosts文件在C:\WINDOWS\system32\drivers\etc
暂无
暂无
基于 Go 语言 并遵从 Apache2.0 协议开源。Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中,然后发布到任何流行的 Linux 机器上。
相对于传统虚拟机,Docker 没有硬件虚拟化/hypervisor,可以运行在物理机、虚拟机, 甚至嵌套运行在 Docker 容器内,并且其不携带操作系统的,会轻巧很多。而且调用资源时利用 Docker Engine
去调用宿主的的资源,这时候过程是虚拟内存->真正物理内存。
{ align=left }
{ align=right }
1 | # 创建 Portainer Server 将用于存储其数据库的卷 |
1 | # 安裝 docker |
First, write an installation script for all of your dependencies. This script is written with Docker specific syntax and is called a Dockerfile(1).
{ .annotate }
`Images > Build image`
查看容器出错日志:docker logs --tail 1000 1fed0d4782cf
最后一项是容器ID
在构建 Docker 镜像时,如果需要通过代理访问外部网络资源(例如,安装软件包或依赖项),你可以通过以下几种方式设置代理:
https://ghcr.io/v2/“: x509: certificate signed by unknown authority”
编辑 Docker 配置文件 /etc/docker/daemon.json,添加以下内容:
1
2
3
{
"insecure-registries": ["ghcr.io"]
}
重启 Docker 服务:
1
sudo systemctl restart docker
docker push
), docker pull
).[^4]Then, run these commands to build a Docker image of your environment by using docker build
.
1 | docker build --network=host\ |
You also can set the proxy in the Dockerfile.[^6]
1 | ENV http_proxy "http://127.0.0.1:7890" |
镜像的完整 tag 不仅包含镜像名字, 还指明了镜像从哪里来, 要到哪里去, 就像一个 URL。可以通过 -t 选项指定镜像的标签信息,譬如:
1 | $ docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG] |
Once successfully built, you can instantiate copies of this image as many times as you would like by using docker run
to create Docker containers.
[^2]
volumes allow me to interact with data outside of the docker container.
docker info |grep HTTP
查看。宿主机往往因为OS的原因,提供不了合适的GCC版本,为此在docker里编译是一种便捷的选择。
docker/docker_connect.sh
或者 https://blog.csdn.net/winter2121/article/details/118223637在Linux服务器上使用Docker运行图形化界面的应用程序。为了实现这一点,您需要使用一个特别配置的Docker镜像,该镜像支持图形用户界面(GUI)。这通常涉及到安装一个桌面环境和任何必要的图形驱动程序。
以下是实现这一目的的基本步骤:
这里是一个示例的Dockerfile,用于创建一个带有图形界面的Ubuntu容器:
1 | FROM ubuntu:latest |
在这个Dockerfile中,ubuntu-desktop
和vnc4server
被安装,以便提供图形界面和VNC访问。您需要创建一个VNC启动脚本(vnc_startup.sh
),以启动VNC服务器并运行桌面环境。
请注意,运行图形界面的容器通常比标准的、无GUI的容器更加资源密集,并且可能需要更多的存储空间和内存。此外,确保遵循最佳安全实践,特别是在暴露VNC或其他远程访问服务时。
https://cloud.tencent.com/developer/article/1395434
[^1]: How can Docker run distros with different kernels?
[^2]: Docker Commands for Managing Container Lifecycle (Definitive Guide)
[^4]: Developing in Docker
[^6]: https://cloud.tencent.com/developer/article/1806455 & http://www.debugself.com/2018/01/17/docker_network/
https://stackblitz.com/edit/vue-echarts-vue-3?file=src%2FApp.vue
暂无
暂无
Workers & Pages
下 create an application
, choose the Pages
tab and follow the git connection tutorial.mkdocs build
实现部署。https://kirrito-k423.github.io/
替换shaojiemike.pages.dev
变成自己的域名 shaojiemike.top
: cloudflare pages 下直接提供Custom domains
的解析 CNAME www shaojiemike.pages.dev
横向条形图排序赛跑叫Bar chart race
参考项目
但是好像是静态的,而且只有一个排序的柱状图
参考文档, 使用template项目
1 | git clone https://github.com/Kirrito-k423/leetcode-ranking-visualization-anichart.git |
由于项目还在开发,暂时不进一步尝试
暂无
暂无
CUDA编程水平高低的不同,会导致几十上百倍的性能差距。但是这篇将聚焦于CUDA的编程语法,编译与运行。