Skip to content

Commit

Permalink
Added CPP bridge libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
mandar2812 committed Dec 13, 2016
1 parent a4838d1 commit 265c8b3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 20 deletions.
13 changes: 12 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ lazy val commonSettings = Seq(
replDependency ++ loggingDependency ++
linearAlgebraDependencies ++ chartsDependencies ++
tinkerpopDependency ++ notebookInterfaceDependency ++
openMLDependency ++ rejinDependency ++ rPackages)
openMLDependency ++ rejinDependency ++
rPackages ++ cppCompatDependencies)/*,
scalacOptions ++= Seq("-Xplugin-require:scalaxy-streams", "-optimise", "-Yclosure-elim", "-Yinline"),
scalacOptions in Test ~= (_ filterNot (_ == "-Xplugin-require:scalaxy-streams")),
scalacOptions in Test += "-Xplugin-disable:scalaxy-streams",
autoCompilerPlugins := true,
addCompilerPlugin("com.nativelibs4java" % "scalaxy-streams_2.11" % "0.3.4")*/
)

lazy val pipes = (project in file("dynaml-pipes")).settings(baseSettings:_*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import breeze.linalg._
import io.github.mandar2812.dynaml.algebra.{PartitionedMatrix, PartitionedPSDMatrix}
import io.github.mandar2812.dynaml.utils
import org.apache.log4j.Logger
import scalaxy.streams.optimize

/**
* Defines an abstract class outlines the basic
Expand Down Expand Up @@ -122,23 +123,23 @@ object SVMKernel {

logger.info("~~~~~~~~~~~~~~~~~~~~~~~")
logger.info("Constructing Partitions")

new PartitionedPSDMatrix(
utils.combine(Seq(partitionedData, partitionedData))
.filter(c => c.head._2 >= c.last._2)
.toStream.map(c => {

val partitionIndex = (c.head._2.toLong, c.last._2.toLong)
logger.info(":- Partition: "+partitionIndex)

val matrix =
if(partitionIndex._1 == partitionIndex._2)
buildSVMKernelMatrix(c.head._1, c.head._1.length, eval).getKernelMatrix()
else crossKernelMatrix(c.head._1, c.last._1, eval)

(partitionIndex, matrix)
}), rows, cols, num_R_blocks, num_C_blocks)

optimize {
new PartitionedPSDMatrix(
utils.combine(Seq(partitionedData, partitionedData))
.filter(c => c.head._2 >= c.last._2)
.toStream.map(c => {

val partitionIndex = (c.head._2.toLong, c.last._2.toLong)
logger.info(":- Partition: "+partitionIndex)

val matrix =
if(partitionIndex._1 == partitionIndex._2)
buildSVMKernelMatrix(c.head._1, c.head._1.length, eval).getKernelMatrix()
else crossKernelMatrix(c.head._1, c.last._1, eval)

(partitionIndex, matrix)
}), rows, cols, num_R_blocks, num_C_blocks)
}
}

def crossPartitonedKernelMatrix[T, S <: Seq[T]](
Expand Down
10 changes: 9 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ object Dependencies {
"org.scala-graph" %% "graph-core" % "1.11.3",
"org.scalatest" % "scalatest_2.11" % "2.2.6" % "test",
"com.typesafe.akka" %% "akka-stream" % "2.4.6",
"com.github.scopt" % "scopt_2.11" % "3.5.0"
"com.github.scopt" % "scopt_2.11" % "3.5.0",
"com.nativelibs4java" % "scalaxy-streams_2.11" % "0.3.4" % "provided"
)

val apacheSparkDependency = Seq(
Expand Down Expand Up @@ -61,5 +62,12 @@ object Dependencies {
"org.renjin.cran" % "abc" % "2.1-b274"
)

val cppCompatDependencies = Seq(
"com.nativelibs4java" % "jnaerator" % "0.12",
"com.nativelibs4java" % "bridj" % "0.7.0",
"org.bytedeco" % "javacpp" % "1.3",
"org.bytedeco.javacpp-presets" % "tensorflow" % "0.11.0-1.3"
)

val notebookInterfaceDependency = Seq()
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.1.1")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.6.1")

//addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")
//addSbtPlugin("org.bytedeco" % "sbt-javacpp" % "1.9")

0 comments on commit 265c8b3

Please sign in to comment.