How to use this extension?
Install and open VS Code. Press Ctrl+Shift+X or Cmd+Shift+X to open the Extensions pane. Find and install the OpenCL extension. You can also install the extension from the Marketplace (Installation Guide). Open any .cl or .ocl file in VS Code to activate syntax highlighting, auto-completion, code snippets, API reference tooltips and document formatting for OpenCL kernel files. Open any file associated with C or C++ language in VS Code to activate code snippets for OpenCL host device functions.
The extension uses a set of tools to provide offline compilation and OpenCL devices/platforms information. By default ioc32/ioc64 offline compiler is used on Linux and Windows and openclc is used on macOS. This requires Intel OpenCL SDK [Windows, Linux] to be installed on the system. For macOS openclc should be a part of OpenCL.framework (shipped with XCode). It is possible to use another offline OpenCL compiler (see Customize Build Task for details).
Why doesn't
ioc32/ioc64work with#include?
-
Problem matcher doesn't work on Windows for kernal file with
#includestatements (#13)There are two workarounds:
- Override
options.cwdandproblemMatcherintasks.jsonaddingproblemMatcher.fileLocationlike this:
tasks.json
{ "type": "shell", "label": "opencl: custom build", "command": "ioc64", "options": { "cwd": "${workspaceFolder}/some_path" }, "args": [ "-cmd=build", "-input=\"main.cl\"" ], "problemMatcher": [ { "fileLocation": ["autoDetect", "${workspaceFolder}/some_path"], "pattern": { "regexp": "^(.*):(\\d+):(\\d+): ((fatal )?error|warning|Scholar): (.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 6 } } ], "group": "build" }- Another way is to modify
iocarguments intasks.json:
tasks.json
{ "type": "shell", "label": "opencl: custom build", "command": "ioc64", "args": [ "-cmd=build", "-input=\"${workspaceFolder}\\some_path\\main.cl\"", "-bo=\"-I ${workspaceFolder}\\some_path\"" ], "problemMatcher": [ "$opencl.common" ], "group": "build" }, - Override