Skip to content

Commit

Permalink
MAHOUT-1988 Make Native Solvers Scala 2.11 Complient closes #326
Browse files Browse the repository at this point in the history
  • Loading branch information
rawkintrevo committed Jun 26, 2017
1 parent e74c478 commit c17bee3
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 41 deletions.
38 changes: 19 additions & 19 deletions .travis.yml
Expand Up @@ -43,40 +43,40 @@ env:
matrix:
include:
# Build Spark 1.6.3 , Scala 2.10
- jdk: "oraclejdk7"
- jdk: "openjdk7"
env: PROFILES="${PROFILES}" SPARK_BIN=$SPARK_1_6

# Build Spark 2.0.2 , Scala 2.11 - replace -D... with profiles when available
- jdk: "oraclejdk7"
- jdk: "openjdk7"
env: PROFILES="${PROFILES} -Dspark.version=2.0.2 -Dscala.version=2.11.8 -Dscala.compat.version=2.11" SPARK_BIN=$SPARK_2_0

# Build Spark 2.1.0 , Scala 2.11 - replace -D... with profiles when available
- jdk: "oraclejdk7"
- jdk: "openjdk7"
env: PROFILES="${PROFILES} -Dspark.version=2.1.0 -Dscala.version=2.11.8 -Dscala.compat.version=2.11" SPARK_BIN=$SPARK_2_1

# Build Spark 1.6.3 , Scala 2.10, ViennaCL
- jdk: "oraclejdk7"
- jdk: "openjdk7"
env: PROFILES="${PROFILES} -Pviennacl" SPARK_BIN=$SPARK_1_6

# # Build Spark 2.0.2 , Scala 2.11, ViennaCL - replace -D... with profiles when available
# - jdk: "oraclejdk7"
# env: PROFILES="${PROFILES} -Dspark.version=2.0.2 -Dscala.version=2.11.8 -Dscala.compat.version=2.11 -Pviennacl"
#
# # Build Spark 2.1.0 , Scala 2.11, ViennaCL - replace -D... with profiles when available
# - jdk: "oraclejdk7"
# env: PROFILES="${PROFILES} -Dspark.version=2.1.0 -Dscala.version=2.11.8 -Dscala.compat.version=2.11 -Pviennacl"
# Build Spark 2.0.2 , Scala 2.11, ViennaCL - replace -D... with profiles when available
- jdk: "openjdk7"
env: PROFILES="${PROFILES} -Dspark.version=2.0.2 -Dscala.version=2.11.8 -Dscala.compat.version=2.11 -Pviennacl" SPARK_BIN=$SPARK_2_0

# Build Spark 2.1.0 , Scala 2.11, ViennaCL - replace -D... with profiles when available
- jdk: "openjdk7"
env: PROFILES="${PROFILES} -Dspark.version=2.1.0 -Dscala.version=2.11.8 -Dscala.compat.version=2.11 -Pviennacl" SPARK_BIN=$SPARK_2_1

# Build Spark 1.6.3 , Scala 2.10, ViennaCL-OMP
- jdk: "oraclejdk7"
- jdk: "openjdk7"
env: PROFILES="${PROFILES} -Pviennacl-omp" TEST_MODULES="${TEST_MODULES},viennacl-omp" SPARK_BIN=$SPARK_1_6

# # Build Spark 2.0.2 , Scala 2.11, ViennaCL-OMP - replace -D... with profiles when available
# - jdk: "oraclejdk7"
# env: PROFILES="${PROFILES} -Dspark.version=2.0.2 -Dscala.version=2.11.8 -Dscala.compat.version=2.11 -Pviennacl-omp" TEST_MODULES="${TEST_MODULES},viennacl-omp"
#
# # Build Spark 2.1.0 , Scala 2.11, ViennaCL-OMP - replace -D... with profiles when available
# - jdk: "oraclejdk7"
# env: PROFILES="${PROFILES} -Dspark.version=2.1.0 -Dscala.version=2.11.8 -Dscala.compat.version=2.11 -Pviennacl-omp" TEST_MODULES="${TEST_MODULES},viennacl-omp"
# Build Spark 2.0.2 , Scala 2.11, ViennaCL-OMP - replace -D... with profiles when available
- jdk: "openjdk7"
env: PROFILES="${PROFILES} -Dspark.version=2.0.2 -Dscala.version=2.11.8 -Dscala.compat.version=2.11 -Pviennacl-omp" TEST_MODULES="${TEST_MODULES},viennacl-omp" SPARK_BIN=$SPARK_2_0

