[
https://issues.apache.org/jira/browse/MAHOUT-1885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15567549#comment-15567549
]
ASF GitHub Bot commented on MAHOUT-1885:
----------------------------------------
Github user dlyubimov commented on a diff in the pull request:
https://github.com/apache/mahout/pull/261#discussion_r82933830
--- Diff:
math-scala/src/main/scala/org/apache/mahout/math/scalabindings/SolverFactory.scala
---
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.mahout.math.scalabindings
+
+import java.io.File
+
+import org.apache.mahout.logging._
+
+import scala.reflect.ClassTag
+import scala.reflect.runtime._
+import scala.reflect._
+
+
+class SolverFactory {
+
+ private final implicit val log = getLog(this.getClass)
+
+ // just temp for quick POC
+ val classMap: Map[String,String] =
+ Map(("GPUMMul"->"org.apache.mahout.viennacl.opencl.GPUMMul"),
+ ("OMPMMul"->"org.apache.mahout.viennacl.openmp.OMPMMul"))
+}
+object SolverFactory extends SolverFactory {
+
+ // default is JVM
+ var clazz: MMBinaryFunc = MMul
+
+ // eventually match on implicit Classtag . for now. just take as is.
+ // this is a bit hacky, Shoud not be doing onlytry/catch here..
+ def getOperator[C: ClassTag]: MMBinaryFunc = {
+
+ try {
+ println("creating org.apache.mahout.viennacl.opencl.GPUMMul
solver")
--- End diff --
I understand it is WIP. I imagined we should develop a concept of backends,
rather than binding to a concrete solver like this.
So backend = collection of available solvers for specific library. So for
VCL, there's just one Backend (if we ignore the fact that multiple platforms
may be present in either one or many VCL backend jars).
Backends are enumerated and managed by SolverFactory. So SolverFactory has
3 functions :
(1) probe and manage backends
(2) probe individual solver support in each of backeds and decide which one
to instantiate and return
(3) manage available solvers.
I imagine we won't do this initially, but we should leave enough
flexibility in this class OOA so that we could insert rules allowing choosing
among more than one active solver of the same type depending on additional
factors.
Such things may include situations when e.g., multiple backends are
available which do not share resources (i.e., gpu and host backends); or simple
calibration estimates when for smaller problem sizes host backends are more
efficient than device backends because they do not require problem repackaging
and transfer between host and the device.
> Inital Implementation of VCL Bindings
> -------------------------------------
>
> Key: MAHOUT-1885
> URL: https://issues.apache.org/jira/browse/MAHOUT-1885
> Project: Mahout
> Issue Type: Improvement
> Components: Math
> Affects Versions: 0.12.2
> Reporter: Andrew Palumbo
> Assignee: Andrew Palumbo
> Fix For: 0.13.0
>
>
> Push a working experimental branch of VCL bindings into master. There is
> still a lot of work to be done. All tests are passing, At the moment there
> am opening this JIRA mostly to get a number for PR and to test profiles
> against on travis.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)