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

Header-only sort example #2295

Open
jwp3 opened this issue Aug 8, 2024 · 3 comments
Open

Header-only sort example #2295

jwp3 opened this issue Aug 8, 2024 · 3 comments

Comments

@jwp3
Copy link

jwp3 commented Aug 8, 2024

I believe the current best example of the sort usage is in bench_sort.cc. But what if I want to integrate the VQSort() function into an existing code? What would be the most effortless way to do this, e.g., with a header only approach (as in the vectorized sorting library by Bramas)?

@jan-wassenberg
Copy link
Member

Hi, bench_sort and sort_test go through an extra Run() function, but yes, it boils down to a call to VQSort().

Highway is not quite header-only (#2114), hence some build system integration is required. If you are using CMake or Blaze, you can search CMakeLists.txt or BUILD for "examples/", which shows how to link against Highway. Note that contrib/sort has its own BUILD, whereas for CMake it is still handled by the main CMakeLists.txt.

Hope this helps :)

@jwp3
Copy link
Author

jwp3 commented Aug 9, 2024

Thanks for the help. I'm actually using standard make. I've tried building Highway using make install and then, in my code, linking Highway as -L/path/to/highway/lib64 --lhwy_contrib. However, this is probably not correct since I still get undefined reference compilation errors.

(Sorry, I'm still a bit of an amateur when it comes to this stuff)

@jan-wassenberg
Copy link
Member

:) I think you'll also have to link against hwy itself, not just hwy_contrib. What are the undefined references?

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