File tree Expand file tree Collapse file tree 3 files changed +51
-2
lines changed
src/main/scala/com/thoughtworks/compute
gpu/src/main/scala/com/thoughtworks/compute Expand file tree Collapse file tree 3 files changed +51
-2
lines changed Original file line number Diff line number Diff line change 1
1
enablePlugins(Example )
2
+
3
+ import scala .meta ._
4
+ exampleSuperTypes := exampleSuperTypes.value.map {
5
+ case ctor " _root_.org.scalatest.FreeSpec " =>
6
+ ctor " _root_.org.scalatest.AsyncFreeSpec "
7
+ case otherTrait =>
8
+ otherTrait
9
+ }
10
+
11
+ libraryDependencies += (" org.lwjgl" % " lwjgl" % " 3.1.6" % Test ).jar().classifier {
12
+ import scala .util .Properties ._
13
+ if (isMac) {
14
+ " natives-macos"
15
+ } else if (isLinux) {
16
+ " natives-linux"
17
+ } else if (isWin) {
18
+ " natives-windows"
19
+ } else {
20
+ throw new MessageOnlyException (s " lwjgl does not support $osName" )
21
+ }
22
+ }
23
+
24
+ fork := true
Original file line number Diff line number Diff line change @@ -4,6 +4,24 @@ import com.thoughtworks.feature.Factory
4
4
import com .typesafe .scalalogging .StrictLogging
5
5
import org .lwjgl .opencl .CL10 .CL_DEVICE_TYPE_CPU
6
6
7
+ /** Contains N-dimensional array types on GPU.
8
+ *
9
+ * You may want to import [[Tensor ]], which is the base type of N-dimensional arrays:
10
+ *
11
+ * {{{
12
+ * import com.thoughtworks.compute.cpu.Tensor
13
+ * }}}
14
+ *
15
+ * @example In Compute.scala, an N-dimensional array is typed as [[Tensor ]],
16
+ * which can be created from [[scala.collection.Seq ]] or [[scala.Array ]].
17
+ *
18
+ * {{{
19
+ * val my2DArray: Tensor = Tensor(Array(Seq(1.0f, 2.0f), Seq(3.0f, 4.0f)))
20
+ *
21
+ * my2DArray.toString should be("[[1.0,2.0],[3.0,4.0]]")
22
+ * }}}
23
+ *
24
+ */
7
25
object cpu
8
26
extends StrictLogging
9
27
with Tensors .UnsafeMathOptimizations
Original file line number Diff line number Diff line change 1
1
package com .thoughtworks .compute
2
2
3
- import com .thoughtworks .feature .Factory
4
3
import com .typesafe .scalalogging .StrictLogging
5
- import org .lwjgl .opencl .CL10 .CL_DEVICE_TYPE_CPU
6
4
5
+ /** Contains N-dimensional array types on CPU.
6
+ *
7
+ * All the usage of this [[gpu ]] object is same as [[cpu ]], except the `import` statement:
8
+ *
9
+ * {{{
10
+ * import com.thoughtworks.compute.gpu._
11
+ * }}}
12
+ *
13
+ * @see [[cpu ]] for Usage.
14
+ */
7
15
object gpu
8
16
extends StrictLogging
9
17
with Tensors .UnsafeMathOptimizations
You can’t perform that action at this time.
0 commit comments