我已经在Python中实现了一个并行BF生成器,如本文中的Parallelize brute force generation所示。
我想在GPU上实现这种并行技术。应该像GPU上的并行BF生成器。
有人能帮我解决GPU上并行BF生成器的一些代码示例吗?
在网上找不到任何例子让我怀疑。
发布于 2016-11-21 15:57:50
看看这个实现-我用下面的代码在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);祝好运!
https://stackoverflow.com/questions/40663500
复制相似问题