DecodeGenetics / graphtyper

Population-scale genotyping using pangenome graphs
http://dx.doi.org/10.1038/ng.3964
MIT License
167 stars 20 forks source link

[Question] Is ARM64 a supported architecture? #110

Closed markjens closed 1 year ago

markjens commented 2 years ago

Hello,

I’d like to ask whether graphtyper is supported on Linux/Mac ARM64 systems ? Any concerns ? Any positive/negative experience ?

Thank you!

julien-faye commented 2 years ago

I am also interested in this topic!

Unfortunately the build fails on Ubuntu 20.04 aarch64:

...
checking for working mmap... -- Generating done
-- Build files have been written to: /home/ubuntu/git/graphtyper/release-build/paw
[ 12%] Generating src/align_simdpp_-x86_avx512bw-x86_avx512dq-x86_avx512f-x86_avx512vl-x86_popcnt.cpp
[ 12%] Generating src/align_simdpp_-x86_sse2.cpp
[ 18%] Generating src/align_simdpp_-null.cpp
[ 25%] Generating src/align_simdpp_-x86_sse4_1.cpp
[ 31%] Generating src/align_simdpp_-x86_popcnt-x86_sse4_1.cpp
[ 37%] Generating src/align_simdpp_-x86_avx-x86_popcnt.cpp
[ 43%] Generating src/align_simdpp_-x86_avx2-x86_popcnt.cpp
yes
checking for gmtime_r... Scanning dependencies of target static
yes
checking for fsync... yes
checking for drand48... [ 50%] Building CXX object CMakeFiles/static.dir/src/paw.cpp.o
[ 56%] Building CXX object CMakeFiles/static.dir/src/align_simdpp_-null.cpp.o
[ 62%] Building CXX object CMakeFiles/static.dir/src/align_simdpp_-x86_sse2.cpp.o
c++: error: unrecognized command line option ‘-m64’
make[7]: *** [CMakeFiles/static.dir/build.make:91: CMakeFiles/static.dir/src/paw.cpp.o] Error 1
make[7]: *** Waiting for unfinished jobs....
c++: error: unrecognized command line option ‘-m64’
c++: error: unrecognized command line option ‘-m64’
c++: error: unrecognized command line option ‘-msse2’
make[7]: *** [CMakeFiles/static.dir/build.make:104: CMakeFiles/static.dir/src/align_simdpp_-null.cpp.o] Error 1
make[7]: *** [CMakeFiles/static.dir/build.make:117: CMakeFiles/static.dir/src/align_simdpp_-x86_sse2.cpp.o] Error 1
make[6]: *** [CMakeFiles/Makefile2:265: CMakeFiles/static.dir/all] Error 2
make[5]: *** [CMakeFiles/Makefile2:272: CMakeFiles/static.dir/rule] Error 2
make[4]: *** [Makefile:188: static] Error 2
make[3]: *** [CMakeFiles/project_paw.dir/build.make:113: paw/src/project_paw-stamp/project_paw-build] Error 2
make[2]: *** [CMakeFiles/Makefile2:186: CMakeFiles/project_paw.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
yes
...

It is x86_64 specific at the moment. On ARM64 it should use Neon instead of SSE/SSE2.

martin-g commented 2 years ago

The problem above is in paw library. I've just sent a PR to fix its build on Linux ARM64 - https://github.com/hannespetur/paw/pull/16

martin-g commented 2 years ago

Now graphtyper should be changed in the following way to be able to build the paw submodule:

diff --git CMakeLists.txt CMakeLists.txt
index cb54933..0627f18 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -148,7 +148,7 @@ ExternalProject_Add(
     BUILD_IN_SOURCE 0
     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/paw
     CONFIGURE_COMMAND ""
-    BUILD_COMMAND ${CMAKE_COMMAND} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -H${CMAKE_CURRENT_SOURCE_DIR}/paw -B${CMAKE_CURRENT_BINARY_DIR}/paw -DFORCE_AVX512=1
+    BUILD_COMMAND ${CMAKE_COMMAND} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -H${CMAKE_CURRENT_SOURCE_DIR}/paw -B${CMAKE_CURRENT_BINARY_DIR}/paw 
         COMMAND $(MAKE) -C ${CMAKE_CURRENT_BINARY_DIR}/paw static
     INSTALL_COMMAND ""

i.e. it should not force AVX!

Now the next problem is:

[ 30%] Building CXX object src/CMakeFiles/graphtyper_objects.dir/graph/alt.cpp.o
[ 30%] Building CXX object src/CMakeFiles/graphtyper_objects.dir/graph/absolute_position.cpp.o
[ 32%] Building CXX object src/CMakeFiles/graphtyper_objects.dir/graph/constructor.cpp.o
[ 33%] Building CXX object src/CMakeFiles/graphtyper_objects.dir/graph/genomic_region.cpp.o
In file included from /home/mgrigorov/git/graphtyper/graphtyper/parallel-hashmap/parallel_hashmap/phmap_bits.h:51:0,
                 from /home/mgrigorov/git/graphtyper/graphtyper/parallel-hashmap/parallel_hashmap/phmap_utils.h:34,
                 from /home/mgrigorov/git/graphtyper/graphtyper/parallel-hashmap/parallel_hashmap/phmap.h:68,
                 from /home/mgrigorov/git/graphtyper/graphtyper/include/graphtyper/graph/haplotype.hpp:9,
                 from /home/mgrigorov/git/graphtyper/graphtyper/include/graphtyper/graph/graph.hpp:13,
                 from /home/mgrigorov/git/graphtyper/graphtyper/src/graph/absolute_position.cpp:8:
/home/mgrigorov/git/graphtyper/graphtyper/parallel-hashmap/parallel_hashmap/phmap.h: In function ‘size_t phmap::container_internal::CapacityToGrowth(size_t)’:
/home/mgrigorov/git/graphtyper/graphtyper/parallel-hashmap/parallel_hashmap/phmap.h:499:5: error: ‘capacity’ is not a constant expression
     PHMAP_IF_CONSTEXPR (Group::kWidth == 8 && capacity == 7) {
     ^

I'm investigating what is the reason!

martin-g commented 2 years ago

The last issue is fixed upstream with https://github.com/greg7mdp/parallel-hashmap/issues/42 almost three years ago. It is time to update the submodule!

martin-g commented 1 year ago

This issue could be closed now!

hannespetur commented 1 year ago

ARM64 support added by @martin-g in #114 and #120