Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error for fastApproxMatch() #1

Closed
dgtlmoon opened this issue Nov 21, 2016 · 1 comment
Closed

Build error for fastApproxMatch() #1

dgtlmoon opened this issue Nov 21, 2016 · 1 comment

Comments

@dgtlmoon
Copy link

Build error trying to use fastApproxMatch

diff --git a/main.cpp b/main.cpp
index 8e80285..b917772 100644
--- a/main.cpp
+++ b/main.cpp
@@ -85,13 +85,14 @@ int main() {
        Matcher<false> m(tvecs, size, qvecs, size, threshold, max_twiddles);
 
        std::cout << std::endl << "Warming up..." << std::endl;
-       for (int i = 0; i < warmups; ++i) m.bruteMatch();
+       for (int i = 0; i < warmups; ++i) m.fastApproxMatch();^M
        std::cout << "Testing..." << std::endl;
        high_resolution_clock::time_point start = high_resolution_clock::now();
-       for (int i = 0; i < runs; ++i) m.bruteMatch();
+       for (int i = 0; i < runs; ++i) m.fastApproxMatch();^M
        high_resolution_clock::time_point end = high_resolution_clock::now();
 
        const double sec = static_cast<double>(duration_cast<nanoseconds>(end - start).count()) * 1e-9 / static_cast<double>(runs);
        std::cout << std::endl << "Brute force K2NN found " << m.matches.size() << " matches in " << sec * 1e3 << " ms" << std::endl;
        std::cout << "Throughput: " << static_cast<double>(size)*static_cast<double>(size) / sec * 1e-9 << " billion comparisons/second." << std::endl << std::endl;
+^M
 }

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
In file included from main.cpp:53:0:
K2NN.h: In instantiation of ‘void Matcher<eightbit>::_tabulate(int, int) [with bool eightbit = false]’:
K2NN.h:184:44:   required from ‘void Matcher<eightbit>::tabulate() [with bool eightbit = false]’
K2NN.h:378:11:   required from ‘void Matcher<eightbit>::fastApproxMatch() [with bool eightbit = false]’
main.cpp:88:54:   required from here
K2NN.h:191:30: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   for (uint64_t i = start; i < start + count; ++i) {
                              ^
cc1plus: all warnings being treated as errors
Makefile:17: recipe for target 'main.o' failed
make: *** [main.o] Error 1

@dgtlmoon dgtlmoon changed the title Buidl er Build error for fastApproxMatch() Nov 21, 2016
@komrad36
Copy link
Owner

Fixed. Thanks! Nice catch!

Reason: I develop on Windows and MSVC doesn't warn on unsigned/signed compare unless it's obviously dangerous. The default case (bruteMatch) doesn't exhibit the problem so my automated g++ test passes. Perfect storm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants