准备工作
- sse2neon.h,获取位置
https://github.com/DLTcollab/sse2neon - hisat2-2.2.1,获取位置
https://cloud.biohpc.swmed.edu/index.php/s/fE9QCsX3NH4QwBi/download
源码修改
执行下列命令
unzip hisat2-2.2.1-source.zip
unzip sse2neon.zip
cp sse2neon-1.5.0/sse2neon.h hisat2-2.2.1
cd hisat2-2.2.1/
修改Makefile
- 修改前:
BITS=32
ifeq (x86_64,$(shell uname -m))
BITS=64
endif
修改后:
BITS=32
ifeq (x86_64,$(shell uname -m))
BITS=64
endif
ifeq (aarch64,$(shell uname -m))
BITS=64
endif
- 修改前:
ifeq (32,$(BITS))
BITS_FLAG = -m32
endif
ifeq (64,$(BITS))
BITS_FLAG = -m64
endif
SSE_FLAG=-msse2
修改后:
ifeq (32,$(BITS))
BITS_FLAG = -m32
endif
ifeq (64,$(BITS))
BITS_FLAG = -m64
endif
SSE_FLAG=-msse2
ifeq(aarch64,$(shell uname -m))
BITS_FLAG =
SSE_FLAG =
endif
- 修改前:
EXTRA_FLAGS += -DPOPCNT_CAPABILITY -std=c++11
修改后:
EXTRA_FLAGS += -std=c++11
- 修改前:
DEBUG_FLAGS = -O0 -g3 $(BITS_FLAG) $(SSE_FLAG)
DEBUG_DEFS = -DCOMPILER_OPTIONS="\"$(DEBUG_FLAGS) $(EXTRA_FLAGS)\""
RELEASE_FLAGS = -O3 $(BITS_FLAG) $(SSE_FLAG) -funroll-loops -g3
RELEASE_DEFS = -DCOMPILER_OPTIONS="\"$(RELEASE_FLAGS) $(EXTRA_FLAGS)\""
NOASSERT_FLAGS = -DNDEBUG
FILE_FLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
修改后:
DEBUG_FLAGS = -O0 -g3 $(BITS_FLAG) $(SSE_FLAG) -funrool-loops -fsigned-char
DEBUG_DEFS = -DCOMPILER_OPTIONS="\"$(DEBUG_FLAGS) $(EXTRA_FLAGS)\""
RELEASE_FLAGS = -O3 $(BITS_FLAG) $(SSE_FLAG) -funroll-loops -g3 -Xlinker --allow-multiple-definition -fsigned-char
RELEASE_DEFS = -DCOMPILER_OPTIONS="\"$(RELEASE_FLAGS) $(EXTRA_FLAGS)\""
NOASSERT_FLAGS = -DNDEBUG
FILE_FLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
修改源代码
- 修改aligner_sw.h
修改前:
#include <emmintrin.h>
修改后:
#include "sse2neon.h"
- 修改sse_util.h
修改前:
#include <emmintrin.h>
修改后:
#include "sse2neon.h"
编译
执行以下命令
make
注意事项
- 由于arm下没有cpuid.h,所以EXTRA_FLAGS里的-DPOPCNT_CAPABILITY必须删除
- 由于arm架构下char默认为unsigned,而x86架构下默认为signed,而hisat2-2.2.1里使用了signed char,因此需要加上-fsigned-char