Skip to content

Commit 4b7de5a

Browse files
committed
Merge branch 4.x
2 parents 72721eb + c7602a8 commit 4b7de5a

File tree

70 files changed

+6842
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+6842
-92
lines changed

modules/cannops/CMakeLists.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if(IOS OR WINRT OR ANDROID OR APPLE OR WIN32 OR (NOT HAVE_CANN))
2+
ocv_module_disable(cannops)
3+
endif()
4+
5+
set(the_description "Ascend-accelerated Operations on Matrices")
6+
7+
ocv_add_module(cannops opencv_core WRAP python)
8+
ocv_module_include_directories(${CANN_INCLUDE_DIRS})
9+
ocv_glob_module_sources()
10+
ocv_install_used_external_targets(${CANN_LIBRARIES})
11+
ocv_create_module(${CANN_LIBRARIES})
12+
13+
ocv_include_directories(${CMAKE_SOURCE_DIR}/modules/ts/include)
14+
15+
ocv_add_accuracy_tests(DEPENDS_ON opencv_cannops)
16+
ocv_add_perf_tests(DEPENDS_ON opencv_cannops)
17+
ocv_add_samples(opencv_cannops)

modules/cannops/Dockerfile

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple \
40+
numpy \
41+
sympy \
42+
decorator \
43+
scipy \
44+
attrs \
45+
psutil
46+
47+
# Install CANN
48+
RUN wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%207.0.RC1/Ascend-cann-toolkit_7.0.RC1_linux-"$(uname -i)".run && \
49+
chmod +x Ascend-cann-toolkit_7.0.RC1_linux-"$(uname -i)".run && \
50+
./Ascend-cann-toolkit_7.0.RC1_linux-"$(uname -i)".run --quiet --install && \
51+
rm -f ./Ascend-cann-toolkit_7.0.RC1_linux-"$(uname -i)".run
52+
53+
# Install kernel
54+
RUN wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%207.0.RC1/Ascend-cann-kernels-310p_7.0.RC1_linux.run && \
55+
chmod +x Ascend-cann-kernels-310p_7.0.RC1_linux.run && \
56+
./Ascend-cann-kernels-310p_7.0.RC1_linux.run --quiet --install && \
57+
rm -f ./Ascend-cann-kernels-310p_7.0.RC1_linux.run
58+
59+
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
60+
ENV ASCEND_TOOLKIT_HOME=/usr/local/Ascend/ascend-toolkit/latest
61+
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
62+
ENV PYTHONPATH=${ASCEND_TOOLKIT_HOME}/python/site-packages:${ASCEND_TOOLKIT_HOME}/opp/built-in/op_impl/ai_core/tbe:$PYTHONPATH
63+
ENV PATH=${ASCEND_TOOLKIT_HOME}/bin:${ASCEND_TOOLKIT_HOME}/compiler/ccec_compiler/bin:$PATH
64+
ENV ASCEND_AICPU_PATH=${ASCEND_TOOLKIT_HOME}
65+
ENV ASCEND_OPP_PATH=${ASCEND_TOOLKIT_HOME}/opp
66+
ENV TOOLCHAIN_HOME=${ASCEND_TOOLKIT_HOME}/toolkit
67+
ENV ASCEND_HOME_PATH=${ASCEND_TOOLKIT_HOME}

0 commit comments

Comments
 (0)