Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Megahit in Arm Neoverse de 64 bits core #320

Open
higaredavm opened this issue Dec 3, 2021 · 9 comments · May be fixed by #368
Open

Megahit in Arm Neoverse de 64 bits core #320

higaredavm opened this issue Dec 3, 2021 · 9 comments · May be fixed by #368

Comments

@higaredavm
Copy link

We are exploring bioinformtics in amazon AWS, specifically we want to run genome assembly on AWS Graviton2 processors which have an ARM architecture. Is there a version of megahit built for ARM / aarch64 architecture.

@aclum
Copy link

aclum commented Dec 3, 2021

We have had good success with graviton2 with other bioinformatics tools and would also be interested of a version of megathit which compiles on ARM.

@higaredavm
Copy link
Author

We have had good success with graviton2 with other bioinformatics tools and would also be interested of a version of megathit which compiles on ARM.

I am curious about what bioinformatics tools have you been running on graviton2.

@aclum
Copy link

aclum commented Dec 3, 2021

From BBTools, BBMap and BBcms both run on graviton2. These are AWS blog posts on peregrine and bwa on graviton2
https://aws.amazon.com/blogs/publicsector/accelerating-genome-assembly-aws-graviton2/
https://aws.amazon.com/blogs/publicsector/generalized-approach-benchmarking-genomics-workloads-cloud-bwa-read-aligner-graviton2/

@aclum
Copy link

aclum commented Dec 17, 2021

I made some progress on getting MEGAHIT working on ARM but am stalled on the third issue

The first issue is with x86 specific flags (-mbmi2 & -mpopcnt) which can be removed from the CMakeLists.txt file.

The second issue is with x86intrin.h and can be fixed by replacing with openvec*.h files from https://github.com/OpenVec/OpenVec

The third issue is an error about "impossible constraint in ‘asm’". Based on searching stack overflow this can be fixed by rewriting the code in c++ instead of assembly
https://stackoverflow.com/questions/1478513/linux-assembler-error-impossible-constraint-in-asm

Would it be possible to get the third issue fixed?

@voutcn
Copy link
Owner

voutcn commented Mar 24, 2022

You can just replace

inline bool HasPopcnt() {
unsigned eax, ebx, ecx, edx;
#ifdef _MSC_VER
int cpuid[4];
__cpuid(cpuid, 1);
eax = cpuid[0], ebx = cpuid[1], ecx = cpuid[2], edx = cpuid[3];
#else
asm volatile("cpuid\n\t"
: "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
: "0"(1));
#endif
return ecx >> 23U & 1U;
}
inline bool HasBmi2() {
unsigned eax, ebx, ecx, edx;
#ifdef _MSC_VER
int cpuid[4];
__cpuidex(cpuid, 7, 0);
eax = cpuid[0], ebx = cpuid[1], ecx = cpuid[2], edx = cpuid[3];
#else
asm volatile("cpuid\n\t"
: "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
: "0"(7), "2"(0));
#endif
return ebx >> 8U & 1U;
}

with

inline bool HasPopcnt() { return false; }
inline bool HasBmi2() { return false; }

I don't have an Arm machine to test. Let me know if that works. Also feel free to send a PR.

@aquaskyline to follow up.

@accopeland
Copy link

For the record, the above suggestions are sufficient to compile megahit on graviton2. I am working on a PR.

@higaredavm
Copy link
Author

@voutcn We are doing the changes that you suggest, however we are having this error. I really appreciate your help, thanks
image-2

@voutcn
Copy link
Owner

voutcn commented Apr 5, 2022

I think the error has nothing to do with ARM. One *.edges.info file is broken for some unknown reason. Could you retry?

martin-g added a commit to martin-g/megahit that referenced this issue Mar 27, 2024
Fixes voutcn#320
Based on: voutcn#329

Preserves the x86_64 specifics when building on x86_64 machine

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
@martin-g
Copy link

Hi!

I created a new PR - #368
It is built on top of #329 but preserves the x86_64 optimizations.

martin-g added a commit to martin-g/megahit that referenced this issue Apr 4, 2024
Fixes voutcn#320
Based on: voutcn#329

Preserves the x86_64 specifics when building on x86_64 machine

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants