sodium-g / knn_finder

a brute force k-nearest neighbour search program for nVidia GPUs
MIT License
2 stars 3 forks source link

which version of msgpack should i install to use your code #3

Open itabhiyanta opened 7 years ago

itabhiyanta commented 7 years ago

hi

i get compilation errors due to msgpack. I installed the C/C++ version of msgpack but that gives even more errors. Kindly indicate which version of msgpack is expected to be installed for using your code.

with kind regards

sodium-g commented 7 years ago

Hi,

I am currently developing knn_finder on an Ubuntu environment and using the msgpack related libraries which Ubuntu offers as its packages. I do not remember the precise package names and versions I installed when I set up the environment, but I can see some libraries highly likely to be involved:

$ cat /etc/issue
Ubuntu 16.04.2 LTS \n \l

$ dpkg -l | grep msgpack
ii  libmsgpack-dev                         0.5.7-3ubuntu1                             amd64        binary-based efficient object serialization library
ii  libmsgpack3                            0.5.7-3ubuntu1                             amd64        binary-based efficient object serialization library
ii  libmsgpackc2                           0.5.7-3ubuntu1                             amd64        binary-based efficient object serialization library

Does this help?

itabhiyanta commented 7 years ago

I also seem to have the same libraries installed but my errors seem to be all originating from libmsgpack

rohit@rohit-desktop-work:~/Documents/bruteforceNN/knn_finder$ dpkg -l | grep msgpack
ii  libmsgpack-dev                             0.5.7-3ubuntu1                                amd64        binary-based efficient object serialization library
ii  libmsgpack3                                0.5.7-3ubuntu1                                amd64        binary-based efficient object serialization library
ii  libmsgpackc2                               0.5.7-3ubuntu1                                amd64        binary-based efficient object serialization library

The errors

mp_handler.cpp: In function ‘int knn_finder::read_mp(const char*, bool, float**, int*, int*)’:
mp_handler.cpp:26:54: error: invalid user-defined conversion from ‘msgpack::v1::unpacked* {aka msgpack::v1::object_handle*}’ to ‘msgpack::v1::zone&’ [-fpermissive]
    msgpack::unpack(&msg, &buf[0], buf.size(), &offset);
                                                      ^
In file included from /usr/local/include/msgpack/v1/zone.hpp:16:0,
                 from /usr/local/include/msgpack/zone.hpp:15,
                 from /usr/local/include/msgpack/v1/object_decl.hpp:15,
                 from /usr/local/include/msgpack/object_decl.hpp:14,
                 from /usr/local/include/msgpack/object.hpp:13,
                 from /usr/local/include/msgpack.hpp:10,
                 from mp_handler.cpp:4:
/usr/local/include/msgpack/v1/detail/cpp03_zone.hpp:232:8: note: candidate is: msgpack::v1::zone::zone(size_t) <near match>
 inline zone::zone(size_t chunk_size) /* throw() */ :m_chunk_size(chunk_size), m_chunk_list(m_chunk_size)
        ^
/usr/local/include/msgpack/v1/detail/cpp03_zone.hpp:232:8: note:   conversion of argument 1 would be ill-formed:
mp_handler.cpp:26:54: error: invalid conversion from ‘msgpack::v1::unpacked* {aka msgpack::v1::object_handle*}’ to ‘size_t {aka long unsigned int}’ [-fpermissive]
    msgpack::unpack(&msg, &buf[0], buf.size(), &offset);
                                                      ^
mp_handler.cpp:26:54: error: invalid conversion from ‘msgpack::v1::unpacked* {aka msgpack::v1::object_handle*}’ to ‘size_t {aka long unsigned int}’ [-fpermissive]
In file included from /usr/local/include/msgpack/v1/zone.hpp:16:0,
                 from /usr/local/include/msgpack/zone.hpp:15,
                 from /usr/local/include/msgpack/v1/object_decl.hpp:15,
                 from /usr/local/include/msgpack/object_decl.hpp:14,
                 from /usr/local/include/msgpack/object.hpp:13,
                 from /usr/local/include/msgpack.hpp:10,
                 from mp_handler.cpp:4:
/usr/local/include/msgpack/v1/detail/cpp03_zone.hpp:232:8: note:   initializing argument 1 of ‘msgpack::v1::zone::zone(size_t)’
 inline zone::zone(size_t chunk_size) /* throw() */ :m_chunk_size(chunk_size), m_chunk_list(m_chunk_size)
        ^
