mirror of
https://github.com/chhylp123/hifiasm.git
synced 2026-09-15 12:47:57 +08:00
111 lines
5.8 KiB
C++
111 lines
5.8 KiB
C++
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "CommandLines.h"
|
|
#include "Process_Read.h"
|
|
#include "Assembly.h"
|
|
#include "Levenshtein_distance.h"
|
|
#include "htab.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
// setvbuf(stderr, NULL, _IONBF, 0);
|
|
int i, ret;
|
|
yak_reset_realtime();
|
|
init_opt(&asm_opt);
|
|
if (!CommandLine_process(argc, argv, &asm_opt)) return 0;
|
|
|
|
// bit_extz_t exz, exz64; init_bit_extz_t(&exz, 2); init_bit_extz_t(&exz64, 2);
|
|
|
|
// char *pstr = "GACCCAG", *tsrt = "GTTGTTAATTCCAT"; int32_t thre = 14; clear_align(exz); clear_align(exz64);
|
|
// ed_band_cal_extension_64_0_w_trace((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz);
|
|
// // // ed_band_cal_semi_64_w_absent_diag((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, 0, &exz);
|
|
// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz.ps::%d, exz.pe::%d, exz.ts::%d, exz.te::%d\n", __func__,
|
|
// exz.err, exz.ps, exz.pe, exz.ts, exz.te);
|
|
// cigar_check((char*)pstr, (char*)tsrt, &(exz));
|
|
// ed_band_cal_extension_64_0_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz);
|
|
// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz.ps::%d, exz.pe::%d, exz.ts::%d, exz.te::%d\n", __func__,
|
|
// exz.err, exz.ps, exz.pe, exz.ts, exz.te);
|
|
// ed_band_cal_semi_infi_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, NULL, &exz);
|
|
// ed_band_cal_semi_64_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz64);
|
|
// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz64.err::%d, exz.ps::%d, exz64.ps::%d, exz.pe::%d, exz64.pe::%d, exz.ts::%d, exz64.ts::%d, exz.te::%d, exz64.te::%d\n", __func__,
|
|
// exz.err, exz64.err, exz.ps, exz64.ps, exz.pe, exz64.pe, exz.ts, exz64.ts, exz.te, exz64.te);
|
|
// ed_band_cal_semi_64_w_trace((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz64);
|
|
// cigar_check((char*)pstr, (char*)tsrt, &(exz64));
|
|
|
|
|
|
// char *pstr = "TGT", *tsrt = "CTGT"; int32_t thre = 1;
|
|
// ed_band_cal_global_infi_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, NULL, &exz);
|
|
// ed_band_cal_global_64_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz64);
|
|
// ed_band_cal_global_64_w_trace((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz64);
|
|
// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz64.err::%d, exz.ps::%d, exz64.ps::%d, exz.pe::%d, exz64.pe::%d, exz.ts::%d, exz64.ts::%d, exz.te::%d, exz64.te::%d\n", __func__,
|
|
// exz.err, exz64.err, exz.ps, exz64.ps, exz.pe, exz64.pe, exz.ts, exz64.ts, exz.te, exz64.te);
|
|
// cigar_check((char*)pstr, (char*)tsrt, &(exz64));
|
|
|
|
// ed_band_cal_extension_infi0_w((char *)"AAT", 3, (char *)"ACTTTTTT", 8, 2, NULL, &exz);
|
|
// ed_band_cal_extension_64_w((char *)"AAT", 3, (char *)"ACTTTTTT", 8, 2, &exz64);
|
|
// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz64.err::%d, exz.ps::%d, exz64.ps::%d, exz.pe::%d, exz64.pe::%d, exz.ts::%d, exz64.ts::%d, exz.te::%d, exz64.te::%d\n", __func__,
|
|
// exz.err, exz64.err, exz.ps, exz64.ps, exz.pe, exz64.pe, exz.ts, exz64.ts, exz.te, exz64.te);
|
|
|
|
//bit_extz_t exz; ///ed_band_cal_global_128bit(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz);
|
|
// ed_band_cal_extension_128bit((char *)"AAGTTTA", 7, (char *)"CCTTTTTT", 8, 4, &exz);
|
|
// ed_band_cal_extension_128bit((char *)"AA", 2, (char *)"ACTTTTTT", 8, 1, &exz);
|
|
// fprintf(stderr, "ed_extension::%d, pe::%d, te::%d\n", exz.err, exz.pe, exz.te);
|
|
// exit(1);
|
|
|
|
|
|
|
|
// fprintf(stderr, "[M::%s::] ed_global::%d, ed_global_128bit::%d\n", __func__,
|
|
// ed_band_cal_global((char *)"ACT", 3, (char *)"AAT", 3, 1),
|
|
// ed_band_cal_global_128bit((char *)"ACT", 3, (char *)"AAT", 3, 1));
|
|
|
|
// fprintf(stderr, "[M::%s::] ed_global::%d, ed_global_128bit::%d\n", __func__,
|
|
// ed_band_cal_global((char*)"ACTTTTTT", 8, (char*)"AATTTT", 6, 3),
|
|
// ed_band_cal_global_128bit((char*)"ACTTTTTT", 8, (char*)"AATTTT", 6, 3));
|
|
// exit(1);
|
|
|
|
int8_t simd_auto = 0;
|
|
#if defined(__x86_64__) || defined(__i386__)
|
|
__builtin_cpu_init();
|
|
if (__builtin_cpu_supports("avx512f")) simd_auto = 2;
|
|
else if (__builtin_cpu_supports("avx2")) simd_auto = 1;
|
|
else simd_auto = 0;
|
|
#endif
|
|
|
|
if (simd_auto) {
|
|
fprintf(stderr, "[M::%s::auto] detected CPU support for %s\n", __func__, (simd_auto == 2) ? "AVX-512" : "AVX2");
|
|
} else {
|
|
fprintf(stderr, "[M::%s::auto] no supported SIMD extension detected; falling back to non-SIMD\n", __func__);
|
|
}
|
|
|
|
if (asm_opt.simd_mm == 0 || asm_opt.simd_mm == 1 || asm_opt.simd_mm == 2) {
|
|
fprintf(stderr, "[M::%s::user] user requested %s mode\n", __func__, (asm_opt.simd_mm == 2) ? "AVX-512" : ((asm_opt.simd_mm == 1) ? "AVX2" : "non-SIMD"));
|
|
if(asm_opt.simd_mm > simd_auto) asm_opt.simd_mm = simd_auto;
|
|
} else {
|
|
asm_opt.simd_mm = simd_auto;
|
|
if(asm_opt.simd_mm >= 1) asm_opt.simd_mm = 1; ///use avx2 rather than avx512, looks like avx512 still has issues right now
|
|
}
|
|
|
|
fprintf(stderr, "[M::%s::final] using %s mode\n", __func__, (asm_opt.simd_mm == 2) ? "AVX-512" : ((asm_opt.simd_mm == 1) ? "AVX2" : "non-SIMD"));
|
|
|
|
fprintf(stderr, "[M::%s::]\traw_aln::%d\tpost_syn::%d\n", __func__, asm_opt.realn_raw, asm_opt.post_syn);
|
|
|
|
if(asm_opt.recurrent_err_test) {
|
|
fprintf(stderr, "[M::%s::] Enable recurrent sequencing-error filtering\n", __func__);
|
|
} else {
|
|
fprintf(stderr, "[M::%s::] Disable recurrent sequencing-error filtering\n", __func__);
|
|
}
|
|
|
|
|
|
if(asm_opt.sec_in) ret = ha_assemble_pair();
|
|
else if(asm_opt.dbg_ovec_cal) ret = ha_ec_dbg();
|
|
else ret = ha_assemble();
|
|
|
|
destory_opt(&asm_opt);
|
|
fprintf(stderr, "[M::%s] Version: %s\n", __func__, HA_VERSION);
|
|
fprintf(stderr, "[M::%s] CMD:", __func__);
|
|
for (i = 0; i < argc; ++i)
|
|
fprintf(stderr, " %s", argv[i]);
|
|
fprintf(stderr, "\n[M::%s] Real time: %.3f sec; CPU: %.3f sec; Peak RSS: %.3f GB; SIMD: %u\n", __func__, yak_realtime(), yak_cputime(), yak_peakrss_in_gb(), asm_opt.simd_mm);
|
|
return ret;
|
|
}
|