Computer/GPGPU3 [CUDA] 병령 프로그래밍 1 다음은 두 Array의 합을 GPU로 구하는 간단한 코드이다.#include #define N 1000__global__ void add(int *a,int *b,int *c){ /* (1) */ int tid=blockIdx.x; if(tid 2014. 1. 14. [CUDA] Device 정보 Query 하기 1. Cuda 지원 디바이스 개수 조회 다음은 cuda 지원 디바이스 개수를 조회하는 API 이다.다음과 같이 사용한다.int count;cudaGetDeviceCount(&count); 2. Cuda 지원 디바이스 정보 조회다음은 cuda 지원 디바이스의 정보를 조회하는 API 이다. cudaDeviceProp 구조체는 다음의 URL에서 각 멤버에 대한 설명을 찾을 수 있다. http://docs.nvidia.com/cuda/cuda-runtime-api/structcudaDeviceProp.html#structcudaDeviceProp 다음과 같이 사용한다.cudeDeviceProp prop;cudaGetDeviceProperties(&prop,0); //여기에서 0은 Cuda 디바이스 Number이.. 2013. 10. 13. [CUDA] Hello World 다음은 CUDA를 이용하여 GPU(이하 Device)에서 Hello World 문자를 설정하고 이를 CPU(이하 Host)에서 출력하는 프로그램 예제이다. #include /* 1) */ __global__ void cudahelloworld(char *c){ int i=0; char *cudahello="hello world"; for(i=0;i 2013. 10. 9. 이전 1 다음