Skip to content

Commit

Permalink
Init BSP Scala project
Browse files Browse the repository at this point in the history
  • Loading branch information
ltronky committed Nov 28, 2014
0 parents commit 5eeef84
Show file tree
Hide file tree
Showing 29 changed files with 218 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
*#
*.iml
*.ipr
*.iws
*.pyc
*.tm.epoch
*.vim
*/project/boot
*/project/build/target
*/project/project.target.config-classes
*-shim.sbt
*~
.#*
.*.swp
.DS_Store
.cache
.cache
.classpath
.codefellow
.ensime*
.eprj
.history
.idea
.manager
.multi-jvm
.project
.scala_dependencies
.scalastyle
.settings
.tags
.tags_sorted_by_file
.target
.worksheet
Makefile
TAGS
_akka_cluster/
_dump
_mb
activemq-data
akka-contrib/rst_preprocessed/
akka-docs/_build/
akka-docs/exts/
akka-docs/rst_preprocessed/
akka-osgi/src/main/resources/*.conf
akka.sublime-project
akka.sublime-workspace
akka.tmproj
beanstalk/
bin/
data
deploy/*.jar
etags
lib_managed
logs
manifest.mf
mongoDB/
multiverse.log
out
project/akka-build.properties
project/boot/*
project/plugins/project
redis/
reports
run-codefellow
schoir.props
semantic.cache
src_managed
storage
tags
target
tm*.lck
tm*.log
tm.out
worker*.log
34 changes: 34 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name := """TesiBSPScala"""

val akkaVersion = "2.3.6"

fork in run := true

version := "0.1"

scalaVersion := "2.11.2"

resolvers += Resolver.sonatypeRepo("public")

scalacOptions in Compile ++= Seq("-encoding", "UTF-8", "-target:jvm-1.7", "-deprecation", "-feature", "-unchecked", "-Xlog-reflective-calls", "-Xlint")

libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-cluster" % akkaVersion,
"com.typesafe.akka" %% "akka-contrib" % akkaVersion,
"com.github.scopt" %% "scopt" % "3.2.0",
"org.fusesource" % "sigar" % "1.6.4")

javaOptions in run ++= Seq(
"-Djava.library.path=./sigar",
"-Xms128m", "-Xmx1024m",
"-Dcom.sun.management.jmxremote.port=9999",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.ssl=false",
"-XX:+UnlockCommercialFeatures",
"-XX:+FlightRecorder")

assemblyJarName in assembly := "SDAJClusterNode.jar"

test in assembly := {}

mainClass in assembly := Some("it.unipd.trluca.arsort.Main")
1 change: 1 addition & 0 deletions project/assembly.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=0.13.6
Binary file added sigar/libsigar-amd64-freebsd-6.so
Binary file not shown.
Binary file added sigar/libsigar-amd64-linux.so
Binary file not shown.
Binary file added sigar/libsigar-amd64-solaris.so
Binary file not shown.
Binary file added sigar/libsigar-ia64-hpux-11.sl
Binary file not shown.
Binary file added sigar/libsigar-ia64-linux.so
Binary file not shown.
Binary file added sigar/libsigar-pa-hpux-11.sl
Binary file not shown.
Binary file added sigar/libsigar-ppc-aix-5.so
Binary file not shown.
Binary file added sigar/libsigar-ppc-linux.so
Binary file not shown.
Binary file added sigar/libsigar-ppc64-aix-5.so
Binary file not shown.
Binary file added sigar/libsigar-ppc64-linux.so
Binary file not shown.
Binary file added sigar/libsigar-s390x-linux.so
Binary file not shown.
Binary file added sigar/libsigar-sparc-solaris.so
Binary file not shown.
Binary file added sigar/libsigar-sparc64-solaris.so
Binary file not shown.
Binary file added sigar/libsigar-universal-macosx.dylib
Binary file not shown.
Binary file added sigar/libsigar-universal64-macosx.dylib
Binary file not shown.
Binary file added sigar/libsigar-x86-freebsd-5.so
Binary file not shown.
Binary file added sigar/libsigar-x86-freebsd-6.so
Binary file not shown.
Binary file added sigar/libsigar-x86-linux.so
Binary file not shown.
Binary file added sigar/libsigar-x86-solaris.so
Binary file not shown.
Binary file added sigar/sigar-amd64-winnt.dll
Binary file not shown.
Binary file added sigar/sigar-x86-winnt.dll
Binary file not shown.
Binary file added sigar/sigar-x86-winnt.lib
Binary file not shown.
23 changes: 23 additions & 0 deletions src/main/resources/app_debug.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
akka {

actor.provider = "akka.cluster.ClusterActorRefProvider"

remote {
log-remote-lifecycle-events = off
netty.tcp {
hostname = "127.0.0.1"
port = 2551
}
}

cluster {
seed-nodes = [
"akka.tcp://[email protected]:2551",
"akka.tcp://[email protected]:2552",
"akka.tcp://[email protected]:2553",
"akka.tcp://[email protected]:2554"]

auto-down-unreachable-after = 10s
}

}
25 changes: 25 additions & 0 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
akka {

actor.provider = "akka.cluster.ClusterActorRefProvider"

remote {
log-remote-lifecycle-events = off
enabled-transports = ["akka.remote.netty.tcp"]
transport = "akka.remote.netty.NettyRemoteTransport"
netty.tcp {
hostname = "192.168.56.11"
port = 2551
}
}

cluster {
seed-nodes = [
// "akka.tcp://[email protected]:2551",
"akka.tcp://[email protected]:2551",
// "akka.tcp://[email protected]:2553",
"akka.tcp://[email protected]:2551"]

auto-down-unreachable-after = 10s
}

}
60 changes: 60 additions & 0 deletions src/main/scala/it/unipd/trluca/bsp/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package it.unipd.trluca.bsp

import akka.actor.{ActorSystem, Props}
import com.typesafe.config.ConfigFactory
import scopt.OptionParser

case class Config(debug:Boolean = false,
clusterSize: Int = -1,
// arraySize: Int = 10,
// valueRange:Int = 10000,
nodes: Seq[String] = Seq())

object Main {
def main(args: Array[String]): Unit = {

val parser = new OptionParser[Config]("scopt") {
head("Distributed-Array Sorting", "1.0")
opt[Unit]('d', "debug") optional() action { (x, c) =>
c.copy(debug = true)
} text "Debug"
opt[Int]('c', "cSize") action { (x, c) =>
c.copy(clusterSize = x)
} text "Initial Cluster Size"
// opt[Int]('a', "arraySize") action { (x, c) =>
// c.copy(arraySize = x)
// } text "Distributed Array Size"
// opt[Int]('r', "valueRange") optional() action { (x, c) =>
// c.copy(valueRange = x)
// } text "Values range"

help("help") text "prints this usage text"

arg[String]("<host:port>...") unbounded() action { (x, c) =>
c.copy(nodes = c.nodes :+ x) } text "Nodes"
}

parser.parse(args, Config()) map { c =>

c.nodes foreach { h=>
val Array(hostname, port) = h.split(":")
val conf = ConfigFactory.parseString(s"akka.remote.netty.tcp.hostname=$hostname")
.withFallback(ConfigFactory.parseString(s"akka.remote.netty.tcp.port=$port"))
.withFallback(
if(c.debug)
ConfigFactory.load("app_debug")
else
ConfigFactory.load()
)
// val sys = ActorSystem("ClusterSystem", conf)
// sys.actorOf(Props[DistArrayNodeActor], "ablock")
//
// if ((c.debug && port == "2551") || (!c.debug && c.arraySize != -1)) {
// val ep = sys.actorOf(Props[EntryPoint], "ep")
// ep ! SetDistArraySize(c)
// }
}
} //getOrElse {}

}
}

0 comments on commit 5eeef84

Please sign in to comment.