From d1ebd708c4d71510ae793174f310b83f405e55d7 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Thu, 25 Jun 2020 16:40:41 +0200 Subject: [PATCH 1/4] enable building on non-x86 systems --- .gitmodules | 5 ++++- Makefile | 5 +++-- README.md | 2 +- deps/fermi-lite | 2 +- deps/ssw | 2 +- src/crash.cpp | 2 +- src/preflight.cpp | 22 ---------------------- src/preflight.hpp | 9 +-------- src/simde | 1 + 9 files changed, 13 insertions(+), 37 deletions(-) create mode 160000 src/simde diff --git a/.gitmodules b/.gitmodules index 94952bf4c06..0ba1eb37a35 100644 --- a/.gitmodules +++ b/.gitmodules @@ -54,7 +54,7 @@ url = https://github.com/benedictpaten/sonLib.git [submodule "deps/fermi-lite"] path = deps/fermi-lite - url = https://github.com/edawson/fermi-lite.git + url = https://github.com/mr-c/fermi-lite.git [submodule "deps/gbwt"] path = deps/gbwt url = https://github.com/jltsiren/gbwt.git @@ -116,6 +116,9 @@ [submodule "vgteam_bbhash"] path = deps/BBHash url = https://github.com/vgteam/BBHash.git +[submodule "src/simde"] + path = src/simde + url = https://github.com/nemequ/simde-no-tests [submodule "doc/wiki"] path = doc/wiki url = https://github.com/vgteam/vg.wiki.git diff --git a/Makefile b/Makefile index 507a7de1901..d728f6004ce 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,8 @@ CWD:=$(shell pwd) CXX ?= g++ PKG_CONFIG ?= pkg-config -EXE:=vg +SFX := +EXE:=vg$(SFX) all: $(BIN_DIR)/$(EXE) @@ -182,7 +183,7 @@ else CXXFLAGS += -fopenmp # We care about building for SSE4.2 only and not AVX, to have vaguely portable binaries - CXXFLAGS += -msse4.2 + # CXXFLAGS += -msse4.2 # Note shared libraries are so files SHARED_SUFFIX = so diff --git a/README.md b/README.md index 27aeb871ff8..354247991ba 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ At present, you will need GCC version 4.9 or greater, with support for C++14, to Other libraries may be required. Please report any build difficulties. -Note that a 64-bit OS is required. Ubuntu 18.04 should work. You will also need a CPU that supports SSE 4.2 to run VG; you can check this with `cat /proc/cpuinfo | grep sse4_2`. +Note that a 64-bit OS is required. Ubuntu 18.04 should work. When you are ready, build with `. ./source_me.sh && make`, and run with `./bin/vg`. diff --git a/deps/fermi-lite b/deps/fermi-lite index cde7871d5a6..e5603862255 160000 --- a/deps/fermi-lite +++ b/deps/fermi-lite @@ -1 +1 @@ -Subproject commit cde7871d5a6658be61a7c3995a56ac21fbacf4f4 +Subproject commit e56038622555349707c5cd90c062f0cf3f370b11 diff --git a/deps/ssw b/deps/ssw index d27667cbb93..f53d459841b 160000 --- a/deps/ssw +++ b/deps/ssw @@ -1 +1 @@ -Subproject commit d27667cbb93bab73de3c31bf0a265fd8e8632e72 +Subproject commit f53d459841b632ac6ab0e59e1a0ef6d056034631 diff --git a/src/crash.cpp b/src/crash.cpp index 0ac22c582db..b4627d89584 100644 --- a/src/crash.cpp +++ b/src/crash.cpp @@ -168,7 +168,7 @@ void emit_stacktrace(int signalNumber, siginfo_t *signalInfo, void *signalContex *out << "Caught signal " << signalNumber << " raised at address " << ip << endl; // Do our own tracing because backtrace doesn't really work on all platforms. stacktrace_manually(*out, signalNumber, ip, bp); - #else + #elif __x86_64__ // Linux 64 bit does it this way ip = (void*)context->uc_mcontext.gregs[REG_RIP]; bp = (void**)context->uc_mcontext.gregs[REG_RBP]; diff --git a/src/preflight.cpp b/src/preflight.cpp index 94c5e6ab8a9..6c97db57103 100644 --- a/src/preflight.cpp +++ b/src/preflight.cpp @@ -1,33 +1,11 @@ #include "preflight.hpp" -#include -#include -#include - namespace vg { using namespace std; void preflight_check() { - // We assume we are on x86_64 on POSIX (and not Windows). - // We use the method of dlib's dlib/simd/simd_check.h - - // Define a place to put the cpuid info - unsigned int cpuid_info[4]; - - // Call cpuid function 1 (which reports SSE4.2, and other stuff up to original AVX) - __cpuid(1, cpuid_info[0], cpuid_info[1], cpuid_info[2], cpuid_info[3]); - - // Bit 20 of result 2 is the SSE 4.2 flag. - bool have_sse4_2 = cpuid_info[2] & (1 << 20); - - if (!have_sse4_2) { - cerr << "error[vg::preflight_check]: The CPU does not support SSE4.2 instructions. VG cannot run here. " - << "Please use a system with SSE4.2 support." << endl; - exit(1); - } - } } diff --git a/src/preflight.hpp b/src/preflight.hpp index b8cb3dda1c5..45a5f495c03 100644 --- a/src/preflight.hpp +++ b/src/preflight.hpp @@ -11,14 +11,7 @@ namespace vg { -/// Define a macro to tell things to be built for every architecture, if possible. -/// This *doesn't* work on Mac with GNU GCC and Apple libc++, because functions -/// for x86-64 can't use std::endl, so we exclude that combination. -#if (!defined(__GNUC__) || !defined(_LIBCPP_VERSION) || !defined(__APPLE__)) - #define VG_PREFLIGHT_EVERYWHERE __attribute__((__target__("arch=x86-64"))) -#else - #define VG_PREFLIGHT_EVERYWHERE -#endif +#define VG_PREFLIGHT_EVERYWHERE /// Run a preflight check to make sure that the system is usable for this build of vg. /// Aborts with a helpful message if this is not the case. diff --git a/src/simde b/src/simde new file mode 160000 index 00000000000..8cd136a43ba --- /dev/null +++ b/src/simde @@ -0,0 +1 @@ +Subproject commit 8cd136a43bae7ab9b82316179b9cef8887726778 From c0008d5d4620956b7a25877acbf5984232ccf666 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Thu, 25 Jun 2020 16:46:30 +0200 Subject: [PATCH 2/4] build arm64 --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 44869200f9a..622ff56e3ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: cpp compiler: gcc -sudo: required dist: bionic # We have some shenanigans to let us cache submodules, and update changed files # without messing up mtimes and triggering rebuilds unnecessarily. Travis checks @@ -112,8 +111,6 @@ os: - linux - osx osx_image: xcode12.2 -compiler: - - gcc env: global: - DOCS_KEY_ENCRYPTION_LABEL=125272388526 @@ -124,3 +121,5 @@ matrix: # We have a special entry to do the docs build - os: linux env: BUILD_DOCS_ONLY=1 + - os: linux + arch: arm64 From 85fa6f9ec546d66f1ec17b5451f4e5ec06a9d8f7 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 27 Jun 2020 12:27:59 +0200 Subject: [PATCH 3/4] issue with cached deps? --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 622ff56e3ed..8bdf19fa3b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,10 @@ before_install: - if [[ -e deps ]]; then mv deps deps_cached; fi - git submodule update --init --recursive - rsync -rv --links --checksum deps/ deps_cached/ - - rm -Rf deps + # - rm -Rf deps # Keep the cached deps if the right compiler version was used. # Otherwise start fresh - - if [[ "$TRAVIS_OS_NAME" == "linux" && -e "deps_cached/gcc$(gcc -dumpversion)" ]]; then mv deps_cached deps; fi + # - if [[ "$TRAVIS_OS_NAME" == "linux" && -e "deps_cached/gcc$(gcc -dumpversion)" ]]; then mv deps_cached deps; fi - if [[ "$TRAVIS_OS_NAME" == "osx" && -e deps_cached/clang ]]; then mv deps_cached deps; fi - (ls -lah deps/; ls -lah bin/; ls -lah lib/; ls -lah include/) || true - git submodule update --init --recursive From 50f2bc1f86b7d82ad5f15ec8b3b7ee8056a30fbc Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" <1330696+mr-c@users.noreply.github.com> Date: Thu, 28 Jan 2021 17:32:46 +0100 Subject: [PATCH 4/4] simde v0.7.2 --- src/simde | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simde b/src/simde index 8cd136a43ba..bd48f5455ac 160000 --- a/src/simde +++ b/src/simde @@ -1 +1 @@ -Subproject commit 8cd136a43bae7ab9b82316179b9cef8887726778 +Subproject commit bd48f5455acd3ec5e39e15604245a6cbd52da910