4

The encog-core-java master branch no longer has a Encog.getInstance().getCL() method, or explicit access to the OpenCL devices (c.f. LeadTune's encog-java example: BenchmarkCL based on Encog 2).

Instead, we seem to be referred to the ConcurrentTrainingManager which magically detects GPUs along with the CPUs, though the implementation of this is very unclear.

The only other mention of OpenCL in the source code is in ResilientPropagation, where the OpenCL device object is claimed to be an optional constructor parameter, but it is not.

Does anyone know if OpenCL support has simply been removed from Encog without updating the JavaDocs? Better yet, could anyone please provide a working example of OpenCL-backed machine learning on Encog 3.x?

My attempt to submit a TrainingJob to the ConcurrentTrainingManager failed because I couldn't figure out how to set a training Strategy for my RPROPJob.

Inon
  • 2,106
  • 3
  • 12
  • 17
  • 2
    I'll just say this (only because jeff mentioned dl4j): We aren't going to support opencl either. We have the on staff expertise to do gpus. What we *don't* have is the incentives. AMD has a lot more work to do make this worth anyone's time to do. They took a step towards that recently but it's still not a ton. – Adam Gibson Jul 11 '17 at 10:40
  • 2
    @AdamGibson, I don't think this is an AMD issue. This is an Open Source issue. While true that nVidia currently controls the GPU market, their CUDA is not an open source standard. OpenCL is. So will HiP, OpenCL's planned successor, who's syntax is unmistakably CUDA-esque. – Inon Jul 11 '17 at 12:59
  • 1
    @AdamGibson I agree with Inon here: OpenCL is an **open** standard, and can be used with AMD GPUs and CPUs (!), but also with Intel CPUs and NVIDIA GPUs - heck, even with android devices. It's rather so that NVIDIA does not have an incentive to improve their OpenCL support: They're comfortable with their nearly-monopoly of CUDA. Besides that, the APIs are so strikingly similar for common tasks that the main difference between OpenCL and CUDA boils down to the first being open and the latter being proprietary - it's not so much about *technical* differences. – Marco13 Jul 11 '17 at 23:54
  • 1
    An addendum: Of course, NVIDIA has one *really* valuable asset in this regard, namely, the runtime libraries (CUBLAS etc) - which may be relevant for dl4j. However, @Inon: I know that Encog once had a CL backend, which was based on JOCL from jocl.org - I'm not sure why they removed it, but am not familiar with Encog in general. It could certainly be interesting to try and revive the CL backend. If I only had more time... – Marco13 Jul 11 '17 at 23:58
  • @Marco13 if you want a *working* OpenCL implementation of neural networks on JVM, you can use [Neural Networks](https://github.com/ivan-vasilev/neuralnetworks) from Ivan Vasilev – Inon Sep 13 '17 at 18:46

1 Answers1

3

In response to my corresponding GH issue, Jeff Heaton wrote:

OpenCL is not currently supported by Encog. GPU programming is not something I am currently working on. If someone would like to contribute something in this area, that would be great. But there is already a great deal of neural network GPU work going on in TensorFlow and Deeplearning4J, I am not going to try to duplicate that myself. Additionally, GPU programming is outside of my area of expertise.

As an alternative, I recommend Ivan Vasilev's Neural Networks, which I've verified with OpenCL 2.

Inon
  • 2,106
  • 3
  • 12
  • 17
  • 1
    FYI: To hopefully eliminate some confusion, I updated the Encog GPU page to reflect the latest version of Encog's non-support of GPU. http://www.heatonresearch.com/encog/encog_gpu.html – JeffHeaton Jul 12 '17 at 18:45