[ https://issues.apache.org/jira/browse/MAHOUT-1885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15824865#comment-15824865 ]
ASF GitHub Bot commented on MAHOUT-1885: ---------------------------------------- Github user andrewpalumbo commented on a diff in the pull request: https://github.com/apache/mahout/pull/261#discussion_r96336102 --- Diff: viennacl/src/main/scala/org/apache/mahout/viennacl/opencl/GPUMMul.scala --- @@ -0,0 +1,455 @@ +/* + * 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.viennacl.opencl + +import org.apache.mahout.logging._ +import org.apache.mahout.math +import org.apache.mahout.math._ +import org.apache.mahout.math.flavor.{BackEnum, TraversingStructureEnum} +import org.apache.mahout.math.function.Functions +import org.apache.mahout.math.scalabindings.RLikeOps._ +import org.apache.mahout.math.scalabindings._ +import org.apache.mahout.viennacl.opencl.javacpp.Functions._ +import org.apache.mahout.viennacl.opencl.javacpp.LinalgFunctions._ +import org.apache.mahout.viennacl.opencl.javacpp.{CompressedMatrix, Context, DenseRowMatrix} + +import scala.collection.JavaConversions._ + +object GPUMMul extends MMBinaryFunc { + + private final implicit val log = getLog(GPUMMul.getClass) + + override def apply(a: Matrix, b: Matrix, r: Option[Matrix]): Matrix = { + + require(a.ncol == b.nrow, "Incompatible matrix sizes in matrix multiplication.") + + val (af, bf) = (a.getFlavor, b.getFlavor) + val backs = (af.getBacking, bf.getBacking) + val sd = (af.getStructure, math.scalabindings.densityAnalysis(a), bf.getStructure, densityAnalysis(b)) + + + try { + + val alg: MMulAlg = backs match { + + // Both operands are jvm memory backs. + case (BackEnum.JVMMEM, BackEnum.JVMMEM) ⇒ --- End diff -- Agreed (obviously this is an old comment due to my underestimation of what a move across the country and a new job can do to you + a nephew destroying my Mahout machine)- I don't like keeping both modules around but, quoting myself from 6 months ago: > We may be able to get away with only one Viennacl module by setting an environment variable and checking for it in Context.scala if it exists we "#define VIENNACL_WITH_OPENCL" which will make the module OpenMP only. The Problem With This Is That We Can't Test GPU in this module.. without checking for the environment var. I guess the above is a possibility, but not especially simple. For no, though all tests are passing.. though i am seeing that some of the eg. spark tests are not running `GPUMmul` when Built for `-Pviennacl`. So I may need to fix some imports somewhere. Either way I 'd like to get the base Architecture nailed down with this release. > 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)