# Build Spark 2.1.0 , Scala 2.11, ViennaCL-OMP - replace -D... with profiles when available
- jdk: "openjdk7"
env: PROFILES="${PROFILES} -Dspark.version=2.1.0 -Dscala.version=2.11.8 -Dscala.compat.version=2.11 -Pviennacl-omp" TEST_MODULES="${TEST_MODULES},viennacl-omp" SPARK_BIN=$SPARK_2_1

git:
depth: 10
Expand Down
Expand Up @@ -46,12 +46,22 @@ final class CompressedMatrix(defaultCtr: Boolean = true) extends Pointer {

if (defaultCtr) allocate()

def this(nrow: Int, ncol: Int, ctx: Context = new Context) {
def this(nrow: Int, ncol: Int) {
this(false)
allocate(nrow, ncol, new Context)
}

def this(nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(nrow, ncol, ctx)
}

def this(nrow: Int, ncol: Int, nonzeros: Int, ctx: Context = new Context) {
def this(nrow: Int, ncol: Int, nonzeros: Int) {
this(false)
allocate(nrow, ncol, nonzeros, new Context)
}

def this(nrow: Int, ncol: Int, nonzeros: Int, ctx: Context) {
this(false)
allocate(nrow, ncol, nonzeros, ctx)
}
Expand Down
Expand Up @@ -36,12 +36,24 @@ import org.bytedeco.javacpp.annotation._
@Name(Array("viennacl::matrix<double,viennacl::column_major>"))
final class DenseColumnMatrix(initDefault:Boolean = true) extends MatrixBase {

def this(nrow: Int, ncol: Int, ctx: Context = new Context()) {
def this(nrow: Int, ncol: Int) {
this(false)
allocate(nrow, ncol, new Context())
}

def this(nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(nrow, ncol, ctx)
}

def this(data: DoublePointer, nrow: Int, ncol: Int, ctx: Context = new Context(Context.MAIN_MEMORY)) {
def this(data: DoublePointer, nrow: Int, ncol: Int) {
this(false)
allocate(data, new Context(Context.MAIN_MEMORY).memoryType, nrow, ncol)
// We save it to deallocate it ad deallocation time.
ptrs += data
}

def this(data: DoublePointer, nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(data, ctx.memoryType, nrow, ncol)
// We save it to deallocate it ad deallocation time.
Expand Down
Expand Up @@ -13,12 +13,24 @@ import org.bytedeco.javacpp.annotation._
@Name(Array("viennacl::matrix<double,viennacl::row_major>"))
class DenseRowMatrix(initDefault: Boolean = true) extends MatrixBase {

def this(nrow: Int, ncol: Int, ctx: Context = new Context()) {
def this(nrow: Int, ncol: Int) {
this(false)
allocate(nrow, ncol, new Context())
}

def this(nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(nrow, ncol, ctx)
}

def this(data: DoublePointer, nrow: Int, ncol: Int, ctx: Context = new Context(Context.MAIN_MEMORY)) {
def this(data: DoublePointer, nrow: Int, ncol: Int) {
this(false)
allocate(data, new Context(Context.MAIN_MEMORY).memoryType, nrow, ncol)
// We save it to deallocate it ad deallocation time.
ptrs += data
}

def this(data: DoublePointer, nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(data, ctx.memoryType, nrow, ncol)
// We save it to deallocate it ad deallocation time.
Expand Down
Expand Up @@ -18,12 +18,12 @@ final class VCLVector(defaultCtr: Boolean = true) extends VectorBase {
allocate()
}

def this(i: Int){
def this(size: Int) {
this(false)
allocate(i)
allocate(size, new Context(Context.MAIN_MEMORY))
}

def this(size: Int, ctx: Context = new Context(Context.MAIN_MEMORY)) {
def this(size: Int, ctx: Context ) {
this(false)
allocate(size, ctx)
}
Expand All @@ -46,11 +46,20 @@ final class VCLVector(defaultCtr: Boolean = true) extends VectorBase {
// allocate(h, vec_size, vec_start, vec_stride)
// }

def this(ptr_to_mem: DoublePointer,
@Cast(Array("viennacl::memory_types"))mem_type : Int,
vec_size: Int) {

this(false)
allocate(ptr_to_mem, mem_type, vec_size, 0, 1)
ptrs += ptr_to_mem
}

def this(ptr_to_mem: DoublePointer,
@Cast(Array("viennacl::memory_types"))mem_type : Int,
vec_size: Int,
start: Int = 0,
stride: Int = 1) {
start: Int,
stride: Int) {

this(false)
allocate(ptr_to_mem, mem_type, vec_size, start, stride)
Expand Down
Expand Up @@ -46,12 +46,22 @@ final class CompressedMatrix(defaultCtr: Boolean = true) extends Pointer {

if (defaultCtr) allocate()

def this(nrow: Int, ncol: Int, ctx: Context = new Context) {
def this(nrow: Int, ncol: Int) {
this(false)
allocate(nrow, ncol, new Context)
}

def this(nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(nrow, ncol, ctx)
}

def this(nrow: Int, ncol: Int, nonzeros: Int, ctx: Context = new Context) {
def this(nrow: Int, ncol: Int, nonzeros: Int) {
this(false)
allocate(nrow, ncol, nonzeros, new Context)
}

def this(nrow: Int, ncol: Int, nonzeros: Int, ctx: Context) {
this(false)
allocate(nrow, ncol, nonzeros, ctx)
}
Expand Down
Expand Up @@ -36,12 +36,24 @@ import org.bytedeco.javacpp.annotation._
@Name(Array("viennacl::matrix<double,viennacl::column_major>"))
final class DenseColumnMatrix(initDefault:Boolean = true) extends MatrixBase {

def this(nrow: Int, ncol: Int, ctx: Context = new Context()) {
def this(nrow: Int, ncol: Int) {
this(false)
allocate(nrow, ncol, new Context())
}

def this(nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(nrow, ncol, ctx)
}

def this(data: DoublePointer, nrow: Int, ncol: Int, ctx: Context = new Context(Context.MAIN_MEMORY)) {
def this(data: DoublePointer, nrow: Int, ncol: Int ) {
this(false)
allocate(data, new Context(Context.MAIN_MEMORY).memoryType, nrow, ncol)
// We save it to deallocate it ad deallocation time.
ptrs += data
}

def this(data: DoublePointer, nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(data, ctx.memoryType, nrow, ncol)
// We save it to deallocate it ad deallocation time.
Expand Down
Expand Up @@ -31,12 +31,24 @@ import scala.collection.mutable.ArrayBuffer
@Name(Array("viennacl::matrix<double,viennacl::row_major>"))
class DenseRowMatrix(initDefault: Boolean = true) extends MatrixBase {

def this(nrow: Int, ncol: Int, ctx: Context = new Context()) {
def this(nrow: Int, ncol: Int) {
this(false)
allocate(nrow, ncol, new Context())
}

def this(nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(nrow, ncol, ctx)
}

def this(data: DoublePointer, nrow: Int, ncol: Int, ctx: Context = new Context(Context.MAIN_MEMORY)) {
def this(data: DoublePointer, nrow: Int, ncol: Int) {
this(false)
allocate(data, new Context(Context.MAIN_MEMORY).memoryType, nrow, ncol)
// We save it to deallocate it ad deallocation time.
ptrs += data
}

def this(data: DoublePointer, nrow: Int, ncol: Int, ctx: Context) {
this(false)
allocate(data, ctx.memoryType, nrow, ncol)
// We save it to deallocate it ad deallocation time.
Expand Down
Expand Up @@ -36,12 +36,12 @@ final class VCLVector(defaultCtr: Boolean = true) extends VectorBase {
allocate()
}

def this(i: Int){
def this(size: Int) {
this(false)
allocate(i)
allocate(size, new Context(Context.MAIN_MEMORY))
}

def this(size: Int, ctx: Context = new Context(Context.MAIN_MEMORY)) {
def this(size: Int, ctx: Context ) {
this(false)
allocate(size, ctx)
}
Expand All @@ -64,11 +64,20 @@ final class VCLVector(defaultCtr: Boolean = true) extends VectorBase {
// allocate(h, vec_size, vec_start, vec_stride)
// }

def this(ptr_to_mem: DoublePointer,
@Cast(Array("viennacl::memory_types"))mem_type : Int,
vec_size: Int) {

this(false)
allocate(ptr_to_mem, mem_type, vec_size, 0, 1)
ptrs += ptr_to_mem
}

def this(ptr_to_mem: DoublePointer,
@Cast(Array("viennacl::memory_types"))mem_type : Int,
vec_size: Int,
start: Int = 0,
stride: Int = 1) {
start: Int,
stride: Int) {

this(false)
allocate(ptr_to_mem, mem_type, vec_size, start, stride)
Expand Down

0 comments on commit c17bee3

Please sign in to comment.