Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/10.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-内存分配崩溃_Cuda - Fatal编程技术网

cuda-内存分配崩溃

cuda-内存分配崩溃,cuda,Cuda,好的,我试图在gpu上分配一个结构数组,它崩溃了(给出停止工作的消息) 这是结构: typedef struct point_t { int id; float x, y; } point; 这是cuda代码的一部分: cudaError_t d_LoadPoints(point* points, int n , int chunkSize){ // Error code to check return values for CUDA calls c

好的,我试图在gpu上分配一个结构数组,它崩溃了(给出停止工作的消息)

这是结构:

typedef struct point_t {
int id;
float x, y;
} point;
这是cuda代码的一部分:

    cudaError_t d_LoadPoints(point* points, int n , int chunkSize){  
        // Error code to check return values for CUDA calls
        cudaError_t err = cudaSuccess;

         int nBytes = n * sizeof(point);

        // Allocate the device input points array
        point* d_points;
        err = cudaMalloc((void** )&d_points, nBytes);


    if (err != cudaSuccess)
   {
    fprintf(stderr, "Failed to allocate device vector points (error code %s)!\n", cudaGetErrorString(err));
    exit(EXIT_FAILURE);
   }


    cudaMemcpy(d_points,points ,nBytes ,cudaMemcpyHostToDevice);
    puts("memory allocated successfully");

}
我试着打印
数组的第一个元素,以及
n
chunksize
,结果正确

这是它似乎崩溃的点(我禁用了其余部分)。 无论调试打印如何,它都会崩溃

我唯一能想到的就是尺寸

n
是250000,
chunksize
是64000,我计划分配给125个块,每个块有512个线程


我不知道这是不是一个好主意,但这是一个次要的话题,因为我可以;甚至无法访问内核调用。

重新启动visual studio修复了该问题