Comments (7)
Hi @certik. Thanks for the efforts and information.
from seq.
Hi @certik — actually I’ll have access to an M1 Mac in a day or two so I can help debug this. Let me circle back with you then!
from seq.
This error seems the same as in spack/spack#26319. In there it is recommended to use LLVM 12.0.1, which is exactly the version that Conda installed above.
from seq.
The following patch makes it compile:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ff29ed08..a93a89c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,18 +44,12 @@ set(SEQRT_FILES
runtime/lib.h
runtime/lib.cpp
runtime/exc.cpp
- runtime/sw/ksw2.h
- runtime/sw/ksw2_extd2_sse.cpp
- runtime/sw/ksw2_exts2_sse.cpp
- runtime/sw/ksw2_extz2_sse.cpp
- runtime/sw/ksw2_gg2_sse.cpp
- runtime/sw/intersw.h
- runtime/sw/intersw.cpp)
+ )
add_library(seqrt SHARED ${SEQRT_FILES})
add_dependencies(seqrt bz2 liblzma zlibstatic gc htslib backtrace)
set_source_files_properties(runtime/sw/intersw.cpp PROPERTIES COMPILE_FLAGS -mavx)
target_include_directories(seqrt PRIVATE ${backtrace_SOURCE_DIR} "${gc_SOURCE_DIR}/include" runtime)
-target_link_libraries(seqrt PRIVATE omp backtrace ${STATIC_LIBCPP} LLVMSupport)
+target_link_libraries(seqrt PRIVATE backtrace ${STATIC_LIBCPP} LLVMSupport)
if(APPLE)
target_link_libraries(seqrt PRIVATE
-Wl,-force_load,$<TARGET_FILE:bz2>
@@ -73,9 +67,9 @@ else()
$<TARGET_FILE:htslib>
-Wl,--no-whole-archive)
endif()
-add_custom_command(TARGET seqrt POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:omp> ${CMAKE_BINARY_DIR})
-
+#add_custom_command(TARGET seqrt POST_BUILD
+# COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:omp> ${CMAKE_BINARY_DIR})
+#
# Seq compiler library
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
diff --git a/runtime/lib.cpp b/runtime/lib.cpp
index e642e3ef..0a4e8ae6 100644
--- a/runtime/lib.cpp
+++ b/runtime/lib.cpp
@@ -17,7 +17,7 @@
#define GC_THREADS
#include "lib.h"
-#include "sw/ksw2.h"
+//#include "sw/ksw2.h"
#include <gc.h>
using namespace std;
@@ -53,7 +53,7 @@ SEQ_FUNC void seq_init(int d) {
GC_set_warn_proc(GC_ignore_warn_proc);
GC_allow_register_threads();
// equivalent to: #pragma omp parallel { register_thread }
- __kmpc_fork_call(&dummy_loc, 0, (kmpc_micro)register_thread);
+ //__kmpc_fork_call(&dummy_loc, 0, (kmpc_micro)register_thread);
seq_exc_init();
debug = d;
}
@@ -342,12 +342,14 @@ struct Alignment {
SEQ_FUNC void seq_align(seq_t query, seq_t target, int8_t *mat, int8_t gapo,
int8_t gape, seq_int_t bandwidth, seq_int_t zdrop,
seq_int_t end_bonus, seq_int_t flags, Alignment *out) {
- ksw_extz_t ez;
+// ksw_extz_t ez;
ALIGN_ENCODE(encode);
+ /*
ksw_extz2_sse(nullptr, qlen, qbuf, tlen, tbuf, 5, mat, gapo, gape, (int)bandwidth,
(int)zdrop, end_bonus, (int)flags, &ez);
+ */
ALIGN_RELEASE();
- *out = {{ez.cigar, ez.n_cigar}, flags & KSW_EZ_EXTZ_ONLY ? ez.max : ez.score};
+// *out = {{ez.cigar, ez.n_cigar}, flags & KSW_EZ_EXTZ_ONLY ? ez.max : ez.score};
}
SEQ_FUNC void seq_align_default(seq_t query, seq_t target, Alignment *out) {
@@ -357,33 +359,22 @@ SEQ_FUNC void seq_align_default(seq_t query, seq_t target, Alignment *out) {
int n_cigar = 0;
uint32_t *cigar = nullptr;
ALIGN_ENCODE(encode);
- int score = ksw_gg2_sse(nullptr, qlen, qbuf, tlen, tbuf, 5, mat, 0, 1, -1, &m_cigar,
- &n_cigar, &cigar);
ALIGN_RELEASE();
- *out = {{cigar, n_cigar}, score};
}
SEQ_FUNC void seq_align_dual(seq_t query, seq_t target, int8_t *mat, int8_t gapo1,
int8_t gape1, int8_t gapo2, int8_t gape2,
seq_int_t bandwidth, seq_int_t zdrop, seq_int_t end_bonus,
seq_int_t flags, Alignment *out) {
- ksw_extz_t ez;
ALIGN_ENCODE(encode);
- ksw_extd2_sse(nullptr, qlen, qbuf, tlen, tbuf, 5, mat, gapo1, gape1, gapo2, gape2,
- (int)bandwidth, (int)zdrop, end_bonus, (int)flags, &ez);
ALIGN_RELEASE();
- *out = {{ez.cigar, ez.n_cigar}, flags & KSW_EZ_EXTZ_ONLY ? ez.max : ez.score};
}
SEQ_FUNC void seq_align_splice(seq_t query, seq_t target, int8_t *mat, int8_t gapo1,
int8_t gape1, int8_t gapo2, int8_t noncan,
seq_int_t zdrop, seq_int_t flags, Alignment *out) {
- ksw_extz_t ez;
ALIGN_ENCODE(encode);
- ksw_exts2_sse(nullptr, qlen, qbuf, tlen, tbuf, 5, mat, gapo1, gape1, gapo2, noncan,
- (int)zdrop, (int)flags, &ez);
ALIGN_RELEASE();
- *out = {{ez.cigar, ez.n_cigar}, flags & KSW_EZ_EXTZ_ONLY ? ez.max : ez.score};
}
SEQ_FUNC void seq_align_global(seq_t query, seq_t target, int8_t *mat, int8_t gapo,
@@ -393,21 +384,14 @@ SEQ_FUNC void seq_align_global(seq_t query, seq_t target, int8_t *mat, int8_t ga
int n_cigar = 0;
uint32_t *cigar = nullptr;
ALIGN_ENCODE(encode);
- int score = ksw_gg2_sse(nullptr, qlen, qbuf, tlen, tbuf, 5, mat, gapo, gape,
- (int)bandwidth, &m_cigar, &n_cigar, &cigar);
ALIGN_RELEASE();
- *out = {{backtrace ? cigar : nullptr, backtrace ? n_cigar : 0}, score};
}
SEQ_FUNC void seq_palign(seq_t query, seq_t target, int8_t *mat, int8_t gapo,
int8_t gape, seq_int_t bandwidth, seq_int_t zdrop,
seq_int_t end_bonus, seq_int_t flags, Alignment *out) {
- ksw_extz_t ez;
ALIGN_ENCODE(pencode);
- ksw_extz2_sse(nullptr, qlen, qbuf, tlen, tbuf, 23, mat, gapo, gape, (int)bandwidth,
- (int)zdrop, end_bonus, (int)flags, &ez);
ALIGN_RELEASE();
- *out = {{ez.cigar, ez.n_cigar}, flags & KSW_EZ_EXTZ_ONLY ? ez.max : ez.score};
}
SEQ_FUNC void seq_palign_default(seq_t query, seq_t target, Alignment *out) {
@@ -440,24 +424,16 @@ SEQ_FUNC void seq_palign_default(seq_t query, seq_t target, Alignment *out) {
-1, -1, -1, -2, -3, -2, -3, -2, 3, -3, 2, -1, -2, -1, -1, -2, -3, -1, -2, -2,
-2, -1, 2, -1, 7, -2, -1, 1, -3, 1, 4, -3, -2, 0, -3, 1, -3, -1, 0, -1,
3, 0, 0, -1, -2, -3, -1, -2, 4};
- ksw_extz_t ez;
ALIGN_ENCODE(pencode);
- ksw_extz2_sse(nullptr, qlen, qbuf, tlen, tbuf, 23, mat, 11, 1, -1, -1,
- /* end_bonus */ 0, 0, &ez);
ALIGN_RELEASE();
- *out = {{ez.cigar, ez.n_cigar}, ez.score};
}
SEQ_FUNC void seq_palign_dual(seq_t query, seq_t target, int8_t *mat, int8_t gapo1,
int8_t gape1, int8_t gapo2, int8_t gape2,
seq_int_t bandwidth, seq_int_t zdrop, seq_int_t end_bonus,
seq_int_t flags, Alignment *out) {
- ksw_extz_t ez;
ALIGN_ENCODE(pencode);
- ksw_extd2_sse(nullptr, qlen, qbuf, tlen, tbuf, 23, mat, gapo1, gape1, gapo2, gape2,
- (int)bandwidth, (int)zdrop, end_bonus, (int)flags, &ez);
ALIGN_RELEASE();
- *out = {{ez.cigar, ez.n_cigar}, flags & KSW_EZ_EXTZ_ONLY ? ez.max : ez.score};
}
SEQ_FUNC void seq_palign_global(seq_t query, seq_t target, int8_t *mat, int8_t gapo,
@@ -466,10 +442,7 @@ SEQ_FUNC void seq_palign_global(seq_t query, seq_t target, int8_t *mat, int8_t g
int n_cigar = 0;
uint32_t *cigar = nullptr;
ALIGN_ENCODE(pencode);
- int score = ksw_gg2_sse(nullptr, qlen, qbuf, tlen, tbuf, 23, mat, gapo, gape,
- (int)bandwidth, &m_cigar, &n_cigar, &cigar);
ALIGN_RELEASE();
- *out = {{cigar, n_cigar}, score};
}
SEQ_FUNC bool seq_is_macos() {
diff --git a/scripts/deps.cmake b/scripts/deps.cmake
index b1585a10..ca7e131c 100644
--- a/scripts/deps.cmake
+++ b/scripts/deps.cmake
@@ -36,13 +36,6 @@ CPMAddPackage(
"enable_thread_local_alloc ON"
"enable_handle_fork ON")
set_target_properties(cord PROPERTIES EXCLUDE_FROM_ALL ON)
-CPMAddPackage(
- NAME openmp
- GITHUB_REPOSITORY "llvm-mirror/openmp"
- VERSION 9.0
- GIT_TAG release_90
- OPTIONS "OPENMP_ENABLE_LIBOMPTARGET OFF"
- "OPENMP_STANDALONE_BUILD ON")
CPMAddPackage(
NAME backtrace
GITHUB_REPOSITORY "ianlancetaylor/libbacktrace"
But when I try to compile a simple project, it fails with:
$ ./seqc build ../a.py
ld: library not found for -lseqrt
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
error: process for 'clang' exited with status 1
from seq.
The last error can be mitigated by:
$ LD_LIBRARY_PATH=. ./seqc build ../a.py
ld: library not found for -lomp
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
from seq.
This seems to be a better patch:
--- a/compiler/sir/llvm/llvisitor.cpp
+++ b/compiler/sir/llvm/llvisitor.cpp
@@ -485,8 +485,7 @@ void LLVMVisitor::writeToExecutable(const std::string &filename,
for (const auto &lib : libs) {
command.push_back("-l" + lib);
}
- std::vector<std::string> extraArgs = {"-lseqrt", "-lomp", "-lpthread", "-ldl",
- "-lz", "-lm", "-lc", "-o",
+ std::vector<std::string> extraArgs = {"-L.", "-lseqrt", "-o",
filename, objFile};
for (const auto &arg : extraArgs) {
command.push_back(arg);
Now it fails with:
$ ./seqc build ../a.py
ld: library not found for -lSystem
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
error: process for 'clang' exited with status 1
I am going to leave it at this. It seems it's pretty close, but not quite there yet to work on M1.
from seq.
I did have a chance to look into this a bit more. The original build error is from OpenMP, and is resolved in newer versions, so that in itself isn't a huge issue. However, it seems LLVM itself still has some catching up to do when it comes to M1, since exceptions aren't catchable in JIT mode yet (see also this issue), which causes a lot of problems. OpenMP also has some issues on M1, e.g. tasking causes a crash on shutdown; I observed a variant of this bug myself during testing as well.
In short, I was able to get a version of Seq up and running on M1, but it probably makes sense to wait for better support from LLVM first.
from seq.
Related Issues (20)
- Running seq on WSL2 HOT 4
- Levenshtein distance HOT 5
- Windows compatibility of seq-lang? HOT 2
- importing C libraries HOT 9
- Compiling on M1 Mac HOT 4
- Example not working HOT 2
- undefined reference to seq_alloc when seqc build HOT 3
- Multiple definitions of functions during executable generation HOT 6
- Any potential clash with biopython HOT 2
- error: cannot find magic 'matmul' in seq HOT 2
- index file from class FMIndex HOT 4
- Is it possible calling seq from python module?
- llvm::sys::fs::F_None is removed in recent releases HOT 1
- Build an execution program not depending on the runtime libraries HOT 1
- Failed to build seq in Arch Linux
- New parser in seq 0.11.0 does not support backslash line continuation in print statements.
- file_obj.read function requires number of bytes to be read as mandatory argument
- Is seq-lang still being maintained and updated?
- Is seq-lang still being updated and maintained HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seq.