kernel launch from __device__ or __global__ functions requires separate compilation mode错误解决办法

cuda基于的环境是win10+cuda10.0+visual studio 2017

在编译cuda代码时出现如下错误

Severity	Code	Description	Project	File	Line	Suppression State
Error		kernel launch from __device__ or __global__ functions requires separate compilation mode	RayTracingDefination	D:\program\qt\RayTracing\RayTracingDefination\kernel.cu	637	

原因分析

  • 使用动态并行时需要额外的设置

解决方法

  1. 设置rdc为true
    kernel launch from __device__ or __global__ functions requires separate compilation mode错误解决办法_第1张图片
  2. 添加依赖项cudadevrt.libkernel launch from __device__ or __global__ functions requires separate compilation mode错误解决办法_第2张图片

你可能感兴趣的:(CUDA,C++,cuda,vs)