Sysprogs forums › Forums › VisualGDB › How to enable NEON and VFPV3 when compiling in C++ for Beaglebone/RPi?
- This topic has 5 replies, 3 voices, and was last updated 7 years ago by
hanooi.
-
AuthorPosts
-
April 8, 2019 at 18:34 #24604
hanooi
ParticipantHello,
I’m following the building OpenCV for the Raspberry Pi 2 example. I’m interested in enabling the use of NEON and VFPV3 for my compiled shared objects but I don’t know where to go in VisualGDB Project Properties to set these flags. Per this article but for Python, using the NEON instructions can result in a 40% to 50% speedup:
The flags in the above article were set by adding the “-D ENABLE_NEON=ON -D ENABLE_VFPV3=ON” to cmake.
Thanks,
Han Ooi
April 8, 2019 at 20:00 #24605aronrubin
ParticipantI have the following in my project’s CMakeLists.txt:
if(CMAKE_SYSTEM_PROCESSOR MATCHES “BCM28|armv7”)
add_compile_options(-march=armv8-a+crc -mcpu=cortex-a53 -mfpu=neon-fp-armv8)
endif()April 9, 2019 at 02:03 #24608support
KeymasterHi All,
Thanks @aronrubin for sharing your solution!
Editing CMakeLists.txt should indeed do the trick. If not, please check the generated .mak files for the compiler command lines (if -mfpu=neon-fp-armv8 does not appear there, the CMAKE_SYSTEM_PROCESSOR might not be matched properly).
If you would like to follow the tutorial linked above to the letter, you can use the VisualGDB Project Properties -> CMake Project Settings -> Extra CMake Configuration Variables setting to specify flags like ENABLE_NEON. E.g. simply “ENABLE_NEON=ON”.
April 9, 2019 at 16:57 #24621aronrubin
ParticipantTo determine if opencv is using these instructions at runtime use the command line:
opencv_version --hwApril 9, 2019 at 17:26 #24622support
KeymasterThanks very much for sharing this!
April 9, 2019 at 18:51 #24625hanooi
ParticipantDid just that and got the below. It worked! Thanks so much!
4.0.1
OpenCV’s HW features list:
ID= 1 (MMX) -> N/A
ID= 2 (SSE) -> N/A
ID= 3 (SSE2) -> N/A
ID= 4 (SSE3) -> N/A
ID= 5 (SSSE3) -> N/A
ID= 6 (SSE4.1) -> N/A
ID= 7 (SSE4.2) -> N/A
ID= 8 (POPCNT) -> N/A
ID= 9 (FP16) -> ON
ID= 10 (AVX) -> N/A
ID= 11 (AVX2) -> N/A
ID= 12 (FMA3) -> N/A
ID= 13 (AVX512F) -> N/A
ID= 14 (AVX512BW) -> N/A
ID= 15 (AVX512CD) -> N/A
ID= 16 (AVX512DQ) -> N/A
ID= 17 (AVX512ER) -> N/A
ID= 18 (AVX512IFMA) -> N/A
ID= 19 (AVX512PF) -> N/A
ID= 20 (AVX512VBMI) -> N/A
ID= 21 (AVX512VL) -> N/A
ID=100 (NEON) -> ON
ID=200 (VSX) -> N/A
ID=201 (VSX3) -> N/A
ID=256 (AVX512-SKX) -> N/A
Total available: 2 -
AuthorPosts
- You must be logged in to reply to this topic.