goldsteinn / SIMD-sorting-network

SIMD sorting network generator and very basic tester
GNU Lesser General Public License v2.1
16 stars 1 forks source link

Add License #1

Closed william-silversmith closed 2 years ago

william-silversmith commented 2 years ago

Hi,

I recently improved my code by using a sorting network for 8 elements, but it used a fixed algorithm (Bose-Nelson) and I'm not sure it's the best. Would it be possible to add a license to your code? Any free (LGPL, GPL) or open source (MIT, BSD, Apache, etc) software license is suitable for my (academic lab) needs. Otherwise, even if it's faster I cannot use it. :(

Thanks for doing such interesting work!

goldsteinn commented 2 years ago

@william-silversmith added LGPL licence, do you need all the files to have a license appended / the generated code or is just the repo licence okay?

Also for 8 elements you are best off with bitonic network. If you're using the python script you can do:

$> python3 export.py --alogirthm best # any additional flags

And it will choose the estimated to be best version for whatever params you pass. But in general if the number of elements is a power of 2 bitonic will get both the optimal depth and has the least lane-cross instructions.

william-silversmith commented 2 years ago

Thank you! I'll give it a spin!

goldsteinn commented 2 years ago

@william-silversmith out of curiosity did you ever use this?

william-silversmith commented 2 years ago

I believe I did give it a spin but it ended up being unsuitable for my use case for some reason. I think the original code I tried was faster OR there was some issue with different architectures. Sorry my memory is hazy, this was a few months ago. If you're interested, the code is here: https://github.com/seung-lab/zmesh/blob/master/zi_lib/zi/mesh/marching_cubes.hpp#L290-L291

I think Google recently came out with a hybrid SIMD quicksort that you might be interested in comparing and critiquing. I haven't tried it out though.

https://opensource.googleblog.com/2022/06/Vectorized%20and%20performance%20portable%20Quicksort.html?m=1