mirror of
https://github.com/chhylp123/hifiasm.git
synced 2026-10-10 20:40:57 +08:00
Update modimers
This commit is contained in:
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+13
-4
@@ -75,7 +75,6 @@ void Verify_Counting()
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/********************************for debug***************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -83,6 +82,10 @@ void Verify_Counting()
|
|||||||
void* Perform_Counting(void* arg)
|
void* Perform_Counting(void* arg)
|
||||||
{
|
{
|
||||||
int thr_ID = *((int*)arg);
|
int thr_ID = *((int*)arg);
|
||||||
|
|
||||||
|
///debug_mode(101, thr_ID, thread_num);
|
||||||
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
HPC_seq HPC_read;
|
HPC_seq HPC_read;
|
||||||
|
|
||||||
@@ -91,6 +94,7 @@ void* Perform_Counting(void* arg)
|
|||||||
init_R_buffer_block(&curr_sub_block);
|
init_R_buffer_block(&curr_sub_block);
|
||||||
|
|
||||||
long long read_number = 0;
|
long long read_number = 0;
|
||||||
|
long long select_k_mer_number = 0 ;
|
||||||
long long k_mer_number = 0 ;
|
long long k_mer_number = 0 ;
|
||||||
|
|
||||||
int file_flag = 1;
|
int file_flag = 1;
|
||||||
@@ -126,8 +130,13 @@ void* Perform_Counting(void* arg)
|
|||||||
if (avalible_k>=k_mer_length)
|
if (avalible_k>=k_mer_length)
|
||||||
{
|
{
|
||||||
///插入
|
///插入
|
||||||
insert_Total_Count_Table(&TCB, &k_code, k_mer_length);
|
if(insert_Total_Count_Table(&TCB, &k_code, k_mer_length))
|
||||||
|
{
|
||||||
|
select_k_mer_number++;
|
||||||
|
}
|
||||||
|
|
||||||
k_mer_number++;
|
k_mer_number++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -148,7 +157,8 @@ void* Perform_Counting(void* arg)
|
|||||||
destory_R_buffer_block(&curr_sub_block);
|
destory_R_buffer_block(&curr_sub_block);
|
||||||
free(arg);
|
free(arg);
|
||||||
|
|
||||||
fprintf(stdout, "thr_ID: %d, read_number: %lld, k_mer_number: %lld\n",thr_ID, read_number, k_mer_number);
|
fprintf(stdout, "thr_ID: %d, read_number: %lld, select_k_mer_number: %lld, k_mer_number: %lld\n",
|
||||||
|
thr_ID, read_number, select_k_mer_number, k_mer_number);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +177,6 @@ void* Perform_Counting(void* arg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Counting_multiple_thr()
|
void Counting_multiple_thr()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,5 @@
|
|||||||
void Counting_multiple_thr();
|
void Counting_multiple_thr();
|
||||||
/********************************for debug***************************************/
|
/********************************for debug***************************************/
|
||||||
void Verify_Counting();
|
void Verify_Counting();
|
||||||
/********************************for debug***************************************/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+20
-1
@@ -58,7 +58,27 @@ void destory_Total_Count_Table(Total_Count_Table* TCB)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************for debug***************************************/
|
||||||
|
void debug_mode(uint64_t d, uint64_t thread_ID, uint64_t thread_num)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "#%llu: Start debug_mode...\n", thread_ID);
|
||||||
|
|
||||||
|
uint64_t i;
|
||||||
|
|
||||||
|
for (i = thread_ID; i < 4,294,967,296; i = i + thread_num)
|
||||||
|
{
|
||||||
|
if(i%d != mod_d(0, i, d))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR mode, i: %llu\n", i);
|
||||||
|
fprintf(stderr, "i mod d: %llu\n", i%d);
|
||||||
|
fprintf(stderr, "mod_d(0, i, d): %llu\n", mod_d(0, i, d));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "#%llu: Finish debug_mode\n", thread_ID);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************for debug***************************************/
|
/********************************for debug***************************************/
|
||||||
@@ -111,4 +131,3 @@ void test_COUNT64()
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/********************************for debug***************************************/
|
|
||||||
|
|||||||
+42
-8
@@ -9,6 +9,7 @@ typedef khash_t(COUNT64) Count_Table;
|
|||||||
|
|
||||||
#define PREFIX_BITS 16
|
#define PREFIX_BITS 16
|
||||||
#define MAX_SUFFIX_BITS 64
|
#define MAX_SUFFIX_BITS 64
|
||||||
|
#define MODE_VALUE 101
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -40,9 +41,20 @@ inline void print_64bit(uint64_t x)
|
|||||||
|
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
/********************************for debug***************************************/
|
|
||||||
|
|
||||||
inline void get_sub_table(uint64_t* get_sub_ID, uint64_t* get_sub_key, Total_Count_Table* TCB, Hash_code* code, int k)
|
inline uint64_t mod_d(uint64_t h_key, uint64_t low_key, uint64_t d)
|
||||||
|
{
|
||||||
|
uint64_t result = (h_key >> 32) % d;
|
||||||
|
result = ((result << 32) + (h_key & (uint64_t)0xffffffff)) % d;
|
||||||
|
result = ((result << 32) + (low_key >> 32)) % d;
|
||||||
|
result = ((result << 32) + (low_key & (uint64_t)0xffffffff)) % d;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inline int get_sub_table(uint64_t* get_sub_ID, uint64_t* get_sub_key, Total_Count_Table* TCB, Hash_code* code, int k)
|
||||||
{
|
{
|
||||||
uint64_t h_key, low_key;
|
uint64_t h_key, low_key;
|
||||||
///k有可能是64,所以可能会有问题
|
///k有可能是64,所以可能会有问题
|
||||||
@@ -51,6 +63,12 @@ inline void get_sub_table(uint64_t* get_sub_ID, uint64_t* get_sub_key, Total_Cou
|
|||||||
//k不可能为0, 所以这个右移不会有问题
|
//k不可能为0, 所以这个右移不会有问题
|
||||||
h_key = code->x[1] >> (64 - k);
|
h_key = code->x[1] >> (64 - k);
|
||||||
|
|
||||||
|
if(mod_d(h_key, low_key, MODE_VALUE) > 3)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///注意suffix_bits最大就是64
|
///注意suffix_bits最大就是64
|
||||||
///前一个右移不安全,因为TCB->suffix_bits有可能为64
|
///前一个右移不安全,因为TCB->suffix_bits有可能为64
|
||||||
///后一个左移安全,因为TCB->suffix_bits不可能为0
|
///后一个左移安全,因为TCB->suffix_bits不可能为0
|
||||||
@@ -61,13 +79,18 @@ inline void get_sub_table(uint64_t* get_sub_ID, uint64_t* get_sub_key, Total_Cou
|
|||||||
*get_sub_ID = sub_ID;
|
*get_sub_ID = sub_ID;
|
||||||
*get_sub_key = sub_key;
|
*get_sub_key = sub_key;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void insert_Total_Count_Table(Total_Count_Table* TCB, Hash_code* code, int k)
|
inline int insert_Total_Count_Table(Total_Count_Table* TCB, Hash_code* code, int k)
|
||||||
{
|
{
|
||||||
uint64_t sub_ID, sub_key;
|
uint64_t sub_ID, sub_key;
|
||||||
get_sub_table(&sub_ID, &sub_key, TCB, code, k);
|
if(!get_sub_table(&sub_ID, &sub_key, TCB, code, k))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
khint_t t; ///这就是个迭代器
|
khint_t t; ///这就是个迭代器
|
||||||
int absent;
|
int absent;
|
||||||
@@ -90,13 +113,18 @@ inline void insert_Total_Count_Table(Total_Count_Table* TCB, Hash_code* code, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
__sync_lock_release(&TCB->sub_h_lock[sub_ID].lock);
|
__sync_lock_release(&TCB->sub_h_lock[sub_ID].lock);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int get_Total_Count_Table(Total_Count_Table* TCB, Hash_code* code, int k)
|
inline int get_Total_Count_Table(Total_Count_Table* TCB, Hash_code* code, int k)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint64_t sub_ID, sub_key;
|
uint64_t sub_ID, sub_key;
|
||||||
get_sub_table(&sub_ID, &sub_key, TCB, code, k);
|
if(!get_sub_table(&sub_ID, &sub_key, TCB, code, k))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
khint_t t; ///这就是个迭代器
|
khint_t t; ///这就是个迭代器
|
||||||
int absent;
|
int absent;
|
||||||
@@ -113,13 +141,18 @@ inline int get_Total_Count_Table(Total_Count_Table* TCB, Hash_code* code, int k)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************for debug***************************************/
|
/********************************for debug***************************************/
|
||||||
inline int verify_Total_Count_Table(Total_Count_Table* TCB, Hash_code* code, int k)
|
inline int verify_Total_Count_Table(Total_Count_Table* TCB, Hash_code* code, int k)
|
||||||
{
|
{
|
||||||
uint64_t sub_ID, sub_key;
|
uint64_t sub_ID, sub_key;
|
||||||
get_sub_table(&sub_ID, &sub_key, TCB, code, k);
|
if(!get_sub_table(&sub_ID, &sub_key, TCB, code, k))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
khint_t t; ///这就是个迭代器
|
khint_t t; ///这就是个迭代器
|
||||||
int absent;
|
int absent;
|
||||||
@@ -144,7 +177,6 @@ inline int verify_Total_Count_Table(Total_Count_Table* TCB, Hash_code* code, int
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/********************************for debug***************************************/
|
|
||||||
|
|
||||||
/********************************for debug***************************************/
|
/********************************for debug***************************************/
|
||||||
inline int Traverse_Total_Count_Table(Total_Count_Table* TCB)
|
inline int Traverse_Total_Count_Table(Total_Count_Table* TCB)
|
||||||
@@ -174,7 +206,6 @@ inline int Traverse_Total_Count_Table(Total_Count_Table* TCB)
|
|||||||
|
|
||||||
fprintf(stdout, "non_empty_k_mer: %lld\n", non_empty_k_mer);
|
fprintf(stdout, "non_empty_k_mer: %lld\n", non_empty_k_mer);
|
||||||
}
|
}
|
||||||
/********************************for debug***************************************/
|
|
||||||
|
|
||||||
|
|
||||||
void init_Total_Count_Table(int k, Total_Count_Table* TCB);
|
void init_Total_Count_Table(int k, Total_Count_Table* TCB);
|
||||||
@@ -184,6 +215,9 @@ void init_Count_Table(Count_Table** table);
|
|||||||
|
|
||||||
/********************************for debug***************************************/
|
/********************************for debug***************************************/
|
||||||
void test_COUNT64();
|
void test_COUNT64();
|
||||||
|
|
||||||
/********************************for debug***************************************/
|
/********************************for debug***************************************/
|
||||||
|
void debug_mode(uint64_t d, uint64_t thread_ID, uint64_t thread_num);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -13,7 +13,6 @@ void debug_Counting()
|
|||||||
fprintf(stderr, "debug over!\n");
|
fprintf(stderr, "debug over!\n");
|
||||||
destory_kseq();
|
destory_kseq();
|
||||||
}
|
}
|
||||||
/********************************for debug***************************************/
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|||||||
Reference in New Issue
Block a user