##建议提前装好OneAPI套件,至少有mkl库

sudo rocminfo | grep gfx
#  Name:                    gfx1032                            
#  Name:                    amdgcn-amd-amdhsa--gfx1032  

git clone --recursive https://github.com/pytorch/pytorch.git
cd pytorch
git submodule sync
git submodule update --init --recursive

set -e
SCRIPT_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
BUILD_PATH=${SCRIPT_DIR}/build
export ROCM_PATH=/opt/rocm
export PATH=/opt/rocm/bin:/opt/rocm/hip/bin:/opt/rocm/llvm/bin:$PATH
export LD_LIBRARY_PATH=/opt/rocm/lib:/lib:/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}

pip install -r requirements.txt
git submodule sync
git submodule update --init --recursive
git checkout -- .
git clean -df -e build.sh

python3 tools/amd_build/build_amd.py

# 编译选项
# AMD Radeon 6600
export PYTORCH_ROCM_ARCH="gfx1032"  
export _GLIBCXX_USE_CXX11_ABI=1
export USE_NUMPY=1
export USE_ROCM=1
export USE_LMDB=1
export USE_OPENCV=1
export USE_MKLDNN=0
export USE_CUDA=0
export USE_NINJA=0
export BUILD_CAFFE2=0
export BUILD_CAFFE2_OPS=0
export BUILD_TEST=0
export MAX_JOBS=32
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}

# 编译 
python3 setup.py build
#error python3 setup.py clean
#
-------------------------------------------------------------------------
|                                                                       |
|    It is no longer necessary to use the 'build' or 'rebuild' targets  |
|                                                                       |
|    To install:                                                        |
|      $ python setup.py install                                        |
|    To develop locally:                                                |
|      $ python setup.py develop                                        |
|    To force cmake to re-generate native build files (off by default): |
|      $ python setup.py develop --cmake                                |
|                                                                       |
-------------------------------------------------------------------------
#
python3 setup.py install

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