gpt4 book ai didi

推力 : how to implement priority queue 上的 CUDA

转载 作者:行者123 更新时间:2023-12-03 20:55:52 33 4
gpt4 key购买 nike

我的计划是使用 Pearsons 相关性计算距离矩阵,并从距离矩阵中为每个节点 (q=ln(n)) 获取 q-最近邻,并将它们放入结果向量中。我在 C++ 中使用相关函数循环内的 STL 优先级队列来完成它。

但是你认为,有什么办法可以在 GPU 中做到这一点吗?

  • 谁能帮助我,我如何在 GPU 中做同样的事情(可能 推力 对我来说会更容易!)
  • 如何在 GPU 中实现优先级队列?

  • 这是我的 CPU(C++ STL)代码:

    例如,

    距离矩阵
    ----------------------
    0 3 2 4
    3 0 4 5
    2 4 0 6
    ......

    在对象向量中输出
    ==================

    源目标权重
    --------------------------------
    0 2 2
    0 1 3 ....(按边权重排序)

    1 0 3
    1 2 4

    2 0 2
    ......

    calculatePearsonCorrelation(float vector1[], float vector2[], int m) {
    //浮点距离Pearson(vector vector1, vector vector2){

    诠释我;
    float a=0,b=0,c=0,d=0, e = 0, sumX=0, sumY=0;

    //m = vector1.size();

    for(i=0;iq){
    MIN=pqx.top().get_corr();
    if(corr::iterator it = qNNVector.begin(); it!=qNNVector.end();++it) {
    输出

    最佳答案

    您是否尝试过使用 Thrust's sort ?你可以读出前 q 个元素。如果有足够的元素,您可能会看到不错的加速。

    关于推力 : how to implement priority queue 上的 CUDA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4237323/

    33 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com