Skip to content

Commit 1e8d44c

Browse files
author
David Lecomber
committed
Add support for linux-aarch64 and osx-arm64.
With thanks to @mr-c for DaehwanKimLab/hisat2#251
1 parent d5bcd94 commit 1e8d44c

File tree

3 files changed

+178
-1
lines changed

3 files changed

+178
-1
lines changed

recipes/hisat2/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set -x
44
# The patch does not move the VERSION file on OSX. Let's make sure it's moved.
55
mv VERSION{,.txt} || true
66

7+
git clone https://github.com/simd-everywhere/simde-no-tests simde
8+
79
make -j ${CPU_COUNT} \
810
CC="${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" \
911
CPP="${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}"

recipes/hisat2/meta.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ source:
99
sha256: f3f4f867d0a6b1f880d64efc19deaa5788c62050e0a4d614ce98b3492f702599
1010
patches:
1111
- 0001-Rename-VERSION-to-VERSION.txt.patch
12-
12+
- simde-mr-c.patch
1313
build:
1414
number: 6
1515

@@ -38,6 +38,9 @@ about:
3838
dev_url: https://github.com/DaehwanKimLab/hisat2
3939

4040
extra:
41+
additional-platforms:
42+
- linux-aarch64
43+
- osx-arm64
4144
identifiers:
4245
- biotools:HISAT2
4346
- doi:10.1038/nmeth.3317

