-
Notifications
You must be signed in to change notification settings - Fork 130
Add 64 bit support to FastPFor #58
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
Conversation
- codecs.cpp and inmemorybenchmark.cpp already contain non-LGPL inline version of getopt - fixed warning (trailing semicolon in pragma statement in inline getopt code) - define NOMINMAX to make sure that windows.h doesn't define min/max
…ing.cpp and simdunalignedbitpacking.cpp
- enable AVX in msvc builds to enable ssse4 and sse4.1 - modify __SSSE3__/__SSE4_1__ checks and warnings pragmas to support msvc builds
1. Add a new template parameter for FastPFor encoder to specify the integer type. Curently uint32_t and uint64_t are supported. 2. Add corresponding bit packing and unpacking functions for 64-bit integers. 3. Overload IntegerCODEC interfaces to provide 64bit version of encodeArray() and decodeArray(). For codes that don't support 64bit, those would just throw not implemented exception. 4. Add 64-bit support for CompositeCodec and VariableByte, so the encoding and decoding can work end to end with arbitary number of integers. 5. Add gtest to the CMake project and create unittests for the new 64 bit support. 6. Replace some of the assertions into exceptions.
1. Add a new template parameter for FastPFor encoder to specify the integer type. Curently uint32_t and uint64_t are supported. 2. Add corresponding bit packing and unpacking functions for 64-bit integers. 3. Overload IntegerCODEC interfaces to provide 64bit version of encodeArray() and decodeArray(). For codes that don't support 64bit, those would just throw not implemented exception. 4. Add 64-bit support for CompositeCodec and VariableByte, so the encoding and decoding can work end to end with arbitary number of integers. 5. Add gtest to the CMake project and create unittests for the new 64 bit support. 6. Replace some of the assertions into exceptions. 7. Fix issues with Windows build according to feedback from @pps83
|
@pps83 Would you check this PR? |
|
It's weird that the commit looks normal in my forked repo, but after opening a pull request, it includes some previous commits which shouldn't be there. Any idea? @lemire @pps83 $ git show --pretty="" --name-only 38c332e |
|
You mean that there are commits that you do not see there... |
|
No, I mean in this particular PR, if you look at the diff, there are not just the 64bit support changes I add, but also includes previous changes from you and @pps83 |
|
Now the Windows build has passed. Can somebody help test it out? Thanks. |
I see it now. It is weird. |
|
Ping @pps83 ... can you provide feedback? |
|
@xndai I tested with https://github.com/xndai/FastPFor/tree/fastpfor64_support
some fail hard errors: and some fail with exceptions thrown: etc. |
|
Also, note I did not look through the code/changes at all this time, but when |
|
Important: tests should be deterministic. You do not want randomness. (Pseudo-randomness with a fixed seed is fine, as long as you keep the random generator the same on all platforms.) |
1. Add back test driver cpp file, and link to gtest instaed of gtest_main 2. Add logging for the input array when test fails 3. Remove unnecessary srand() calls.
|
Pinging @pps83 |
|
@pps83 I've updated the PR. Please take a look. Some answers to your comments -
|
|
Also I tested on MacOs (clang) and Linux (gcc). All test passed. |
|
@xndai It would be best to test using only fixed seeds? Testing with a randomly generated seed is a usability issue. You may be logging the failing tests in a way that you can reproduce the issue (yet is the output of "rd()" really logged?)... but we want everyone to be able to run the tests and identify the issues. With random seeds, other people are likely to suffer. And it super easy to test with a fixed seed. E.g., it suffices to replace "std::mt19937_64 e2(rd());" with "std::mt19937_64 e2(12345);". There is really no benefit to genuinely random testing... unless maybe if you are fuzzing and even then... |
|
@pps83 if possible, can you step in decodeArray() and see how "thissize" is calculated? Also can we add one more step in our Windows gating build to run FastPFor_unittest? I want to make sure we are able to repro this in an official build environment. I also plan to borrow a Windows machine for debugging. Did you use "cmake ." and "make" command to produce the windows binaries? |
|
We are getting further but there are still issues. Can you have a look at the appveyor logs and see what can be done? |
|
@lemire I think right now the last blocker is at the external vector.h line 184. random_shuffle() is deprecated by c++ 17. But using shuffle() with a random device instead would trigger compiler error somewhere in the random header file. If I just comment out line 184 and 188, I can get a build pass locally on my VS2019. |
|
I tested latest |
|
I am puzzled as to why the tests do not pass on appveyor. |
|
The appveyor doesn't even get a successful build. Can we go back to the previous build settings? At least we got successful build at the beginning. |
|
C++ 17 is not fully supported Visual Studio 2017. That seems to be the problem. We are flipping what is effectively an experimental flag. The solution, I think, is to simply not rely on C++17. C++14 is fully supported. Why must we require C++17? That seems like an orthogonal issue to the object of your PR. Is there any reason why C++14 is not enough? Is there any chance you might simply revert to C++14?
You mean appveyor? If you have a proposal for new appveyor settings, settings that build and run tests, please share them. Here are the current settings... https://github.com/lemire/FastPFor/blob/master/appveyor.yml Note that the tests run fine with master... Merging without CI tests is not a good idea, I am sure you will agree. |
There is no need for any C++XX configs. Just remove Also, you may as well change Regarding gtest: I've seen projects simply copy gtest folder and use it. Much simpler that way, also you'll be able to add VS projects and it will just work in VS without doing anything extra to install gtest. |
|
Great catch! I don't think these defines come from this PR. They go back to an era when they were a workaround. And they are not the primary reason for the failure here since they are in master, and master pass our tests on appveyor. But it could be the final/ultimate cause of our current disaster. @xndai Still... do you want to try to remove the C++17 flags while removing the defines as suggested by @pps83. And see where it takes us... I am hopeful that it should help. To be clear... @xndai is not the one who wrote these defines... but he may be the first one impacted by them. |
|
I have created a distinct PR |
|
Let us see if the new PR passes our tests. If it does it might help here as well. |
|
@pps83 Trying to require C++11 support. Hopefully this will get Visual Studio to accept constexpr. |
|
That seems to have done the trick. I am letting the tests run, and then I will merge this other PR. It may help with the current one. I still think we should not need C++17. |
|
Relaunching the tests. We no longer redefine constexpr. |
|
Ah. The tests are running... the build was a success. |
|
Wonderful. Are you able to add FastPFor_unittest as part of the post build testing? |
|
You modified the CMake build so that it includes Let us wait for the tests to finish on appveyor. |
|
Everything is green. I'll merge and see about reverting the C++17 flag. |
|
I use vs2017, I think vs2017 by default enables c++11, so in my case without setting any c++XX version everything builds and runs as expected. Perhaps for vs2015 c++11 needs to be enabled, no need to require c++17 |
|
We require C++11 as part of the CMake build, which should translate into the proper requirements and flags for Visual Studio when build via CMake. |
|
Awesome! Thanks everyone's help on this. |




(try to reopen the PR and fix the Windows build issue. The commit history seems to be messed up. I am not sure why...)
Add support for 64-bit integers for FastPFor