mp_handler.cpp:26:54: error: conversion to non-const reference type ‘class msgpack::v1::zone&’ from rvalue of type ‘msgpack::v1::zone’ [-fpermissive]
    msgpack::unpack(&msg, &buf[0], buf.size(), &offset);
                                                      ^
In file included from /usr/local/include/msgpack/unpack.hpp:16:0,
                 from /usr/local/include/msgpack.hpp:14,
                 from mp_handler.cpp:4:
/usr/local/include/msgpack/v2/unpack.hpp:285:24: note:   initializing argument 1 of ‘msgpack::v2::object msgpack::v2::unpack(msgpack::v1::zone&, const char*, std::size_t, std::size_t&, msgpack::v1::unpack_reference_func, void*, const msgpack::v1::unpack_limit&)’
 inline msgpack::object unpack(
                        ^
mp_handler.cpp:26:54: error: invalid conversion from ‘std::size_t* {aka long unsigned int*}’ to ‘std::size_t {aka long unsigned int}’ [-fpermissive]
    msgpack::unpack(&msg, &buf[0], buf.size(), &offset);
                                                      ^
In file included from /usr/local/include/msgpack/unpack.hpp:16:0,
                 from /usr/local/include/msgpack.hpp:14,
                 from mp_handler.cpp:4:
/usr/local/include/msgpack/v2/unpack.hpp:285:24: note:   initializing argument 4 of ‘msgpack::v2::object msgpack::v2::unpack(msgpack::v1::zone&, const char*, std::size_t, std::size_t&, msgpack::v1::unpack_reference_func, void*, const msgpack::v1::unpack_limit&)’
 inline msgpack::object unpack(
                        ^
mp_handler.cpp:26:54: error: cannot bind rvalue ‘(std::size_t)(& offset)’ to ‘std::size_t& {aka long unsigned int&}’
    msgpack::unpack(&msg, &buf[0], buf.size(), &offset);
                                                      ^
mp_handler.cpp:29:23: error: invalid initialization of non-const reference of type ‘knn_finder::item_record*&’ from an rvalue of type ‘knn_finder::item_record*’
    obj.convert(&record);
                       ^
In file included from /usr/local/include/msgpack/object_fwd.hpp:17:0,
                 from /usr/local/include/msgpack/v1/adaptor/adaptor_base_decl.hpp:14,
                 from /usr/local/include/msgpack/adaptor/adaptor_base_decl.hpp:13,
                 from /usr/local/include/msgpack/adaptor/adaptor_base.hpp:13,
                 from /usr/local/include/msgpack/v1/object_decl.hpp:16,
                 from /usr/local/include/msgpack/object_decl.hpp:14,
                 from /usr/local/include/msgpack/object.hpp:13,
                 from /usr/local/include/msgpack.hpp:10,
                 from mp_handler.cpp:4:
/usr/local/include/msgpack/v2/object_fwd.hpp:60:8: note:   initializing argument 1 of ‘T& msgpack::v2::object::convert(T&) const [with T = knn_finder::item_record*]’
     T& convert(T& v) const { return v1::object::convert(v); }
        ^
Makefile:32: recipe for target 'build/mp_handler.o' failed
make: *** [build/mp_handler.o] Error 1
sodium-g commented 7 years ago

In my environment, there is no header file in /usr/local/include, which, as a consequence, does not contain msgpack.hpp your compiler tried to include. On the other hand, I have msgpack.hpp under /usr/include, which is installed by apt-get, and that is looked up by the compiler. I suppose that msgpack.hpp in /usr/local/include caused the problem, so could you adjust the inclusion order by specifying -I or something to make the compiler include one in /usr/include? You might also need to adjust library search order to make the linker reference libraries in /usr/lib, not ones in /usr/local/lib.

itabhiyanta commented 7 years ago

I purged all msgpack from my system and reinstalled afresh. Now the code compiles and I also modified it to take in my space separated file as input and it seems to run fine. thanks for your prompt help. I am trying to calculate 63 nieghbors for 2M 3d points.

wish you best of luck rohit

sodium-g commented 7 years ago

Great to hear that it worked fine! knn_finder is not necessarily good at calculating neighbours of low dimensional vectors in terms of computational speed, but I hope it helps you to solve your problem.