-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinternal_gpu_algorithm.cpp
33 lines (26 loc) · 1017 Bytes
/
internal_gpu_algorithm.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "internal_gpu_algorithm.h"
#include <thread>
#include <config.h>
#include <hash_conversions.h>
#include <run_parallel.h>
#include <safe_counter.h>
#include <gpu_info.h>
#include "finder_kernel.cuh"
void internal_gpu_algorithm(const SequenceHashes &sequence_hashes,
std::vector<uint16_t> &out_motif_weights,
const GpuCudaParams ¶ms)
{
out_motif_weights.resize(TOTAL_MOT, 0);
uint32_t threads = (params.gpu_count > 0) ? params.gpu_count : 1;
SafeCounter motifs_counter(TOTAL_MOT);
run_parallel(threads, [&](uint32_t thread_id) {
GpuInternalMemory gpu_memory(params, sequence_hashes);
while (true) {
const auto range = motifs_counter.get_and_increment_range_info(params.motif_range_size);
if (range.count() == 0) {
break;
}
motif_finder_gpu_internal(gpu_memory, params, out_motif_weights, range.start, range.count(), thread_id);
}
});
}