在cuda核函数中使用 __syncthreads()函数的时候出现题目的问题:

经过测试和visual studio版本,cuda版本均没有关系。

解决方法:


笔者的头文件包含为:

#include "cuda_runtime.h"
#include "device_launch_parameters.h"

修改为:

#ifndef __CUDACC__
#define __CUDACC__
#endif
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <cuda.h>
#include <device_functions.h>
#include <cuda_runtime_api.h>

更多推荐