The OpenCL™ Emulator-Debugger (ocl-emu) is an open source project originating at AMD that allows you to compile and debug OpenCL™ kernels as C++ procedures. The goal of the project is to provide OpenCL™ developers with the full support of Microsoft® Visual Studio® C++ development and debugging environments.
- Compile and debug code within Visual Studio
- Concentrate on your code rather than the intricacies of the OpenCL runtime, for example:
- For beginners – get a one-line call “Hello World” kernel
- For algorithm developers – you can focus on the massive parallel algorithm(s) rather than the OpenCL runtime
- Enable an easy switch from emulator, CPU or GPU devices for a correctness verification and performance tuning
- Avoid most OpenCL language compilation errors using the Visual Studio compiler as a syntactical checker
To get ocl-emu on your local machine and attach it to your application you must do the following:
- Download and install the latest AMD APP SDK
- Download the files below by browsing the source tree and place them in the same hierarchical level and under the same parent directory:
- Manually set the environment variable CLEMU_ROOT to point to the installation directory …\opencl_emu directory, for example:
- SET CLEMU_ROOT=C:\…\deopt\main\sw\advtech\tools\opencl_emu
- Find and compile the ocl-emu test solution located:
- The sample application with the debugger’s static libraries should compile out-of-the-box
Setting up a Solution
YOUR Application’s VS9 solution setup
The Microsoft Visual Studio is the recommended developing environment for this tool and requires these quick changes to configure the OpenCL Emulator.
Additional Include Directories:
From the Visual Studio window, go to: Project Properties -> C/C++ -> General and include the following new paths in the additional include directories:
Note: Users who had downloaded the ocl-emu before APP SDK 2.4 have to add environment variable: AMDAPPSDKROOT = %ATISTREAMSDKROOT%
Now go to “Preprocessor” tab in the same Project Properties window and add the following preprocessor
The code generation option would be selected depending upon the target application. For example if you’re building a Multi-threaded Debug application (not DLL) then you may select:
Multi-Threaded Debug (/MTd).
Now proceed to Configuration Properties -> Linker -> General and add the following as additional library directories:
Proceed to Linker -> Input and add the following as Additional Dependencies:
Your Visual Studio is now all set to run OpenCL Emu.
To build libraries and sample applications, use a solution file located under:
It does not require any changes and should correctly compile out of the box.