我实现了一个平行的BF发生器在Python想在这个帖子! Parallelize brute force generation。
我想要实现对GPU这种并行技术。应该像在GPU上的并联BF发生器。
有人可以帮我与一个GPU并行BF生成一些代码的例子吗?
未能在网上找到这让我怀疑任何的例子。
看看这个实现 - 我做了这段代码的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);
祝好运!