源码安装 AMD GPGPU 生态 ROCm 备忘

 

0, 前言

如果初步接触 AMD这套,可以先在ubuntu上使用apt工具安装,并针对特定感兴趣的模块从源码编译安装替换,并开展研究。对整体感兴趣时可以考虑从源码编译安装整个ROCm生态。

1, 预制二进制通过apt 安装

待补。。。

2, 从源码安装

sudo apt-get install git-lfs

rocm也是使用 repo工具管理整个项目代码

mkdir -p ~/bin/
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo



2.1  Step1: clone source code
 

mkdir -p ~/WORKSPACE/     && \
cd ~/WORKSPACE/  && \
export ROCM_VERSION=6.1.0  && \
~/bin/repo init -u http://github.com/ROCm/ROCm.git -b roc-6.1.x -m tools/rocm-build/rocm-${ROCM_VERSION}.xml   && \
~/bin/repo sync


2.2  Step 2: Prepare build environment


2.2.1Prepare prepare build environment

 fatal error: curl/curl.h: No such file or directory

sudo apt-get update
sudo apt-get install libcurl4-openssl-dev


sudo yum install libcurl-devl

fatal error: expat.h: No such file or directory
 

sudo apt-get update
sudo apt-get install libexpat1-dev

sudo yum install expat-devl


msgfmt: not found

sudo apt-get update
sudo apt-get install gettext


sudo yum install gettext
 
 
 
 
pip3: command not found

 

sudo apt-get update
sudo apt install python3-pip

no such file or directory: python
 

cd /usr/bin
sudo ln -s python3 python

/opt/Python-3.8.13 exist

无论什么因素导致中断,在重新执行 sudo bash install--prerequisities.sh
之前,需要先删除如下文件,他们会被重新构建:

 

sudo rm /usr/grpc/ -rf && \
sudo rm /tmp/grpc/ -rf && \
sudo rm /opt/Python-3.8.13/ -rf && \
sudo rm /usr/blis/amd-blis-mt -rf && \
sudo rm /usr/blis/ -rf

2.2.2 Prepare build environment

# For ubuntu20.04 system
cd ROCm/tools/rocm-build/docker/ubuntu20
bash install-prerequisites.sh
# For ubuntu22.04 system
cd ROCm/tools/rocm-build/docker/ubuntu22
bash install-prerequisities.sh

 这个 install-prerequisities.sh 会下载 (wget、 git clone 等等)很多源代码并编译,如果网速还行的话,运行时间需要按照几个小时左右来规划,跟cpu和内存也有关系 。

重要的事情说两遍:

过程中会因为各种因素而中断, 无论什么因素导致中断,在重新执行 sudo bash install--prerequisities.sh
之前,需要先删除如下文件,他们会被重新构建,并检查这些文件夹,故不能事先存在这些文件夹:
 

sudo rm /usr/grpc/ -rf && \
sudo rm /tmp/grpc/ -rf && \
sudo rm /opt/Python-3.8.13/ -rf && \
sudo rm /usr/blis/amd-blis-mt -rf && \
sudo rm /usr/blis/ -rf

sudo bash install--prerequisities.sh 执行后,截一个几十分钟后的图:

install_prerequisities.sh执行完毕后是这个样子:


2.3  Step 3: Run build command line

# Select GPU targets before building:
# When GPU_ARCHS is not set, default GPU targets supported by ROCm6.1 will be used.
# To build against a subset of GFX architectures you can use the below env variable.
# Support MI300 (gfx940, gfx941, gfx942).
 

export GPU_ARCHS="gfx942"               # Example
export GPU_ARCHS="gfx940;gfx941;gfx942" # Example

# Pick and run build commands in the docker container:
# Build rocm-dev packages
make -f ROCm/tools/rocm-build/ROCm.mk -j ${NPROC:-$(nproc)} rocm-dev
# Build all ROCm packages

make -f ROCm/tools/rocm-build/ROCm.mk -j ${NPROC:-$(nproc)} all


# list all ROCm components to find required components
make -f ROCm/tools/rocm-build/ROCm.mk list_components
# Build a single ROCm packages
make -f ROCm/tools/rocm-build/ROCm.mk T_rocblas


# Find built packages in ubuntu20.04:
out/ubuntu-20.04/20.04/deb/
# Find built packages in ubuntu22.04:
out/ubuntu-22.04/22.04/deb/

# Find built logs in ubuntu20.04:
out/ubuntu-20.04/20.04/logs/
# Find built logs in ubuntu22.04:
out/ubuntu-22.04/22.04/logs/
# All logs pertaining to failed components, end with .errrors extension.
out/ubuntu-22.04/22.04/logs/rocblas.errors          # Example
# All logs pertaining to building components, end with .inprogress extension.
out/ubuntu-22.04/22.04/logs/rocblas.inprogress  # Example
# All logs pertaining to passed components, use the component names.
out/ubuntu-22.04/22.04/logs/rocblas             # Example

效果图示:

待补。。。

相关推荐

  1. NeuralKG运行

    2024-07-21 15:08:03       55 阅读
  2. Linux手册

    2024-07-21 15:08:03       39 阅读
  3. Git 清单

    2024-07-21 15:08:03       47 阅读
  4. vue,Promise

    2024-07-21 15:08:03       40 阅读
  5. UnityDOTS

    2024-07-21 15:08:03       24 阅读
  6. Json格式

    2024-07-21 15:08:03       24 阅读
  7. Linux CenTOS命令

    2024-07-21 15:08:03       56 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-21 15:08:03       52 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-21 15:08:03       54 阅读
  3. 在Django里面运行非项目文件

    2024-07-21 15:08:03       45 阅读
  4. Python语言-面向对象

    2024-07-21 15:08:03       55 阅读

热门阅读

  1. 12.顶部带三角形的边框 & CSS 关键字 currentColor

    2024-07-21 15:08:03       16 阅读
  2. Redis 基数树

    2024-07-21 15:08:03       17 阅读
  3. 树上统计

    2024-07-21 15:08:03       18 阅读
  4. Android中Retrofit的学习和使用记录

    2024-07-21 15:08:03       20 阅读
  5. Try ubuntu core (by quqi99)

    2024-07-21 15:08:03       20 阅读
  6. 独孤思维:副业赚钱,易如反掌

    2024-07-21 15:08:03       16 阅读
  7. Composition API对比Options API

    2024-07-21 15:08:03       15 阅读
  8. C# 删除DataTable里符合条件的行

    2024-07-21 15:08:03       16 阅读
  9. centos7更换yum源

    2024-07-21 15:08:03       16 阅读
  10. c++应用网络编程之五Windows常用的网络IO模型

    2024-07-21 15:08:03       17 阅读
  11. opencv—常用函数学习_“干货“_12

    2024-07-21 15:08:03       17 阅读