Skip to content

CARMA_platform_compilation_and_testing

Alexander Alekhin edited this page Jun 16, 2016 · 2 revisions

CARMA build, test and run instruction.

1. Install build suites

  • Install gcc-4.5-arm-linux-gnueabi, g++-4.5-arm-linux-gnueabi, cmake, make, python
  • Download Thrust library (it isn’t included in CUDA 4.2 for CARMA). Copy thrust directory with header files to /include
git clone git://github.com/thrust/thrust.git
cp -r thrust/thrust <path to cuda toolkit>/include/thrust

2. Getting OpenCV sources and testdata:

git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_extra.git

3. Build OpenCV for CARMA

1. create <opencv_build> directory and go to there

2. cmake -DGCC_COMPILER_VERSION="4.5" -DSOFTFP=ON -DUSE_NEON=ON -DCMAKE_SKIP_RPATH=ON \
-DCUDA_TOOLKIT_ROOT_DIR=<cuda_dir> -DCUDA_ARCH_BIN="2.1(2.0)" -DCUDA_ARCH_PTX="" \
-DWITH_CUDA=ON -DWITH_CUBLAS=ON -DWITH_TBB=ON -DBUILD_opencv_python=OFF -DBUILD_TBB=ON \
-DBUILD_ZLIB=ON -DBUILD_TIFF=ON -DBUILD_JASPER=ON -DBUILD_JPEG=ON -DBUILD_PNG=ON -DBUILD_OPENEXR=ON \
-DCMAKE_TOOLCHAIN_FILE=<opencv_source>/platforms/linux/arm-gnueabi.toolchain.cmake <opencv_source>

3. make

Note: Form the listing above, OpenCV GPU will be compiled only for Fermi sm_21. To adjust target architectures, you need to modify CUDA_ARCH_BIN and CUDA_ARCH_PTX CMake variables, which control what to embed in output file as GPU binary and as PTX intermediate code.

For those who are familiar with NVCC command line interface

  • -DCUDA_ARCH_BIN=“2.1(2.0)” is expanded to –gencode arch=compute_20,code=sm_21
  • -DCUDA_ARCH_BIN=“3.0” is expanded to –gencode arch=compute_30,code=sm_30
  • -DCUDA_ARCH_PTX=“3.0” is expanded to –gencode arch=compute_30,code=compute_30

You can specify several compute capabilities, but setting single architecture reduces output binary size and compilation time.

  • -DCUDA_ARCH_BIN=“2.1(2.0) 3.0 3.5”
  • -DCUDA_ARCH_PTX=“1.2 1.3”

4. Deploy OpenCV and test suite to CARMA

  • Copy applications from opencv/build/bin directory.
  • Copy libraries from opencv/build/lib directory.
  • Copy directory opencv_extra/testdata to CARMA.

5. Run tests on CARMA and generating report

  • Specify test data path by setting:
export OPENCV_TEST_DATA_PATH=<path to testdata folder>
  • Execute accuracy tests. It will run on all CUDA devices installed
./opencv_test_gpu
  • Execute performance tests on specified device.
./opencv_perf_gpu --gtest_output=xml:perf_report.xml  [--perf_cuda_device=N]
  • Generate human readable report file
copy perf_report.xml from CARMA to desktop.
python opencv/modules/ts/misc/summary.py perf_report.xml -o html >report.html
  • It’s possible to pass arbitrary number of another report files from another test runs on another hardware to compare all them in one summary final report.
python opencv/modules/ts/misc/summary.py fil1.xml fil2.xml fil3.xml -o html >report.html
  • To run measure performance of CPU counterparts from OpenCV run the same performance framework in the following way:
./opencv_perf_gpu --gtest_output=xml:cpu_perf_report.xml --perf_run_cpu
./opencv_perf_gpu --gtest_output=xml:perf_report.xml --gtest_filter=*GoodFeaturesToTrack*
Clone this wiki locally