首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >并行布鲁特力算法GPU

并行布鲁特力算法GPU
EN

Stack Overflow用户
提问于 2016-11-17 19:32:15
回答 1查看 340关注 0票数 1

我已经在Python中实现了一个并行BF生成器,如本文中的Parallelize brute force generation所示。

我想在GPU上实现这种并行技术。应该像GPU上的并行BF生成器。

有人能帮我解决GPU上并行BF生成器的一些代码示例吗?

在网上找不到任何例子让我怀疑。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-21 15:57:50

看看这个实现-我用下面的代码在GPU上做了发行:

代码语言:javascript
复制
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++;
    }
}

就这样说吧:

代码语言:javascript
复制
// 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);

祝好运!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40663500

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档