/images/avatar.png

CUDA unknown error - this may be due to an incorrectly set up environment

Problem description

1
2
3
4
5
6
>>> torch.cuda.is_available()                                                     
/home/python3.8/site-packages/torch/cuda/__init__.py:141: UserWarning: CUDA initialization: CUDA unknown error - this may be due to an
 incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at /opt/con
da/conda-bld/pytorch_1708025845899/work/c10/cuda/CUDAFunctions.cpp:108.)   return torch._C._cuda_getDeviceCount() > 0                        

False         

But both nvcc - V and nvidia-smi still work

Solution

1
2
sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvm

ubuntu 18.04 升级至 glibc_2.28

近期在ubuntu 18.04上开发PyQt6前段时发现问题:

ubuntu 18.04.6 默认的 glibc 版本位 2.27, 在运行最新的 Qt Creator 6.0.2 时会报错

1
$ /opt/Qt/Tools/QtCreator/bin/qtcreator

报错

1
/opt/Qt/Tools/QtCreator/bin/qtcreator: /lib/x86_64-linux-gnu/libc.so.6: version `glibc_2.28' not found

此时最佳方法是升级到 ubuntu 20.04 或 ubuntu 22.04, 还有一种"比较省心"的方法, 保留系统仅升级 glibc

下载 https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.xz

准备编译环境

1
$ sudo apt install build-essential gawk bison

然后解压和编译

1
2
3
4
5
6
$ tar -xJf glibc-2.28.tar.xz
$ cd glibc-2.28/
$ mkdir build
$ cd build
$ ../configure --prefix=/usr
$ make

到这一步后不要 sudo make install 立刻安装到 /usr

How to Install and Configure VNC on Ubuntu 20.04

Introduction

Virtual Network Computing, or VNC, is a connection system that allows you to use your keyboard and mouse to interact with a graphical desktop environment on a remote server. It makes managing files, software, and settings on a remote server easier for users who are not yet comfortable with the command line.

In this guide, you’ll set up a VNC server with TightVNC on an Ubuntu 20.04 server and connect to it securely through an SSH tunnel. Then, you’ll use a VNC client program on your local machine to interact with your server through a graphical desktop environment.

生物信息领域牛刊修仙版

在知乎上看到生物信息学领域的牛刊投稿顺序,发现一个很有趣的回答,于是转载一下作为参考:

凡人期:这是修仙之路的起点,指的是还未开始修炼或刚刚接触修炼之道的普通研究生。

arXiv,bioRxiv

练气期:这是修仙的基础阶段,研究生修行者开始吸收天地灵气,将其转化为体内的元力。

BMC genomics,BMC bioinformatics,BMC biology,BMC medical genomics

筑基期:这是研究生修仙之路的起点,修行者开始修炼内功,累积内力,打下坚实的基础。

Bioinformatics,PLoS computational biology,PLoS genetics,Briefings in bioinformatics,BMC medicine

金丹期:修行者的内力能够凝聚成金丹,这个金丹象征着高级别的修为和力量。

Nucleic Acids Research,eBiomedicine,Advanced Science,PLoS Biology

元婴期:修行者的金丹形成元婴,元婴是修行者灵魂和修为的化身,跨入更高的境界。

Genome Biology,Genome Medicine,Genome Research,Molecular Systems Biology,Cell systems

化神期:修行者的元婴进一步成长,开始向神灵的境界转变。

Nature Communications,PNAS,Science Advances,Cell Reports

合体期:修行者的身体和灵魂开始与周围的世界融合,接近于自然(Nature)的本源。

Nature Machine Intelligence,Nature Computational Sciences

大乘期:修行者几乎达到了仙道的巅峰,具备了创造或改变世界的能力。

Nature Genetics,Nature Biotechnology,Nature Methods,Nature Medicine,Cell Genomics

飞升期:修行者完成了修仙之路,失去凡体,飞升仙界,无相无形,成为自然(Nature)。

Nature,Science,Cell

Acknowledgement:

作者:浪矢Ryan 链接:https://www.zhihu.com/question/21660698/answer/3310893434 来源:知乎

docker拉取镜像修改打包教程

近期因为工作需求和提高用户友好度的考量需要对软件进行Docker打包,于是总结以下简易流程。

  1. 拉取镜像,如果需要预先配置好CUDA等,可以搜索对应镜像:

    1
    
    docker pull nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04
    
  2. 进入镜像,修改软件配置环境等:

    1
    2
    
    docker run --gpus all -it nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04 /bin/bash
    apt-get update && apt-get install -y wget nano vim curl less
    
  3. 安装Conda环境以及其它需要的软件

    1
    2
    
    curl -O https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh
    bash Anaconda3-2023.09-0-Linux-x86_64.sh
    
  4. 新建repository

    https://hub.docker.com/repository/

  5. 用docker commit从容器打包镜像
    1
    2
    
    sudo docker ps -a
    sudo docker commit -m "AutoBA" -a "juexiao_zhou (www.joshuachou.ink)" 12748b01449a joshuachou666/autoba:cuda12.2.2-cudnn8-devel-ubuntu22.04-autoba0.0.3
    

    然后docker images就能在本地找到打包好的镜像

  6. 上传镜像

    1
    2
    3
    4
    5
    
    # sudo docker login --username=用户名
    sudo docker login --username=admin
    
    # sudo docker push 镜像tag
    sudo docker push joshuachou666/autoba:cuda12.2.2-cudnn8-devel-ubuntu22.04-autoba0.0.3
    
  7. 重新拉取镜像测试

全新Ubuntu18.04配置DL环境,保姆级教程

  1. 获取IP地址

    1
    2
    
    sudo apt install net-tools
    ifconfig
    
  2. 安装openssh,这样可以远程ssh连接服务器

    1
    
    sudo apt install openssh-server
    
  3. 安装gcc

    1
    
    sudo apt install gcc g++ make
    
  4. 安装NVIDIA驱动

    1. 在https://www.nvidia.com/Download/index.aspx?lang=cn下载对应型号驱动

    2. 1
      
      wget https://cn.download.nvidia.com/XFree86/Linux-x86_64/535.104.05/NVIDIA-Linux-x86_64-535.104.05.run
      
    3. 禁用nouveau

      1
      2
      3
      4
      5
      
      sudo nano /etc/modprobe.d/blacklist.conf
      # 最后一行加入
      blacklist nouveau
      sudo update-initramfs -u
      sudo reboot
      
    4. 检查nouveau是否不在运行

      1
      2
      
      lsmod | grep nouveau  # 没输出代表禁用生效
      sudo telinit 3
      
    5. 安装驱动

      1
      2
      
      sudo chmod a+x NVIDIA-Linux-x86_64-535.104.05.run
      sudo sh ./NVIDIA-Linux-x86_64-535.104.05.run --no-opengl-files
      

      –no-opengl-files 参数必须加否则会循环登录,也就是loop login