|
1 | 1 | # Compute.scala
|
2 | 2 |
|
3 |
| -**Compute.scala** is a Scala library for scientific computing on N-dimensional arrays in parallel on GPU, CPU and other devices. It will be the primary back-end of the incoming [DeepLearning.scala](http://deeplearning.thoughtworks.school/) 3.0, to address performance problems we encountered in DeepLearning.scala 2.0 with [nd4j](http://nd4j.org/). |
| 3 | +**Compute.scala** is a Scala library for scientific computing with N-dimensional arrays in parallel on GPU, CPU and other devices. It will be the primary back-end of the incoming [DeepLearning.scala](http://deeplearning.thoughtworks.school/) 3.0, to address performance problems we encountered in DeepLearning.scala 2.0 with [nd4j](http://nd4j.org/). |
4 | 4 |
|
5 | 5 | * Compute.scala can dynamically merge multiple operators into one kernel program, which runs significantly faster when performing complex computation.
|
6 | 6 | * Compute.scala manages memory and other native resource in a determinate approach, consuming less memory.
|
|
9 | 9 |
|
10 | 10 | ## Getting started
|
11 | 11 |
|
12 |
| -TODO: |
| 12 | +### System Requirements |
| 13 | + |
| 14 | +Compute.scala is based on [LWJGL 3](https://www.lwjgl.org/)'s OpenCL binding, which supports AMD, NVIDIA and Intel's GPU and CPU on Linux, Windows and macOS. |
| 15 | + |
| 16 | +Make sure you have met the following system requirements before using Compute.scala. |
| 17 | + |
| 18 | + * Linux, Windows or macOS |
| 19 | + * JDK 8 |
| 20 | + * OpenCL runtime |
| 21 | + |
| 22 | +The performance of Compute.scala varies according to which OpenCL runtime you are using. For best performance, install OpenCL runtime according to the following table. |
| 23 | + |
| 24 | +| | Linux | Windows | macOS | |
| 25 | +| --- | --- | --- | --- | |
| 26 | +| NVIDIA GPU | [NVIDIA GPU Driver](http://www.nvidia.com/drivers) | [NVIDIA GPU Driver](http://www.nvidia.com/drivers) | macOS's built-in OpenCL SDK | |
| 27 | +| AMD GPU | [AMDGPU-PRO Driver](https://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Driver-for-Linux-Release-Notes.aspx) | [AMD OpenCL™ 2.0 Driver](https://support.amd.com/en-us/kb-articles/Pages/OpenCL2-Driver.aspx) | macOS's built-in OpenCL SDK | |
| 28 | +| Intel or AMD CPU | [POCL](http://portablecl.org/) | [POCL](http://portablecl.org/) | [POCL](http://portablecl.org/) | |
| 29 | + |
| 30 | +Especially, Compute.scala produces non-vectorized code, which needs POCL's auto-vectorization feature for best performance when running on CPU. |
| 31 | + |
| 32 | +### Project setup |
| 33 | + |
| 34 | +The artifacts of Compute.scala is published on Maven central repository for Scala 2.11 and 2.12. Add the following settings to your `build.sbt` if you are using [sbt](https://www.scala-sbt.org/). |
| 35 | + |
| 36 | +``` sbt |
| 37 | +libraryDependencies += "com.thoughtworks.compute" %% "cpu" % "latest.release" |
| 38 | +libraryDependencies += "com.thoughtworks.compute" %% "gpu" % "latest.release" |
| 39 | + |
| 40 | +// Platform dependent runtime of LWJGL core library |
| 41 | +libraryDependencies += ("org.lwjgl" % "lwjgl" % "latest.release" % Runtime).jar().classifier { |
| 42 | + import scala.util.Properties._ |
| 43 | + if (isMac) { |
| 44 | + "natives-macos" |
| 45 | + } else if (isLinux) { |
| 46 | + "natives-linux" |
| 47 | + } else if (isWin) { |
| 48 | + "natives-windows" |
| 49 | + } else { |
| 50 | + throw new MessageOnlyException(s"lwjgl does not support $osName") |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +Check [Compute.scala on Scaladex](https://index.scala-lang.org/thoughtworksinc/compute.scala) and [LWJGL customize tool](https://www.lwjgl.org/customize) for settings for other build tools. |
13 | 56 |
|
14 | 57 | ## Benchmark
|
15 | 58 |
|
16 | 59 | * [Compute.scala vs Nd4j on NVIDIA GPU](http://jmh.morethan.io/?source=https://thoughtworksinc.github.io/Compute.scala/benchmarks/nvidia-gpu.json)
|
17 | 60 | * [Compute.scala on AMD GPU](http://jmh.morethan.io/?source=https://thoughtworksinc.github.io/Compute.scala/benchmarks/amd-gpu.json)
|
18 |
| - |
19 |
| -## Supported platforms |
20 |
| - |
21 |
| -Compute.scala is based on OpenCL, supporting AMD, NVIDIA and Intel's GPU and CPU on Linux, Windows and macOS. |
|
0 commit comments