OpenCL Plugin

OpenCL Plugin for Unreal Engine 4 (github)

Supported Platform:
OS X, Windows on Intel CPU/GPU, NVIDIA GPU.
I’ve tested on OS X 10.10.1 (Intel Ivy Bridge, GT 650M, GTX 980) and Windows 8.1.
All suggestions for other platforms are welcome.

Known Issues:
On windows, It’s failed to run editor on DebugGame mode.

Installation
Windows

  1. Install NVIDIA Graphics Driver and Intel OpenCL runtime.
  2. Copy “OpenCL” folder to “Plugins” folder under your project directory.

OS X

  1. Copy “OpenCL” folder to “Plugins” folder under your project directory.

Screenshots
Windows
opencl-ue4plugin-log-win.png

OS X
opencl-ue4plugin-log-win.png

Legal info
Unreal® is a trademark or registered trademark of Epic Games, Inc. in the United States of America and elsewhere. Unreal® Engine, Copyright 1998 – 2014, Epic Games, Inc. All rights reserved.
Plugin is completely free and available under MIT open-source license.

This would surely come in handy. Thanks for sharing!

Awesome, thanks for this!

Have you considered upgrading to OpenCL 2.0? Not super important, but I hear SVM can be handy :slight_smile:

And then he writes the drivers and infrastructure for OpenCL 2.0 on all that hardware for Windows and OS X all by himself? :wink:

It is easy to link with OpenCL on OS X because it’s already installed as a global framework.

But on windows it is not simple.
If you want to add/replace for other version or platform, you can replace the header files from the Khronos OpenCL Registry and the OpenCL.lib files in ThirdParty/OpenCL/Lib from OpenCL SDKs of the SDK providers (Intel/ATI/NVIDIA).
The OpenCL.lib files helps you to link with OpenCL.dll which installed on system with the drivers.
(It is not recommended to link with OpenCL.dll directly.)

In current state, NVIDIA’s OpenCL SDK supports OpenCL 1.1 on Windows and Apple’s SDK supports OpenCL 1.2

You’re right, that is a silly - I forgot the limited support.

Yeah, totally overlooked NVIDIA’s 1.1 support. Nevermind - this is still really great. I appreciate it!

EDIT: With OpenCL plugin added as a public dependency module, with the ‘OpenCL/Public’ path added to PublicIncludePaths, including cl.hpp leads to an include problem - cl.hpp, line 178 - where it fails on include <CL.opencl.h>, stating that it cannot be found. Have any of you succeeded in using the C++ wrapper?

I updated the plugin to resolve the include <CL/opencl.h> issue.
You don’t have to add “OpenCL/Public” to “PublicIncludePaths”.
You can include header files by add “OpenCL” to “PublicDependencyModuleNames”.

I have the latest NVIDIA driver, and I downloaded the Intel OpenCL runtime, I put in the OpenCL folder under my project inside a folder named Plugins, I have added OpenCL to my build.cs in PublicDependencyModuleNames, but when I build, and look for the plugin in the editor under window/plugins, I don’t see it.
Could you make a howto setup tutorial with a simple program that uses your plugin ? That would help a lot.


It will be under “Window>Plugins>Installed>Computing”.
See “OpenCLPlugin.cpp” for an example. It prints OpenCL device information.

BTW, I have some problems after I updated to 4.7.X.
I’ll fix it soon.

I updated the plugin.
I tested on UE 4.7.6 in OS X (10.10.3), Windows 8.1.

If you still have this problem, try to regenerate your project file.

Hey Kwonoh,

Any possibility of updating the OpenCL plugin to 4.10?

Just thought I would ask. :slight_smile:

Hi, I haven’t tried on 4.10
Let me know if it is not working on 4.10.

OpenCL is useless for UE4 as UE4 NVPhys implements this better. How about expanding this openCL plugin to actually be open, and thus to include AMD cards.

If you have lots of existing OpenCL codes then it is not useless :slight_smile:
For OS X, AMD cards are already available using this plugin. For Windows, I already explained how to add SDK provider specific *.lib files in Readme.

Also, PhsyX is a physics engine. For GPGPU in UE4, I believe that Compute Shader is the best option.

What is what the plugin does? i know what is gpgpu but, in this case it is applied to what? compiling? buliding lightmass?..

This plugin helps you to link with OpenCL, which is not straightforward. It does not add/change any feature to the engine.

Has anybody encountered a problem using file scope cl_kernel variables?