airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [1/2] airavata-sandbox git commit: adding airavata layered prototype
Date Tue, 27 Jun 2017 16:18:59 GMT
Repository: airavata-sandbox
Updated Branches:
  refs/heads/master 85fb44b38 -> 43a79e3a5


http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/43a79e3a/airavata-layered-architecture/src/test/java/org/apache/airavata/runners/ssh/SSHRunnerTest.java
----------------------------------------------------------------------
diff --git a/airavata-layered-architecture/src/test/java/org/apache/airavata/runners/ssh/SSHRunnerTest.java
b/airavata-layered-architecture/src/test/java/org/apache/airavata/runners/ssh/SSHRunnerTest.java
new file mode 100644
index 0000000..cd92522
--- /dev/null
+++ b/airavata-layered-architecture/src/test/java/org/apache/airavata/runners/ssh/SSHRunnerTest.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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.airavata.runners.ssh;
+
+import org.apache.airavata.Constants;
+import org.apache.commons.io.IOUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.UUID;
+
+public class SSHRunnerTest {
+    private final static Logger logger = LoggerFactory.getLogger(SSHRunnerTest.class);
+
+    @Test
+    public void test() {
+        try{
+            SSHKeyAuthentication br2SshAuthentication = new SSHKeyAuthentication(
+                    Constants.loginUserName,
+                    IOUtils.toByteArray(SSHRunnerTest.class.getClassLoader().getResourceAsStream("ssh/id_rsa")),
+                    IOUtils.toByteArray(SSHRunnerTest.class.getClassLoader().getResourceAsStream("ssh/id_rsa.pub")),
+                    "dummy",
+                    SSHRunnerTest.class.getClassLoader().getResource("ssh/known_hosts").getPath(),
+                    false
+            );
+            SSHServerInfo br2 = new SSHServerInfo(Constants.loginUserName, "bigred2.uits.iu.edu",
br2SshAuthentication,22);
+
+            String routingKey = UUID.randomUUID().toString();
+            SSHRunner sshExecutor = new SSHRunner();
+            sshExecutor.executeCommand(routingKey, "mkdir -p airavata", br2, br2SshAuthentication);
+            sshExecutor.scpTo(routingKey, SSHRunnerTest.class.getClassLoader().getResource("job_tf.pbs").getPath(),
+                    "~/airavata/", br2, br2SshAuthentication);
+            sshExecutor.scpTo(routingKey, SSHRunnerTest.class.getClassLoader().getResource("code_tf.py").getPath(),
+                    "~/airavata/", br2, br2SshAuthentication);
+            sshExecutor.executeCommand(routingKey, new String[]{"cd ~/airavata", "qsub ~/airavata/job_tf.pbs"},
br2, br2SshAuthentication);
+
+        }catch (Exception ex){
+            ex.printStackTrace();
+            Assert.fail();
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/43a79e3a/airavata-layered-architecture/src/test/resources/code_tf.py
----------------------------------------------------------------------
diff --git a/airavata-layered-architecture/src/test/resources/code_tf.py b/airavata-layered-architecture/src/test/resources/code_tf.py
new file mode 100644
index 0000000..221e960
--- /dev/null
+++ b/airavata-layered-architecture/src/test/resources/code_tf.py
@@ -0,0 +1,30 @@
+import tensorflow as tf
+import numpy as np
+import numpy.polynomial.polynomial as poly
+
+from random import randint
+
+tf.reset_default_graph()
+num_neurons = 5000
+
+indices = []
+values = []
+for i in range(num_neurons):
+    for j in range(num_neurons):
+        x  = 3
+        if i != j:
+            number = randint(0, 99)
+            if number < 5:
+                indices.append([i, j])
+                values.append(1.0/5)
+
+connections = tf.SparseTensor(indices=indices, values=values, dense_shape=[num_neurons, num_neurons])
+
+neuron_values = tf.Variable(np.ones(num_neurons), dtype=tf.float32)
+
+mul_product = tf.sparse_tensor_dense_matmul(connections, tf.reshape(neuron_values, shape=(num_neurons,
1)))
+
+sess = tf.Session()
+sess.run(tf.global_variables_initializer())
+
+output = sess.run(mul_product)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/43a79e3a/airavata-layered-architecture/src/test/resources/job_tf.pbs
----------------------------------------------------------------------
diff --git a/airavata-layered-architecture/src/test/resources/job_tf.pbs b/airavata-layered-architecture/src/test/resources/job_tf.pbs
new file mode 100644
index 0000000..a4d3485
--- /dev/null
+++ b/airavata-layered-architecture/src/test/resources/job_tf.pbs
@@ -0,0 +1,18 @@
+#!/bin/bash
+# file to submit non interactive jobs to bigred2
+
+#PBS -l nodes=1:ppn=16
+#PBS -l gres=ccm
+#PBS -q debug_gpu
+#PBS -l walltime=00:30:00
+
+#PBS -o STDOUT.txt
+#PBS -e STDERR.txt
+
+#PBS -m bea
+#PBS -M supun.nakandala@gmail.com
+
+module load ccm
+module load anaconda2/4.2.0
+source activate tensorflow_env
+ccmrun python ~/airavata/code_tf.py
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/43a79e3a/airavata-layered-architecture/src/test/resources/ssh/id_rsa
----------------------------------------------------------------------
diff --git a/airavata-layered-architecture/src/test/resources/ssh/id_rsa b/airavata-layered-architecture/src/test/resources/ssh/id_rsa
new file mode 100644
index 0000000..3f1f2d1
--- /dev/null
+++ b/airavata-layered-architecture/src/test/resources/ssh/id_rsa
@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: AES-128-CBC,3AF46750EC6C202FA7E19DD44994DCBC
+
+T1iV/k7DS8Li4pwYyySEBpPv8OWbd5Z1h5Z1a4FNScLZGsLm8CvduJxvDrQWNOfd
+qC5M8VNXvATN2K3+vj82aqLQ9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xX5344UpQalhKLjsf
+XdMMJYuD2u/1BV4Lg+O6aFwRwGQtNkF5AMTq3FDluptWdAcAU3dsO9sNTCTmgCwx
+lD4Pew4lBYZe0WZ+2o+0X1efyGJJ6/lKjfpVF0eNwQqFQ8SxSFZvUrwJsK+NujjH
+nhjobs64n4MRAPnckVqO+vlY408uUDUoNOzROAC9zDl216ZXT8zTmWeoNkQS6DKb
+JXtbXPDHWdo9VLik5h08FjmwdNoMS18mkSDpkwkP3hGCQnWhKZDjlU6kfksRbeee
+t6WI4pKIbzHQJV+CLm1uzC1o7EfsD4dbSpefpJUD5D+mTH8MBkjb7p5+E2/TER62
+rIdXjpHEA/s8W3bmdTSam1mqA3VUBGVQryIfAv2qOyVjQx2Y28+pDTAtMT6FnYUZ
+sVUucxUp+TE7WqIQX8AzjNAudu25R7YPQvgQXjSrA6G6bxNQNC/TQeT+vgO4g8Ah
+-----END RSA PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/43a79e3a/airavata-layered-architecture/src/test/resources/ssh/id_rsa.pub
----------------------------------------------------------------------
diff --git a/airavata-layered-architecture/src/test/resources/ssh/id_rsa.pub b/airavata-layered-architecture/src/test/resources/ssh/id_rsa.pub
new file mode 100644
index 0000000..e378be0
--- /dev/null
+++ b/airavata-layered-architecture/src/test/resources/ssh/id_rsa.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCr9VP22p0I+2W5o/klPv/OvfTihvcBQwZXKPrSLFF+OB9nVNtIfDDETIwwex7mknn3Kks1jFvEdKMrvRjOFeFInDv3N40LjohHu4v2tiawAON7MOLpz/iX5dWp0wteixlDKfGe7PAEMAk054kLSDiB3em2zBK4d9ApedA5k2JG1dmAsNK0KkbfgFPd5+iXrzgTg4XiefHQoaCSUyS7w6t8645djbYOP+b+SJtgslaf2RqeoBVvrA6YQJE1pUYjcm9yL4KwyqaPo+N/2XZ6xys5+WN8svtL3uRduENU1MQSTpdFq+GLCY4SgLMFgLJKoxHjcjPRfKyE/eYk1gQA7b/Z
snakanda@149-161-141-51.dhcp-bl.indiana.edu

http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/43a79e3a/airavata-layered-architecture/src/test/resources/ssh/known_hosts
----------------------------------------------------------------------
diff --git a/airavata-layered-architecture/src/test/resources/ssh/known_hosts b/airavata-layered-architecture/src/test/resources/ssh/known_hosts
new file mode 100644
index 0000000..e69de29


Mime
View raw message