小编Max*_*x K的帖子

将 cuBLAS 与 Thrust 中的复数结合使用

在我的代码中,我使用推力库中的复数数组,我想使用 cublasZgeam() 来转置数组。

使用 cuComplex.h 中的复数并不是一个更好的选择,因为我对数组进行了大量算术运算,并且 cuComplex 没有定义的运算符,例如 * +=。

这就是我定义要转置的数组的方式

thrust::complex<float> u[xmax][xmax];
Run Code Online (Sandbox Code Playgroud)

我找到了这个https://github.com/jtravs/cuda_complex,但这样使用它:

#include "cuComplex.hpp"
Run Code Online (Sandbox Code Playgroud)

使用 nvcc 编译时不允许我使用提到的运算符

error: no operator "+=" matches these operands
        operand types are: cuComplex += cuComplex
Run Code Online (Sandbox Code Playgroud)

有什么解决办法吗?github 上的代码很旧,可能存在问题,或者可能是我使用错误

编辑:这是有效的代码,与talonmies代码的唯一区别是添加简单的内核和指向相同数据的指针,但推力::复杂

#include <iostream>
#include <thrust/fill.h>
#include <thrust/complex.h>
#include <cublas_v2.h>

using namespace std;

__global__ void test(thrust::complex<double>* u) {

  u[0] += thrust::complex<double>(3.3,3.3);
}

int main()
{
  int xmax = 100;
  thrust::complex<double>  u[xmax][xmax];
  double arrSize = sizeof(thrust::complex<double>) * xmax * xmax;

  thrust::fill(&u[0][0], &u[0][0] + (xmax * xmax), …
Run Code Online (Sandbox Code Playgroud)

c++ cuda thrust cublas

0
推荐指数
1
解决办法
2887
查看次数

GTX 1070中的FP64 CUDA内核数量

我找到了有关特斯拉P100每个SM包含多少CUDA核心的信息.它的64*FP32和32*FP64.我无法找到GTX 1070的任何数字.

也是后续问题.由于特斯拉的核心比例为1:2,这意味着双精度性能是单精度内核性能的最大值的一半吗?

hardware cuda gpu

-1
推荐指数
1
解决办法
602
查看次数

标签 统计

cuda ×2

c++ ×1

cublas ×1

gpu ×1

hardware ×1

thrust ×1