|
| 1 | +# User guides |
| 2 | +# |
| 3 | +# 0. Install Ascend driver on host. |
| 4 | +# (https://www.hiascend.com/en/hardware/firmware-drivers) |
| 5 | +# |
| 6 | +# 1. Run docker container. |
| 7 | +# docker run -it \ |
| 8 | +# --name opencv \ |
| 9 | +# --device /dev/davinci0 \ |
| 10 | +# --device /dev/davinci_manager \ |
| 11 | +# --device /dev/devmm_svm \ |
| 12 | +# --device /dev/hisi_hdc \ |
| 13 | +# -v /usr/local/dcmi:/usr/local/dcmi \ |
| 14 | +# -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \ |
| 15 | +# -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \ |
| 16 | +# opencv bash |
| 17 | +# |
| 18 | +# 2. Check environment. |
| 19 | +# npu-smi info |
| 20 | +# |
| 21 | +# 3. Compile opencv with Ascend NPU backend. |
| 22 | +# cmake -DWITH_CANN=1 |
| 23 | +# |
| 24 | +# 4. Run opencv_test_cannops. |
| 25 | +# ./bin/opencv_test_cannops |
| 26 | + |
| 27 | +FROM openeuler/openeuler:22.03-lts-sp2 |
| 28 | + |
| 29 | +RUN yum install -y \ |
| 30 | + git \ |
| 31 | + wget \ |
| 32 | + gcc \ |
| 33 | + g++ \ |
| 34 | + cmake \ |
| 35 | + make \ |
| 36 | + python-pip \ |
| 37 | + python3-devel |
| 38 | + |
| 39 | +RUN which pip |
| 40 | + |
| 41 | +RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy sympy decorator scipy attrs |
| 42 | + |
| 43 | +# Install CANN |
| 44 | +RUN wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL%20V100R001C13SPC702/Ascend-cann-toolkit_7.0.RC1.alpha002_linux-"$(uname -i)".run && \ |
| 45 | + chmod +x Ascend-cann-toolkit_7.0.RC1.alpha002_linux-"$(uname -i)".run && \ |
| 46 | + ./Ascend-cann-toolkit_7.0.RC1.alpha002_linux-"$(uname -i)".run --install && \ |
| 47 | + rm -f ./Ascend-cann-toolkit_7.0.RC1.alpha002_linux-"$(uname -i)".run |
| 48 | + |
| 49 | +ENV LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64/common:/usr/local/Ascend/driver/lib64/driver:$LD_LIBRARY_PATH:/usr/lib64 |
| 50 | +ENV ASCEND_TOOLKIT_HOME=/usr/local/Ascend/ascend-toolkit/latest |
| 51 | +ENV LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/lib64/plugin/opskernel:${ASCEND_TOOLKIT_HOME}/lib64/plugin/nnengine:${ASCEND_TOOLKIT_HOME}/opp/built-in/op_impl/ai_core/tbe/op_tiling:$LD_LIBRARY_PATH |
| 52 | +ENV PYTHONPATH=${ASCEND_TOOLKIT_HOME}/python/site-packages:${ASCEND_TOOLKIT_HOME}/opp/built-in/op_impl/ai_core/tbe:$PYTHONPATH |
| 53 | +ENV PATH=${ASCEND_TOOLKIT_HOME}/bin:${ASCEND_TOOLKIT_HOME}/compiler/ccec_compiler/bin:$PATH |
| 54 | +ENV ASCEND_AICPU_PATH=${ASCEND_TOOLKIT_HOME} |
| 55 | +ENV ASCEND_OPP_PATH=${ASCEND_TOOLKIT_HOME}/opp |
| 56 | +ENV TOOLCHAIN_HOME=${ASCEND_TOOLKIT_HOME}/toolkit |
| 57 | +ENV ASCEND_HOME_PATH=${ASCEND_TOOLKIT_HOME} |
0 commit comments