Mặc dù tôi có một thẻ Fermi (GTX 560) Tôi nhận được lỗi này trên VS2010:CUDA 4.1 printf() Lỗi
error : calling a host function("printf") from a __device__/__global__ function("kernel") is not allowed
Code:
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
__global__ void kernel()
{
printf("hello");
}
int main()
{
kernel<<<1, 1>>>();
return 0;
}
Tôi có thiếu cái gì ở đây?
Cảm ơn rất nhiều! Trong VS2010 tôi đã thay đổi Project -> {Project Name} Properties-> CUDA C/C++ -> Device -> [Code Generation]: compute_10, sm_10 thành compute_20, sm_20 và nó hoạt động. – dvgvrco
Đối với thẻ của bạn, có lẽ bạn nên sử dụng sm_21, nhưng tôi không biết liệu nó có tạo ra sự khác biệt nhiều cho mã được phát ra bởi trình biên dịch hay không. – talonmies