호스트 프로그램의 구조 int main(){cl_platform_id* cl_device_type cl_device_id cl_context cl_command_queue cl_programcl_kernelcl_mem cl_int err;cl_uint num_platforms;cl_uint num_dev=0; // 플랫폼 ID 얻기 (Device 확인, 정보 가져오기) cl_int clGetPlatformIDs( cl_uint num_entries, (플랫폼 수) cl_platform_id *platforms, (플랫폼 정보를 담을 구조체 리스트) cl_uint *num_platforms) (플랫폼 갯수를 담을 변수) // 플랫폼 정보 언기cl_int clGetPlatformInfo( cl_platform_id platform.. 더보기 Hello OpenCL // int val[2] = {1,2}를 입력으로 받아서 val = { 2,1 } 로 값을 변환하여 주는 예제프로그램이다.// test platform : Visual Studio 2008 + ati stream sdk beta2.0 #include #include #include // error check macro : utility#define CHECK_CL_ERROR(retcode, msg, exit_label) { \if (retcode != CL_SUCCESS) { \printf(msg); printf("\n"); \goto exit_label; \}\} int main(){cl_int input[2]= {1, 2}; cl_int output[2]= {}; cl_contextcontext = .. 더보기 데이터 형 OpenCL은 C언어를 기반으로 하는 기술이기 떄문에C언어에서 벡터화가 추가되는 정도이다.컴파일은 C99를 기반으로 하고있다. I. 스칼라 데이터형 OpenCL Type API Type Description bool true (1) or false (0) char cl_char 8-bit signed unsigned char, uchar cl_uchar 8-bit unsigned short cl_short 16-bit signed unsigned short, ushort cl_ushort 16-bit unsigned int cl_int 32-bit signed unsigned int, uint cl_uint 32-bit unsigned long cl_long 64-bit signed unsigned lo.. 더보기 이전 1 ··· 6 7 8 9 10 11 12 ··· 63 다음