
https://bbs.archlinux.org/viewtopic.php?id=303177
使用mpm安装
安装后需要使用patch
1 | patchelf --clear-execstack /home/user/.MathWorks/ServiceHost/-mw_shared_installs/v2024.13.0.2/bin/glnxa64/libmwfoundation_crash_handling.so |
https://bbs.archlinux.org/viewtopic.php?id=303177
使用mpm安装
安装后需要使用patch
1 | patchelf --clear-execstack /home/user/.MathWorks/ServiceHost/-mw_shared_installs/v2024.13.0.2/bin/glnxa64/libmwfoundation_crash_handling.so |
Download pkg from https://apps.cloud.blackmagicdesign.com/davinci-resolve
1 | git clone https://aur.archlinux.org/davinci-resolve.git |
LMOD
软件管理https://lmod.readthedocs.io/en/latest/010_user.html
交大hpc使用lmod
来管理用户软件,每一次重新登陆都会重置module,需要将软件重新load。
常用指令:
1 | ml # list these loaded modules |
oh-my-zsh
更好的shellhpc默认已安装zsh, 通过omzsh的安装脚本进行安装,并安装插件
1 | export CHSH=no # 避免它自动切换默认 shell(HPC 通常不允许) |
nvim
更好的编辑器因为在服务器上没有sudo
权限所以需要手动编译
首先使用conda创建编译环境
1 | conda create -n nvim-build cmake libtool gettext curl unzip ninja gcc gxx -y -c conda-forge |
clone & build
1 | git clone https://github.com/neovim/neovim.git |
某些情况下需要进行并行编译,编译需要耗费大量资源,并不一定可以在登录节点使用:
在这种情况下使用提交作业的方式较为低效,可以申请交互式计算资源1 | srun -p cpu -n 4 --pty /bin/bash |
1 | (base) chenyulin@pilogin2 ~> srun -p cpu -n 4 --pty /bin/bash |
使用hpc studio传输
https://studio.hpc.sjtu.edu.cn/pun/sys/dashboard/files/fs//lustre/home/acct-umjbyy/chenyulin/Data
例如拷贝conda环境
1 | cp -r /lustre/home/acct-umjbyy/chenyulin/.conda /dssg/home/acct-umjbyy/chenyulin/ |
Repository:
official:
1 | conda env create -f conda.yaml |
不建议使用official的conda.yaml
, 使用更改后的conda_cyl.yaml
。
1 | pip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 |
官方提供了 depth estimation 和 segmentation 的 notebook,可以找时间理解一下
使用的数据集为Imagenet-mini
1 | imagenet-mini |
Note: 需要额外添加一个label.txt
使用脚本生产数据集的meta data:
1 |
Semantic-SAM Repository Application
My repository: https://github.com/Chen-Yulin/Semantic-SAM
My venv: ssam
测试过的python版本:3.8,3.10
官方步骤:
1 | pip3 install torch==1.13.1 torchvision==0.14.1 --extra-index-url https://download.pytorch.org/whl/cu113 |
根据[[Cuda+Torch]],需要先安装cudatoolkit
和cuda-toolkit
1 | conda install nvidia/label/cuda-11.7.0::cuda-toolkit -c nvidia/label/cuda-11.7.0 |
然后按照torch官网的安装指令:
1 | conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia |
第二行直接运行可能会报错,提示系统gcc版本过高,安装gcc=11.2.0
1 | conda install -c conda-forge gcc=11.2.0 |
如果编译时出现ld: cannot find -lcudart: No such file or directory collect2: error: ld returned 1 exit status
报错,只是因为没有安装cudatoolkit
^ ^
安装完成后直接import semantic_sam
会报错ModuleNotFoundError: No module named 'MultiScaleDeformableAttention'
^ ^
提示:
1 | Please compile MultiScaleDeformableAttention CUDA op with the following commands: |
需要手动make一下 Mask2Former
:
1 | cd Mask2Former/mask2former/modeling/pixel_decoder/ops/ |
一些版本问题
1 | pip install gradio==3.37.0 |
1 | python demo.py --ckpt ./weights/swinl_only_sam_many2many.pth |
Comment: 效果相较于SAM更多体现了语义的一致性,而不是基于texture进行分割。
1 | python demo_auto_generation.py --ckpt ./weights/swinl_only_sam_many2many.pth |
原图:
.png)Instance identification:
Part segmentation
nvidia-smi
返回的是driver所能支持的最新的cuda版本
系统安装的cuda版本可以随意,torch会优先使用虚拟环境中安装的cuda版本
安装指定版本cuda-toolkit
1 | conda install nvidia/label/cuda-12.4.0::cuda-toolkit -c nvidia/label/cuda-12.4.0 |
安装最新版本
1 | conda install cuda-toolkit |
某些仓库需要指定cuda路径才能编译包
1 | conda env config vars set LD_LIBRARY_PATH="/home/cyl/miniconda3/envs/gsam/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/:$LD_LIBRARY_PATH" |
Note: 注意改变了库路径之后nvim中的lsp会报错,建议之后改回去
1 | conda env config vars set LD_LIBRARY_PATH="" |
Note: To find the correct path for CUDA_HOME
use which nvcc
. In my case, output of the command was:
1 | >>> which nvcc |
Therefore, I set the CUDA_HOME
as /home/user/miniconda3/envs/py12/
.
Note: To find the correct path for LD_LIBRARY_PATH
use find ~ -name cuda_runtime_api.h
. In my case, output of the command was:
1 | >>> find ~ -name cuda_runtime_api.h |
So I set the LD_LIBRARY_PATH
as /home/user/miniconda3/envs/py12/targets/x86_64-linux/lib/
and CPATH
as /home/user/miniconda3/envs/py12/targets/x86_64-linux/include/
. If you have multiple CUDA installations, the output of find ~ -name cuda_runtime_api.h
will display multiple paths. Make sure to choose the path that corresponds to the environment you have created.
ref:https://github.com/IDEA-Research/GroundingDINO/issues/355
Note: Always reboot the computer after the cuda is upgraded
Note: 在更改LD_LIBRARY_PATH
后可能会导致neovim的pyright无法运行,所以建议在编译完成后设回该变量
1 | conda env config vars set LD_LIBRARY_PATH="" |
cudatoolkit
和cuda-toolkit
这两个可以同时安装
如果不安装cudatoolkit
可能会在编译时出现ld: cannot find -lcudart: No such file or directory collect2: error: ld returned 1 exit status
报错
使用以下指令获取版本信息
1 | python -c 'import torch;print(torch.__version__);print(torch.version.cuda)' |
1 | 2.0.0+cu117 |
Use SSH to Connect Jupyter-lab
使用ssh作为命令行远程工具,启动远程的jupyter lab并且在本地的浏览器中打开。
远程运行:
1 | jupyter lab --no-browser --port=8080 |
--no-broswer
is very important
output:
1 | ... |
本地运行:
1 | ssh -L 8080:localhost:8080 bohanfeng@192.168.2.102 |
本地浏览器访问:
http://127.0.0.1:8080/lab?token=0061d1eb31396b1bc3cd77a7161b2084da1dedcdeca0600c
I use a hyprland plugin called hyprscroller
to emulate the scroll functionality of PaperWM
.
However, I can’t get whether I am in row mode
or column mode
, so I want to show the mode status on my waybar
.
Related issue: https://github.com/dawsers/hyprscroller/issues/57
I wrote two shell script under ~/.config/waybar/
scroller_mode_listener.sh
, responsible for listening the IPC message of hyprscroller
and store that information in a tmp file. This script can be executed in hyprland config file using exec-once
1 |
|
scroller_mode_reader.sh
, responsible for reading the tmp file and return the json
value to waybar to change the shown icon.1 |
|
Then add the custom module to waybar in config file (we use signal to update the module):
1 | "custom/scroller-mode": { |
Also remember to add the module to the bar:
1 | "modules-right": ["custom/scroller-mode", "cpu", "memory", "temperature","battery","clock","custom/power"], |
Then everything is done