recipes/hisat2/simde-mr-c.patch

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
From 9586a591a6c5cbe9a0a178b7b9ec02d9cee2fbb9 Mon Sep 17 00:00:00 2001
2+
From: "Michael R. Crusoe" <[email protected]>
3+
Date: Sat, 20 Jun 2020 17:34:05 +0200
4+
Subject: [PATCH 1/2] use the simde header library for greater compatibility
5+
6+
---
7+
Makefile | 20 +++++++++++---------
8+
aligner_sw.h | 3 ++-
9+
processor_support.h | 5 ++---
10+
sse_util.h | 4 +++-
11+
6 files changed, 22 insertions(+), 14 deletions(-)
12+
create mode 100644 .gitmodules
13+
14+
diff --git a/Makefile b/Makefile
15+
index 60445ce6..088b2f40 100644
16+
--- a/Makefile
17+
+++ b/Makefile
18+
@@ -55,7 +55,7 @@ ifneq (,$(findstring Darwin,$(shell uname)))
19+
MACOS = 1
20+
endif
21+
22+
-EXTRA_FLAGS += -DPOPCNT_CAPABILITY -std=c++11
23+
+EXTRA_FLAGS += -std=c++11
24+
INC += -I. -I third_party
25+
26+
MM_DEF =
27+
@@ -152,9 +152,10 @@ HISAT2_REPEAT_CPPS_MAIN = $(REPEAT_CPPS) $(BUILD_CPPS) hisat2_repeat_main.cpp
28+
SEARCH_FRAGMENTS = $(wildcard search_*_phase*.c)
29+
VERSION = $(shell cat VERSION)
30+
31+
+ARCH=$(shell uname -m)
32+
# Convert BITS=?? to a -m flag
33+
BITS=32
34+
-ifeq (x86_64,$(shell uname -m))
35+
+ifeq (x86_64,$(ARCH))
36+
BITS=64
37+
endif
38+
# msys will always be 32 bit so look at the cpu arch instead.
39+
@@ -165,14 +166,15 @@ ifneq (,$(findstring AMD64,$(PROCESSOR_ARCHITEW6432)))
40+
endif
41+
BITS_FLAG =
42+
43+
-ifeq (32,$(BITS))
44+
- BITS_FLAG = -m32
45+
-endif
46+
-
47+
-ifeq (64,$(BITS))
48+
- BITS_FLAG = -m64
49+
+ifeq (x86_64,$(ARCH))
50+
+ ifeq (32,$(BITS))
51+
+ BITS_FLAG = -m32
52+
+ endif
53+
+ ifeq (64,$(BITS))
54+
+ BITS_FLAG = -m64
55+
+ endif
56+
+ SSE_FLAG=-msse2
57+
endif
58+
-SSE_FLAG=-msse2
59+
60+
DEBUG_FLAGS = -O0 -g3 $(BITS_FLAG) $(SSE_FLAG)
61+
DEBUG_DEFS = -DCOMPILER_OPTIONS="\"$(DEBUG_FLAGS) $(EXTRA_FLAGS)\""
62+
diff --git a/aligner_sw.h b/aligner_sw.h
63+
index add5c87d..194918ad 100644
64+
--- a/aligner_sw.h
65+
+++ b/aligner_sw.h
66+
@@ -66,11 +66,12 @@
67+
68+
#define INLINE_CUPS
69+
70+
+#define SIMDE_ENABLE_NATIVE_ALIASES
71+
+#include <simde/x86/sse2.h>
72+
#include <stdint.h>
73+
#include <iostream>
74+
#include <limits>
75+
#include "threading.h"
76+
-#include <emmintrin.h>
77+
#include "aligner_sw_common.h"
78+
#include "aligner_sw_nuc.h"
79+
#include "ds.h"
80+
diff --git a/processor_support.h b/processor_support.h
81+
index e731e003..5f292bb3 100644
82+
--- a/processor_support.h
83+
+++ b/processor_support.h
84+
@@ -12,7 +12,7 @@
85+
86+
#if defined(__INTEL_COMPILER)
87+
# define USING_INTEL_COMPILER
88+
-#elif defined(__GNUC__)
89+
+#elif defined(__GNUC__) && defined(__x86_64__) || defined(__i386__)
90+
# define USING_GCC_COMPILER
91+
# include <cpuid.h>
92+
#elif defined(_MSC_VER)
93+
@@ -52,8 +52,7 @@ class ProcessorSupport {
94+
#elif defined(USING_GCC_COMPILER)
95+
__get_cpuid(0x1, &regs.EAX, &regs.EBX, &regs.ECX, &regs.EDX);
96+
#else
97+
- std::cerr << "ERROR: please define __cpuid() for this build.\n";
98+
- assert(0);
99+
+ return false;
100+
#endif
101+
if( !( (regs.ECX & BIT(20)) && (regs.ECX & BIT(23)) ) ) return false;
102+
}
103+
diff --git a/sse_util.h b/sse_util.h
104+
index b5781f1a..b1155fbc 100644
105+
--- a/sse_util.h
106+
+++ b/sse_util.h
107+
@@ -20,11 +20,13 @@
108+
#ifndef SSE_UTIL_H_
109+
#define SSE_UTIL_H_
110+
111+
+#define SIMDE_ENABLE_NATIVE_ALIASES
112+
+#include <simde/x86/sse2.h>
113+
+
114+
#include "assert_helpers.h"
115+
#include "ds.h"
116+
#include "limit.h"
117+
#include <iostream>
118+
-#include <emmintrin.h>
119+
120+
class EList_m128i {
121+
public:
122+
123+
From 4d80442142afaae32056b9fc814f276260b23660 Mon Sep 17 00:00:00 2001
124+
From: "Michael R. Crusoe" <[email protected]>
125+
Date: Wed, 15 Feb 2023 17:55:03 +0100
126+
Subject: [PATCH 2/2] compilation fixes
127+
128+
---
129+
alphabet.cpp | 2 +-
130+
alphabet.h | 2 +-
131+
sstring.h | 2 +-
132+
3 files changed, 3 insertions(+), 3 deletions(-)
133+
134+
diff --git a/alphabet.cpp b/alphabet.cpp
135+
index be1af7cf..96af4605 100644
136+
--- a/alphabet.cpp
137+
+++ b/alphabet.cpp
138+
@@ -400,7 +400,7 @@ int dnacomp[5] = {
139+
140+
const char *iupacs = "!ACMGRSVTWYHKDBN!acmgrsvtwyhkdbn";
141+
142+
-char mask2iupac[16] = {
143+
+int mask2iupac[16] = {
144+
-1,
145+
'A', // 0001
146+
'C', // 0010
147+
diff --git a/alphabet.h b/alphabet.h
148+
index 340942eb..921d661b 100644
149+
--- a/alphabet.h
150+
+++ b/alphabet.h
151+
@@ -65,7 +65,7 @@ extern uint8_t dinuc2color[5][5];
152+
/// corresponding 2-bit nucleotide
153+
extern uint8_t nuccol2nuc[5][5];
154+
/// Convert a 4-bit mask into an IUPAC code
155+
-extern char mask2iupac[16];
156+
+extern int mask2iupac[16];
157+
158+
/// Convert an ascii color to an ascii dna char
159+
extern char col2dna[];
160+
diff --git a/sstring.h b/sstring.h
161+
index 3ec31f65..648f1657 100644
162+
--- a/sstring.h
163+
+++ b/sstring.h
164+
@@ -3326,7 +3326,7 @@ class SDnaMaskString : public SStringExpandable<char, S, M> {
165+
*/
166+
char toChar(size_t idx) const {
167+
assert_range((int)this->cs_[idx], 0, 15);
168+
- return mask2iupac[(int)this->cs_[idx]];
169+
+ return (char)mask2iupac[(int)this->cs_[idx]];
170+
}
171+
172+
/**

0 commit comments

Comments
 (0)