komrad36 / LATCH

Fastest CPU implementation of the LATCH 512-bit binary feature descriptor; fully scale- and rotation-invariant
MIT License
34 stars 12 forks source link

on Unubtu 16.04 compile! error #7

Open hunandy14 opened 6 years ago

hunandy14 commented 6 years ago

this is compile error message.

chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:    16.04
Codename:   xenial

chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make clean 
rm -rf *.o LATCH
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make    
g++ -c  -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx2 -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize  main.cpp -o main.o
g++ -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx2 -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize main.o  -o LATCH -lopencv_core -lopencv_features2d -lopencv_highgui -lopencv_imgcodecs -lpthread
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ ./LATCH 

Detecting...
Warming up...
Illegal instruction (core dumped)
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ 

my cpu is E3-1230 v2 i am test on win10 VS2017. is ok.

What happened?

and sorry, i am c++ lang and linux is not good. ((QuQ

this code and MakeFile command, do not really understand. this is my project https://github.com/hunandy14/orb_blend/tree/master/orb_blend i want release to Tx2 embedded.

komrad36 commented 6 years ago

Please read the README.

"If you do not have AVX2, uncomment the '#define NO_AVX_PLEASE' in LATCH.h to route the code through SSE isntructions only. NOTE THAT THIS IS ABOUT 50% SLOWER. A processor with full AVX2 support is highly recommended."

Your processor does not support AVX2 instructions. You can rebuild with NO_AVX_PLEASE flag but it will be slower.

hunandy14 commented 6 years ago

sorry , i am forget to say , I tried it yesterday.

now i'm try again.

chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ git reset --hard
HEAD is now at 1a1d222 Added (slower) non-AVX version.
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make clean
rm -rf *.o LATCH
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ git diff
diff --git a/LATCH.h b/LATCH.h
index fc298a5..b3deb04 100644
--- a/LATCH.h
+++ b/LATCH.h
@@ -46,7 +46,7 @@
 #pragma once

-//#define NO_AVX_PLEASE
+#define NO_AVX_PLEASE^M

 #include <future>
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make
g++ -c  -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx2 -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize  main.cpp -o main.o
g++ -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx2 -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize main.o  -o LATCH -lopencv_core -lopencv_features2d -lopencv_highgui -lopencv_imgcodecs -lpthread
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ ./LATCH

Detecting...
Warming up...
不合法的命令 (core dumped)
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$
komrad36 commented 6 years ago

I'm a little suspicious of the "^M" character in the #define. Please make sure you really have cleanly defined NO_AVX_PLEASE. if it still crashes, please attach a debugger and let me know on what line and with what problem. I can't repro locally.

-Kareem

On Thu, Jun 28, 2018, 12:25 CharlotteHonG notifications@github.com wrote:

sorry , i am forget to say , I tried it yesterday.

now i'm try again.

chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ git reset --hard HEAD is now at 1a1d222 Added (slower) non-AVX version. chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make clean rm -rf *.o LATCH chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ git diff diff --git a/LATCH.h b/LATCH.h index fc298a5..b3deb04 100644 --- a/LATCH.h +++ b/LATCH.h @@ -46,7 +46,7 @@

pragma once

-//#define NO_AVX_PLEASE +#define NO_AVX_PLEASE^M

include

chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make g++ -c -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx2 -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize main.cpp -o main.o g++ -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx2 -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize main.o -o LATCH -lopencv_core -lopencv_features2d -lopencv_highgui -lopencv_imgcodecs -lpthread chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ ./LATCH

Detecting... Warming up... 不合法的命令 (core dumped) chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/komrad36/LATCH/issues/7#issuecomment-401145880, or mute the thread https://github.com/notifications/unsubscribe-auth/AMZ_gmHxm0U1ZTRTzmsJ3OjaFokiDkDcks5uBS21gaJpZM4U6RTm .

hunandy14 commented 6 years ago

thank your time. realy


i google "git diff ^M", then get it https://stackoverflow.com/questions/1889559/git-diff-to-ignore-m

i use "visual studio code" change "CRLF -> LF". then rebuild LATCH, and i get same error.


if that not key message. i am Sorry. I don't know how to use GDB. i try goole to learn. took a little time.

then this

chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make cleanrm -rf *.o LATCH
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make
g++ -g -c  -g -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx2 -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize  main.cpp -o main.og++ -g -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx2 -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize main.o  -o LATCH -lopencv_core -lopencv_features2d -lopencv_highgui -lopencv_imgcodecs -lpthread
chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ gdb LATCH
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from LATCH...done.
(gdb) run
Starting program: /home/chg-ezlink/gitRepos/LATCH/LATCH
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Detecting...
[New Thread 0x7fffe9271700 (LWP 8582)]
[New Thread 0x7fffe8a70700 (LWP 8583)]
[New Thread 0x7fffe3fff700 (LWP 8584)]
[New Thread 0x7fffe37fe700 (LWP 8585)]
[New Thread 0x7fffe2ffd700 (LWP 8586)]
[New Thread 0x7fffe27fc700 (LWP 8587)]
[New Thread 0x7fffe1ffb700 (LWP 8588)]
[New Thread 0x7fffe0f3b700 (LWP 8589)]
[New Thread 0x7fffd7fff700 (LWP 8590)]
[New Thread 0x7fffd77fe700 (LWP 8591)]
[New Thread 0x7fffd6ffd700 (LWP 8592)]
[New Thread 0x7fffd67fc700 (LWP 8593)]
[New Thread 0x7fffd5ffb700 (LWP 8594)]
[New Thread 0x7fffd57fa700 (LWP 8595)]
[New Thread 0x7fffd4ff9700 (LWP 8596)]
Warming up...
[New Thread 0x7fffe17fa700 (LWP 8597)]
[New Thread 0x7fffb7fff700 (LWP 8598)]
[New Thread 0x7fffb77fe700 (LWP 8599)]

Thread 17 "LATCH" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7fffe17fa700 (LWP 8597)]
_LATCH (start=<optimized out>, thread_stride=<optimized out>,
Python Exception <class 'RuntimeError'> Type is not a template.:
    image=0x7ffff1152040 "\243\236\257\260\251\245\263\257\273\263\256\252\272\260\253\272\273½\271\211zw\200\231\216jo_qt\202\207\217\270\331\335\340\332Ȳ\244ud\246\271\244\254\277\272\277\246\253\220\241\302\324\325\327\325\323\327\326\316ƾ\276\276\266\265\273\276\275\303\322Ȼ\301\304\306\313\326\330\325\315\312\320\320\321\317\305\303\320ǻ\322\313\320\317\311ɶ\201Xglx\220\222\233\241\233\240\251\241\247\257\253\233\244\247\243\245\243\235\240\254\263\254\247\250\250\247\233\240\233\245\264\330\332\323\326\316\323\315\324\322\331\323\307\316\323\322\326\323\322\331\331\327\333\324\325\320\326\327\326\334\322\326\332\316\313\317\307\307\317\315\320\327\313ūtcuw\230\254\236\237\246\227\223\217\226\211\246\316\332", <incomplete sequence \331>..., stride=1920, keypoints=..., descriptors=0x11dbdc0) at LATCH.h:83
83                                      const __m128i offsets = _mm_add_epi32(_mm_sub_epi32(_mm_cvtps_epi32(_mm_add_ps(_mm_min_ps(_mm_max_ps(_mm_sub_ps(_mm_mul_ps(xs, cos_theta), _mm_mul_ps(ys, sin_theta)), _mm_set_ps1(-32.0f)), _mm_set_ps1(32.0f)), ptx)), _mm_set1_epi32(3)), _mm_mullo_epi32(_mm_set1_epi32(stride), _mm_cvtps_epi32(_mm_add_ps(_mm_min_ps(_mm_max_ps(_mm_add_ps(_mm_mul_ps(xs, sin_theta), _mm_mul_ps(ys, cos_theta)), _mm_set_ps1(-32.0f)), _mm_set_ps1(32.0f)), pty))));
(gdb)
komrad36 commented 6 years ago

Okay, so you are still getting "illegal instruction" at that line. But the highest instruction set required by that line is SSE4.1, which is fully supported by your processor.

So I think it might be the fact that I'm compiling with the "-mavx2" flag. Please try changing all instances of "-mavx2" in the Makefile to "-mavx".

hunandy14 commented 6 years ago

Thanks for getting back to me.

i get same error.

#chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make clean 
rm -rf *.o LATCH
#chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ make
g++ -c  -g -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize  main.cpp -o main.o
g++ -g -Wall -Wextra -Werror -Wshadow -pedantic -Ofast -std=gnu++17 -fomit-frame-pointer -mavx -march=native -mfma -flto -funroll-all-loops -fpeel-loops -ftracer -ftree-vectorize main.o  -o LATCH -lopencv_core -lopencv_features2d -lopencv_highgui -lopencv_imgcodecs -lpthread
#chg-ezlink@chgezlink-MS-7788:~/gitRepos/LATCH$ gdb LATCH 
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from LATCH...done.
#(gdb) run
Starting program: /home/chg-ezlink/gitRepos/LATCH/LATCH 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Detecting...
[New Thread 0x7fffe9271700 (LWP 4448)]
[New Thread 0x7fffe8a70700 (LWP 4449)]
[New Thread 0x7fffe3fff700 (LWP 4450)]
[New Thread 0x7fffe37fe700 (LWP 4451)]
[New Thread 0x7fffe2ffd700 (LWP 4452)]
[New Thread 0x7fffe27fc700 (LWP 4453)]
[New Thread 0x7fffe1ffb700 (LWP 4454)]
[New Thread 0x7fffe0f3b700 (LWP 4455)]
[New Thread 0x7fffdbfff700 (LWP 4456)]
[New Thread 0x7fffdb7fe700 (LWP 4457)]
[New Thread 0x7fffdaffd700 (LWP 4458)]
[New Thread 0x7fffda7fc700 (LWP 4459)]
[New Thread 0x7fffd9ffb700 (LWP 4460)]
[New Thread 0x7fffd97fa700 (LWP 4461)]
[New Thread 0x7fffd8ff9700 (LWP 4462)]
Warming up...
[New Thread 0x7fffe17fa700 (LWP 4463)]
[New Thread 0x7fffbbfff700 (LWP 4464)]
[New Thread 0x7fffbb7fe700 (LWP 4465)]

Thread 17 "LATCH" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7fffe17fa700 (LWP 4463)]
_LATCH (start=<optimized out>, thread_stride=<optimized out>, 
Python Exception <class 'RuntimeError'> Type is not a template.: 
    image=0x7ffff1152040 "\243\236\257\260\251\245\263\257\273\263\256\252\272\260\253\272\273½\271\211zw\200\231\216jo_qt\202\207\217\270\331\335\340\332Ȳ\244ud\246\271\244\254\277\272\277\246\253\220\241\302\324\325\327\325\323\327\326\316ƾ\276\276\266\265\273\276\275\303\322Ȼ\301\304\306\313\326\330\325\315\312\320\320\321\317\305\303\320ǻ\322\313\320\317\311ɶ\201Xglx\220\222\233\241\233\240\251\241\247\257\253\233\244\247\243\245\243\235\240\254\263\254\247\250\250\247\233\240\233\245\264\330\332\323\326\316\323\315\324\322\331\323\307\316\323\322\326\323\322\331\331\327\333\324\325\320\326\327\326\334\322\326\332\316\313\317\307\307\317\315\320\327\313ūtcuw\230\254\236\237\246\227\223\217\226\211\246\316\332", <incomplete sequence \331>..., stride=1920, keypoints=..., 
    descriptors=0x11dbdc0) at LATCH.h:83
83                  const __m128i offsets = _mm_add_epi32(_mm_sub_epi32(_mm_cvtps_epi32(_mm_add_ps(_mm_min_ps(_mm_max_ps(_mm_sub_ps(_mm_mul_ps(xs, cos_theta), _mm_mul_ps(ys, sin_theta)), _mm_set_ps1(-32.0f)), _mm_set_ps1(32.0f)), ptx)), _mm_set1_epi32(3)), _mm_mullo_epi32(_mm_set1_epi32(stride), _mm_cvtps_epi32(_mm_add_ps(_mm_min_ps(_mm_max_ps(_mm_add_ps(_mm_mul_ps(xs, sin_theta), _mm_mul_ps(ys, cos_theta)), _mm_set_ps1(-32.0f)), _mm_set_ps1(32.0f)), pty))));
komrad36 commented 6 years ago

It seems there's still an illegal instruction. The model of processor you mentioned supports AVX, but is it possible you have a slightly different process? You can try -msse4 instead of -mavx. If that doesn't help, please try creating some simple test programs with SSE/AVX instructions, and see if you can find out which instruction is causing the problem. You can also query your CPUID to see what the hardware really supports.