并行暴力算法GPU

时间:2016-11-17 19:32:16

标签: gpu gpgpu brute-force

我已经在Python中实现了并行BF生成器,就像在这篇文章中一样! Parallelize brute force generation

我想在GPU上实现这种并行技术。应该像GPU上的并行BF Generator一样。

有人可以帮我解决GPU上并行BF Generator的一些代码示例吗?

无法在网上找到任何令我怀疑的例子。

1 个答案:

答案 0 :(得分:0)

看看这个实现 - 我使用以下代码在GPU上进行了分发:

void IncBruteGPU( unsigned char* theBrute, unsigned int charSetLen, unsigned int bruteLength, unsigned int incNr){
    unsigned int i = 0;
    while(incrementBy > 0 && i < bruteLength){
        int add = incrementBy + ourBrute[i];
        ourBrute[i] = add % charSetLen;
        incrementBy = add / charSetLen;
        i++;
    }
}

这样称呼:

// the Thread index number    
int idx = get_global_id(0);

// the length of your charset "abcdefghi......"
unsigned int charSetLen = 26;

// the length of the word you want to brute
unsigned int bruteLength = 6; 

// theBrute keeps the single start numbers of the alphabeth
unsigned char theBrute[MAX_BRUTE_LENGTH];

IncrementBruteGPU(theBrute, charSetLen, bruteLength, idx);

祝你好运!