torognes / swarm

A robust and fast clustering method for amplicon-based studies
GNU Affero General Public License v3.0
123 stars 23 forks source link

Port Swarm to other platforms #107

Closed torognes closed 5 years ago

torognes commented 7 years ago

Perhaps we should port Swarm to Linux on POWER8 and Windows on x86_64 as we have done for vsearch?

frederic-mahe commented 5 years ago

or ARM64, as it seems to be the future for consumer electronics.

torognes commented 5 years ago

I have rewritten the assembly code in search8.cc and search16.cc to x86_64 intrinsics and simplified it. (Not pushed to Github yet.) It should now be easy to port it to ARM64 and POWER8. It will also make it easier to rewrite the code to use AVX2 with 256-bit wide registers as discussed for issue #12.

torognes commented 5 years ago

The changes with intrinsics have been pushed already. The zobrist branch is renamed to swarm3.

torognes commented 5 years ago

Swarm 3 now seems to work as it should on ARMv8. The sixteen channel 8-bit search is slower than the 16-bit search though, so it is not used.

torognes commented 5 years ago

Added support for POWER8 CPUs. Not very fast though, compared to x86_64 and ARMv8.

torognes commented 5 years ago

Ported to Windows as well.

It now runs on Linux (x86_64, arm & power8), Mac (x86_64) and Windows (x86_64).

Considered done.

frederic-mahe commented 5 years ago

Hi Torbjørn,

I finally set out to test compilation on my ARM system (Raspberry pi 3+), but it fails:

git clone https://github.com/torognes/swarm.git
cd ./swarm/
git checkout origin/swarm3 
make
make -C src swarm
make[1]: Entering directory '/home/pi/swarm/src'
g++  -g -flto -O3 -march=armv8-a+simd -mtune=generic -flax-vector-conversions -std=c++11 -Wall -Wsign-compare -Wextra -Wno-long-long -pedantic -Icityhash   -c -o swarm.o swarm.cc
In file included from swarm.cc:24:0:
swarm.h:34:18: fatal error: city.h: No such file or directory
 #include <city.h>
                  ^
compilation terminated.
<builtin>: recipe for target 'swarm.o' failed
make[1]: *** [swarm.o] Error 1
make[1]: Leaving directory '/home/pi/swarm/src'
Makefile:30: recipe for target 'bin/swarm' failed
make: *** [bin/swarm] Error 2

which is weird since city.h is present in the ./src/ directory (along with citycrc.h).

torognes commented 5 years ago

It should probably be #include "city.h" instead of #include <city.h> in swarm.h. Will fix tomorrow.

torognes commented 5 years ago

A few more files needed a modification to properly include the city.h file. Should be fixed now in commit e31646244a3339eddb67577974cdffc3310832b5.

frederic-mahe commented 5 years ago

Perfect, compilation is now possible on my Raspberry. There are about 15 unit-tests failing, I will investigate to try to understand why.

frederic-mahe commented 4 years ago

swarm 3 passes all tests on a Raspberry running Linux.