Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cuda 致命错误:cub/cub.cuh:没有这样的文件或目录_Cuda_Gpu_Cub - Fatal编程技术网

Cuda 致命错误:cub/cub.cuh:没有这样的文件或目录

Cuda 致命错误:cub/cub.cuh:没有这样的文件或目录,cuda,gpu,cub,Cuda,Gpu,Cub,我是CUDA和CUB的新手。我找到了以下代码并试图编译它,但出现了以下错误: 致命错误:cub/cub.cuh:没有这样的文件或目录 CUDA的版本是7.0.27 如何修复此错误 谢谢 #include <cuda.h> #include <cub/cub.cuh> #include <stdio.h> int main(){ // Declare, allocate, and initialize device pointers for input

我是CUDA和CUB的新手。我找到了以下代码并试图编译它,但出现了以下错误: 致命错误:cub/cub.cuh:没有这样的文件或目录

CUDA的版本是7.0.27 如何修复此错误

谢谢

#include <cuda.h>
#include <cub/cub.cuh>
#include <stdio.h>

int main(){

  // Declare, allocate, and initialize device pointers for input and output
  int num_items = 7;
  int *d_in;
  int h_in[]  = {8, 6, 7, 5, 3, 0, 9};
  int sz = sizeof(h_in)/sizeof(h_in[0]);
  int *d_out; // e.g., [ , , , , , , ]
  cudaMalloc(&d_in,  sz*sizeof(h_in[0]));
  cudaMalloc(&d_out, sz*sizeof(h_in[0]));
  cudaMemcpy(d_in, h_in, sz*sizeof(h_in[0]), cudaMemcpyHostToDevice);
  printf("\nInput:\n");
  for (int i = 0; i < sz; i++) printf("%d ", h_in[i]);
  // Determine temporary device storage requirements
  void *d_temp_storage = NULL;
  size_t temp_storage_bytes = 0;
  cub::DeviceScan::InclusiveSum(d_temp_storage, temp_storage_bytes, d_in, d_out, num_items);
  // Allocate temporary storage
  cudaMalloc(&d_temp_storage, temp_storage_bytes);
  // Run inclusive prefix sum
  cub::DeviceScan::InclusiveSum(d_temp_storage, temp_storage_bytes, d_in, d_out, num_items);
// d_out s<-- [8, 14, 21, 26, 29, 29, 38]
  cudaMemcpy(h_in, d_out, sz*sizeof(h_in[0]), cudaMemcpyDeviceToHost);
  printf("\nOutput:\n");
  for (int i = 0; i < sz; i++) printf("%d ", h_in[i]);
  printf("\n");
  return 0;
}
#包括
#包括
#包括
int main(){
//为输入和输出声明、分配和初始化设备指针
int num_items=7;
int*d_in;
int h_in[]={8,6,7,5,3,0,9};
int sz=sizeof(h_in)/sizeof(h_in[0]);
int*d_out;//例如,[,,,]
cudaMalloc(&d_-in,sz*sizeof(h_-in[0]));
cudaMalloc(&d_out,sz*sizeof(h_in[0]));
cudaMemcpy(d_in,h_in,sz*sizeof(h_in[0]),cudaMemcpyHostToDevice);
printf(“\n输入:\n”);
对于(inti=0;i//d_out s首先,您应该升级到cuda 8。此错误致命错误:cub/cub.cuh,因为编译器找不到此文件。如果您使用cmake,必须通过命令include_directories添加cub目录,如果您使用IDE或其他工具,请尝试将cub目录添加到项目中。

您必须单独安装cub。它不包括使用cuda工具包进行uded。您可以获得CUB。请注意,cuda 7现在非常旧。您可能需要为此选择一个旧版本的CUB。