

Platforms = (cl_platform_id*)malloc(ret_num_platforms * sizeof(cl_platform_id)) Printf("%d Platforms Found\n", _LINE_, ret_num_platforms) Source_size = fread(source_str, 1, MAX_SOURCE_SIZE, fp) Ĭl_int ret = clGetPlatformIDs(0, NULL, &ret_num_platforms) Source_str = (char*)malloc(MAX_SOURCE_SIZE) Load the kernel source code into the array source_strįprintf(stderr, "Failed to load kernel.\n") Int* B = (int*)malloc(sizeof(int) * LIST_SIZE) Int* A = (int*)malloc(sizeof(int) * LIST_SIZE) Create two lists of numbers with the same number of elements We’ll start by writing some basic host-side C++ code (based off of GitHub – pratikone/OpenCL-learning-VS2012): #include You’ll be given a completely clean OpenCL project, with no code for either the OpenCL device (kernel) or the host: Name the project and choose a location to keep the solution, then click Create: I’m using the “Empty OpenCL Project for Windows” template: Next, create a new project in VS2019 using one of the newly added intel templates. This process created a directory in Program Files (x86) with the following contents:Īlthough Intel has a “Hello World” project sample within the samples_2020 directory, I’m choosing to instead create my own so I know how to set up a project from scratch. I opted to allow the installer to “Setup my IDE” automatically: I extracted the SDK from the zip file, and used the included install.exe binary to configure the SDK. I chose to use the Intel® SDK for OpenCL™ Applications, which is a free download:
