Multi-threading not working on raspberry
fnoop opened this issue · 5 comments
track_targets performs better when compiled to use a single thread for marker detection:
MParams.maxThreads = 1;
When compiled for multiple or maximum threads: MParams.maxThreads = -1;
, performance decreases (about 20ms to 25-30ms per frame).
cmake sets c++ flags to: -- C++ flags (Release): -fomit-frame-pointer -O2 -ffast-math -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -DNDEBUG -Wall
seems to be missing threading flags: -std=c++0x thread.cxx -o thread -pthread
Also check it's building release and not debug
v.useful info:
https://www.raspberrypi.org/forums/viewtopic.php?t=144115
Actually looks like aruco is compiling with debug flags:
-- C++ flags (Debug): -g3 -O0 -DDEBUG -D_DEBUG -W -Wextra -Wno-return-type -Wall
Added '-DCMAKE_BUILD_TYPE=Release -DENABLE_OPENMP=ON' compile options to turn off debug flags.
cmake/compilerOptions.cmake sets wrong flags for raspberry:
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES armv7l) # In ARM_COrtex8 with neon, enalble vectorized operations
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize ")
endif()
changing compile options to:
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES armv7l) # In ARM_COrtex8 with neon, enalble vectorized operations
# set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize ")
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -march=armv8-a+crc -mfpu=neon-vfpv4 -mtune=cortex-a53 -ftree-vectorize -mfloat-abi=hard -O3 ")
endif()