XT-neighbor
|
A collection of most GPU parallel primitives that is implemented as CUDA kernel (most map and expand operations). More...
Macros | |
#define | MIN3(a, b, c) ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c))) |
Functions | |
template<typename T > | |
T | transfer_last_element (T *deviceArr, int n) |
transfer last element of the GPU array to main memory. More... | |
__global__ void | cal_combination_len (Int3 *input, int distance, int *output, int n) |
precalculate the number of positions required in the output array of generate combination operation. More... | |
__global__ void | cal_pair_len (int *inputRange, int *outputRange, int n) |
precalculate the output range of generate pair operation. More... | |
__global__ void | cal_pair_len_diag (int *inputRange, int *outputRange, int n) |
precalculate the output range of pair generation in diagonal position for overlap mode. More... | |
__global__ void | cal_pair_len_nondiag (Int2 *pairs, int *seqOffset, int *outputRange, int n) |
precalculate the output range of pair generation in diagonal position for overlap mode. More... | |
__global__ void | cal_pair_len_lowerbound (int *indexes, int *inputOffsets, int *outputLengths, int lowerbound, int n) |
precalculate the number of positions required in the output array of generate pair operation with lower bound constratint. More... | |
__global__ void | generate_pairs (int *indexes, Int2 *outputs, int *inputOffsets, int *outputOffsets, int *lesserIndex, int lowerbound, int carry, int n) |
combinatorially generate pairs of indexes within the same group. More... | |
__global__ void | generate_smaller_index (int *indexes, int *outputs, int *inputOffsets, int *outputOffsets, int carry, int n) |
combinatorially generate pairs of indexes within the same group but record only the partial output. More... | |
__device__ char | levenshtein_static (char *allStr, unsigned int start1, unsigned int start2, int len1, int len2) |
calculate Levenshtein distance of 2 strings in GPU where len1,len2<=18. More... | |
__device__ char | levenshtein (char *allStr, unsigned int start1, unsigned int start2, int len1, int len2) |
calculate Levenshtein distance of 2 strings in GPU where len1>18 or len2>18. More... | |
__device__ char | hamming (char *allStr, unsigned int start1, unsigned int start2, int len1, int len2) |
calculate Hamming distance of 2 strings in GPU. More... | |
__global__ void | cal_distance (char *allStr, unsigned int *offsets, Int2 *index, SeqInfo *seqInfo, int *seqOffset, int distance, char measure, char *distanceOutput, char *flagOutput, int n, int seqLen) |
calculate distances of strings from given pairs and flag ones exceeding the threshold. More... | |
__global__ void | cal_distance (char *allStr, unsigned int *offsets, Int2 *index, int distance, char measure, char *distanceOutput, char *flagOutput, int n, int seqLen) |
__global__ void | pair2rep (Int2 *pairs, Int2 *indexOut, size_t *freqOut, SeqInfo *seqInfo, int *inputOffsets, int *outputOffsets, int n) |
turning pairs and frequencies from sequence format to repertoire format. More... | |
__global__ void | gen_assignment (int *matrix, int *output, int nBit, int nRow, int nColumn) |
expand operation part of solving bin packing for 2D buffer. More... | |
__global__ void | gen_bounds (size_t *matrix, int *keyOut, int *valueOut, int nBit, int valueMax, int nRow, int nColumn) |
expand operation part of solving bin packing for lower bound. More... | |
__global__ void | flag_lowerbound (int *valueInput, int *valueOffsets, char *output, int lowerbound, int n) |
flag data to be removed after the lower bound has been processed. More... | |
__global__ void | make_row_index (int *output, int n, int nRepeat) |
utility to generate keys for matrix processing. More... | |
__global__ void | toSizeT (int *input, size_t *output, int n) |
utility to cast types. More... | |
__global__ void | init_overlap_output (SeqInfo *info, Int2 *indexOut, size_t *freqOut, int *inputOffsets, int *outputOffsets, int n) |
generate initial output of overlap mode. More... | |
__global__ void | toInt3 (char *inputs, unsigned int *offsets, Int3 *output, int n) |
generate Int3 sequence representation from allStr More... | |
__global__ void | toInt3 (char *inputs, unsigned int *offsets, SeqInfo *seqInfo, Int3 *output, int n) |
generate Int3 sequence representation from allStr, filtered by seqInfo More... | |
Variables | |
const size_t | MAX = INT_MAX |
A collection of most GPU parallel primitives that is implemented as CUDA kernel (most map and expand operations).
Follows Facade design pattern.
#define MIN3 | ( | a, | |
b, | |||
c | |||
) | ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c))) |
__global__ void cal_combination_len | ( | Int3 * | input, |
int | distance, | ||
int * | output, | ||
int | n | ||
) |
precalculate the number of positions required in the output array of generate combination operation.
input | sequences to generate combination |
distance | Levenshtein threshold |
output | position output for each sequence |
n | array length of input and output |
__global__ void cal_distance | ( | char * | allStr, |
unsigned int * | offsets, | ||
Int2 * | index, | ||
SeqInfo * | seqInfo, | ||
int * | seqOffset, | ||
int | distance, | ||
char | measure, | ||
char * | distanceOutput, | ||
char * | flagOutput, | ||
int | n, | ||
int | seqLen | ||
) |
calculate distances of strings from given pairs and flag ones exceeding the threshold.
allStr | container of all sequences |
offsets | start/end position of each sequence |
index | pairs of sequence to calculate |
seqInfo | info to lookup originalIndex |
seqOffset | offset to lookup seqInfo |
distance | Levenshtein/Hamming distance threshold |
measure | enum representing Levenshtein/Hamming |
distanceOutput | output distance, maybe null |
flagOutput | array output flag |
n | array length of index |
seqLen | array length of seq |
__global__ void cal_distance | ( | char * | allStr, |
unsigned int * | offsets, | ||
Int2 * | index, | ||
int | distance, | ||
char | measure, | ||
char * | distanceOutput, | ||
char * | flagOutput, | ||
int | n, | ||
int | seqLen | ||
) |
__global__ void cal_pair_len | ( | int * | inputRange, |
int * | outputRange, | ||
int | n | ||
) |
precalculate the output range of generate pair operation.
inputRange | range of each input group |
outputRange | range of each output group |
n | array length of inputRange and outputRange |
__global__ void cal_pair_len_diag | ( | int * | inputRange, |
int * | outputRange, | ||
int | n | ||
) |
precalculate the output range of pair generation in diagonal position for overlap mode.
inputRange | range of each input group |
outputRange | range of each output group |
n | array length of inputRange and outputRange |
__global__ void cal_pair_len_lowerbound | ( | int * | indexes, |
int * | inputOffsets, | ||
int * | outputLengths, | ||
int | lowerbound, | ||
int | n | ||
) |
precalculate the number of positions required in the output array of generate pair operation with lower bound constratint.
indexes | value of seqIndexes to generate pair |
inputOffsets | group offsets |
outputLengths | output position requirement |
lowerbound | the processing limit for the indexes |
n | array length |
__global__ void cal_pair_len_nondiag | ( | Int2 * | pairs, |
int * | seqOffset, | ||
int * | outputRange, | ||
int | n | ||
) |
precalculate the output range of pair generation in diagonal position for overlap mode.
pairs | pairs of sequences |
seqOffset | range of each input group |
outputRange | range of each output group |
n | array length of inputRange and outputRange |
__global__ void flag_lowerbound | ( | int * | valueInput, |
int * | valueOffsets, | ||
char * | output, | ||
int | lowerbound, | ||
int | n | ||
) |
flag data to be removed after the lower bound has been processed.
This includes both useless group and processed rows.
valueInput | seqIndex input |
valueOffsets | group offset |
output | flag output |
lowerbound | the lowerbound used |
n | array length of valueOffsets |
__global__ void gen_assignment | ( | int * | matrix, |
int * | output, | ||
int | nBit, | ||
int | nRow, | ||
int | nColumn | ||
) |
expand operation part of solving bin packing for 2D buffer.
matrix | statistics of all chunks where each row record the histogram count of each chunk and nRow=nChunk |
output | assignment of each chunk to the bins |
nBit | bin capacity expressed in log2 form |
nRow | number of rows of the matrix |
nColumn | number of columns of the matrix |
__global__ void gen_bounds | ( | size_t * | matrix, |
int * | keyOut, | ||
int * | valueOut, | ||
int | nBit, | ||
int | valueMax, | ||
int | nRow, | ||
int | nColumn | ||
) |
expand operation part of solving bin packing for lower bound.
matrix | statistics of all chunks where each row record the histogram count of each chunk and nRow=nChunk |
keyOut | the regrouping of each bin |
valueOut | the upper bound of each grouped bin |
nBit | bin capacity expressed in log2 form |
valueMax | last sequence index |
nRow | number of rows of the matrix |
nColumn | number of columns of the matrix |
__global__ void generate_pairs | ( | int * | indexes, |
Int2 * | outputs, | ||
int * | inputOffsets, | ||
int * | outputOffsets, | ||
int * | lesserIndex, | ||
int | lowerbound, | ||
int | carry, | ||
int | n | ||
) |
combinatorially generate pairs of indexes within the same group.
indexes | value of seqIndexes to generate pair |
outputs | pairs output |
inputOffsets | precalculated group offsets |
outputOffsets | precalculated output position requirement |
lesserIndex | by partial output for histogram |
lowerbound | the processing limit for the indexes |
carry | latest offset from previous chunk in the stream |
n | array length of inputOffsets and outputOffsets |
__global__ void generate_smaller_index | ( | int * | indexes, |
int * | outputs, | ||
int * | inputOffsets, | ||
int * | outputOffsets, | ||
int | carry, | ||
int | n | ||
) |
combinatorially generate pairs of indexes within the same group but record only the partial output.
indexes | value of seqIndexes to generate pair |
outputs | smaller index output |
inputOffsets | precalculated group offsets |
outputOffsets | precalculated output position requirement |
carry | latest offset from previous chunk in the stream |
n | array length of inputOffsets and outputOffsets |
__device__ char hamming | ( | char * | allStr, |
unsigned int | start1, | ||
unsigned int | start2, | ||
int | len1, | ||
int | len2 | ||
) |
calculate Hamming distance of 2 strings in GPU.
allStr | database of all sequences |
start1 | start index of string one |
start2 | start index of string two |
len1 | length of string one |
len2 | length of string two |
__global__ void init_overlap_output | ( | SeqInfo * | info, |
Int2 * | indexOut, | ||
size_t * | freqOut, | ||
int * | inputOffsets, | ||
int * | outputOffsets, | ||
int | n | ||
) |
generate initial output of overlap mode.
info | information of each sequence |
indexOut | repertoire pair output |
freqOut | frequency output for the pair |
inputOffsets | index range of input to operate on |
outputOffsets | index range of output to operate on |
n | length of inputOffset and outputOffset |
__device__ char levenshtein | ( | char * | allStr, |
unsigned int | start1, | ||
unsigned int | start2, | ||
int | len1, | ||
int | len2 | ||
) |
calculate Levenshtein distance of 2 strings in GPU where len1>18 or len2>18.
allStr | database of all sequences |
start1 | start index of string one |
start2 | start index of string two |
len1 | length of string one |
len2 | length of string two |
__device__ char levenshtein_static | ( | char * | allStr, |
unsigned int | start1, | ||
unsigned int | start2, | ||
int | len1, | ||
int | len2 | ||
) |
calculate Levenshtein distance of 2 strings in GPU where len1,len2<=18.
allStr | database of all sequences |
start1 | start index of string one |
start2 | start index of string two |
len1 | length of string one |
len2 | length of string two |
__global__ void make_row_index | ( | int * | output, |
int | n, | ||
int | nRepeat | ||
) |
utility to generate keys for matrix processing.
output | key output with range 0 to n-1 each repeating nRepeat time |
n | number of rows |
nRepeat | number of columns |
__global__ void pair2rep | ( | Int2 * | pairs, |
Int2 * | indexOut, | ||
size_t * | freqOut, | ||
SeqInfo * | seqInfo, | ||
int * | inputOffsets, | ||
int * | outputOffsets, | ||
int | n | ||
) |
turning pairs and frequencies from sequence format to repertoire format.
pairs | pair result from nearest neighbor search |
indexOut | repertiore pair output |
freqOut | frequency output |
seqInfo | information of each CDR3 sequence |
inputOffsets | seqInfo Offset |
outputOffsets | output range of indexOut and freqOut |
n | number of pairs |
__global__ void toInt3 | ( | char * | inputs, |
unsigned int * | offsets, | ||
Int3 * | output, | ||
int | n | ||
) |
__global__ void toSizeT | ( | int * | input, |
size_t * | output, | ||
int | n | ||
) |
utility to cast types.
input | input array |
output | output array |
n | number of rows |
T transfer_last_element | ( | T * | deviceArr, |
int | n | ||
) |
transfer last element of the GPU array to main memory.
deviceArr | the GPU array |
n | array length |
const size_t MAX = INT_MAX |