Repository: incubator-systemml Updated Branches: refs/heads/master 71013e758 -> 16e7b1c88
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/16e7b1c8/src/test/scripts/functions/compress/LinregCG.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/compress/LinregCG.R b/src/test/scripts/functions/compress/LinregCG.R new file mode 100644 index 0000000..1d69385 --- /dev/null +++ b/src/test/scripts/functions/compress/LinregCG.R @@ -0,0 +1,57 @@ +#------------------------------------------------------------- +# +# 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. +# +#------------------------------------------------------------- + + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + +X = readMM(paste(args[1], "X.mtx", sep="")) +y = readMM(paste(args[1], "y.mtx", sep="")) + +intercept = as.integer(args[2]); +eps = as.double(args[3]); +maxiter = as.double(args[4]); + +if( intercept == 1 ){ + ones = matrix(1, nrow(X), 1); + X = cbind(X, ones); +} + +r = -(t(X) %*% y); +p = -r; +norm_r2 = sum(r * r); +w = matrix(0, ncol(X), 1); + +i = 0; +while(i < maxiter) { + q = ((t(X) %*% (X %*% p)) + eps * p); + alpha = norm_r2 / ((t(p) %*% q)[1:1]); + w = w + alpha * p; + old_norm_r2 = norm_r2; + r = r + alpha * q; + norm_r2 = sum(r * r); + beta = norm_r2 / old_norm_r2; + p = -r + beta * p; + i = i + 1; +} + +writeMM(as(w,"CsparseMatrix"), paste(args[5], "w", sep="")) http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/16e7b1c8/src/test/scripts/functions/compress/LinregCG.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/compress/LinregCG.dml b/src/test/scripts/functions/compress/LinregCG.dml new file mode 100644 index 0000000..02d0fad --- /dev/null +++ b/src/test/scripts/functions/compress/LinregCG.dml @@ -0,0 +1,56 @@ +#------------------------------------------------------------- +# +# 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. +# +#------------------------------------------------------------- + + +X = read($1); +y = read($2); +intercept = $3; +eps = $4; +maxiter = $5; + +if( intercept == 1 ){ + ones = matrix(1, nrow(X), 1); + X = append(X, ones); +} + +r = -(t(X) %*% y); +p = -r; +norm_r2 = sum(r * r); +w = matrix(0, rows = ncol(X), cols = 1); + +i = 0; +while(i < maxiter) { + q = ((t(X) %*% (X %*% p)) + eps * p); + alpha = norm_r2 / castAsScalar(t(p) %*% q); + w = w + alpha * p; + old_norm_r2 = norm_r2; + r = r + alpha * q; + norm_r2 = sum(r * r); + beta = norm_r2 / old_norm_r2; + p = -r + beta * p; + i = i + 1; +} + +write(w, $6); + + + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/16e7b1c8/src/test/scripts/functions/compress/SystemML-config-compress.xml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/compress/SystemML-config-compress.xml b/src/test/scripts/functions/compress/SystemML-config-compress.xml new file mode 100644 index 0000000..0728ecc --- /dev/null +++ b/src/test/scripts/functions/compress/SystemML-config-compress.xml @@ -0,0 +1,59 @@ +<!-- + * 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. +--> + +<root> + <!-- local fs tmp working directory--> + <localtmpdir>/tmp/systemml</localtmpdir> + + <!-- hdfs tmp working directory--> + <scratch>scratch_space</scratch> + + <!-- compiler optimization level, valid values: 0 | 1 | 2 | 3 | 4, default: 2 --> + <optlevel>2</optlevel> + + <!-- default number of reduce tasks per MR job, default: 2 x number of nodes --> + <numreducers>10</numreducers> + + <!-- override jvm reuse flag for specific MR jobs, valid values: true | false --> + <jvmreuse>false</jvmreuse> + + <!-- default block dim for binary block files --> + <defaultblocksize>1000</defaultblocksize> + + <!-- run systemml control program as yarn appmaster, in case of MR1 always falls back to client, please disable for debug mode --> + <dml.yarn.appmaster>false</dml.yarn.appmaster> + + <!-- maximum jvm heap size of the dml yarn appmaster in MB, the requested memory is 1.5x this parameter --> + <dml.yarn.appmaster.mem>2048</dml.yarn.appmaster.mem> + + <!-- maximum jvm heap size of the map/reduce tasks in MB, the requested memory is 1.5x this parameter, negative values ignored --> + <dml.yarn.mapreduce.mem>2048</dml.yarn.mapreduce.mem> + + <!-- yarn application submission queue, relevant for default capacity scheduler --> + <dml.yarn.app.queue>default</dml.yarn.app.queue> + + <!-- enables multi-threaded matrix multiplications in singlenode control program --> + <cp.parallel.matrixmult>true</cp.parallel.matrixmult> + + <!-- enables multi-threaded read/write of text formats in singlenode control program --> + <cp.parallel.textio>true</cp.parallel.textio> + + <!-- enables compressed linear algebra for cp/spark --> + <compressed.linalg>true</compressed.linalg> +</root> http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/16e7b1c8/src/test_suites/java/org/apache/sysml/test/integration/functions/compress/ZPackageSuite.java ---------------------------------------------------------------------- diff --git a/src/test_suites/java/org/apache/sysml/test/integration/functions/compress/ZPackageSuite.java b/src/test_suites/java/org/apache/sysml/test/integration/functions/compress/ZPackageSuite.java new file mode 100644 index 0000000..62dc46e --- /dev/null +++ b/src/test_suites/java/org/apache/sysml/test/integration/functions/compress/ZPackageSuite.java @@ -0,0 +1,56 @@ +/* + * 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.sysml.test.integration.functions.compress; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** Group together the tests in this package into a single suite so that the Maven build + * won't run two of them at once. */ +@RunWith(Suite.class) [email protected]({ + BasicCompressionTest.class, + BasicMatrixAppendTest.class, + BasicMatrixMultChainTest.class, + BasicMatrixTransposeSelfMultTest.class, + BasicMatrixVectorMultTest.class, + BasicScalarOperationsSparseUnsafeTest.class, + BasicScalarOperationsTest.class, + BasicTransposeSelfLeftMatrixMultTest.class, + BasicUnaryAggregateTest.class, + BasicVectorMatrixMultTest.class, + CompressedLinregCG.class, + CompressedSerializationTest.class, + LargeCompressionTest.class, + LargeMatrixVectorMultTest.class, + LargeParMatrixVectorMultTest.class, + LargeVectorMatrixMultTest.class, + ParMatrixMultChainTest.class, + ParMatrixVectorMultTest.class, + ParTransposeSelfLeftMatrixMultTest.class, + ParUnaryAggregateTest.class, + ParVectorMatrixMultTest.class, +}) + + +/** This class is just a holder for the above JUnit annotations. */ +public class ZPackageSuite { + +}
