关于CUDA学习中遇到的问题(一)
最近在学习CUDA并行编程中核函数
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
__global__ void HellowfromGPU( void ){
printf("hellow world from :%d\n", threadIdx.x);
if (threadIdx.x == 5){
printf("hellow world from thread 5\n");
}
}
int main(void ){
HellowfromGPU << <1, 10 >> >();
cudaDeviceReset();
//The function cudaDeviceReset() will explicitly destroy and clean up
//all resources associated with
//the current device in the current process.
}
结果:
问题:为什么hellow world from 5 会出现在最后而不是紧跟着 第五个helloworld呢??
问题:为什么删掉cudaDeviceReset();就没结果了??