diff --git a/build.sbt b/build.sbt index 98e887d7f5eb2eaaf17f5b3a2604817fa88151b5..99b2d6f23c7ce10c79eda7d0b590d9fd1a3b60e2 100755 --- a/build.sbt +++ b/build.sbt @@ -50,19 +50,19 @@ lazy val commonSettings = Seq( ) lazy val root = (project in file(".")). - aggregate(n2s3, examples, daemon) //n2s3_cluster + aggregate(n2s3, examples, daemon, n2s3_cluster) lazy val n2s3 = (project in file("n2s3")). settings(commonSettings: _*) -//lazy val n2s3_cluster = (project in file("n2s3_cluster")). -// settings(commonSettings: _*). -// dependsOn(n2s3) +lazy val n2s3_cluster = (project in file("n2s3_cluster")). + settings(commonSettings: _*). + dependsOn(n2s3) lazy val examples = (project in file("n2s3_examples")). settings(commonSettings: _*). dependsOn(n2s3) -//dependsOn(n2s3, n2s3_cluster) + dependsOn(n2s3, n2s3_cluster) lazy val daemon = (project in file("n2s3_daemon")). settings(commonSettings: _*). dependsOn(n2s3) diff --git a/n2s3_cluster/n2s3_cluster.iml b/n2s3_cluster/n2s3_cluster.iml new file mode 100644 index 0000000000000000000000000000000000000000..bac2e45c02bb681b710c819042d0a9b49a968255 --- /dev/null +++ b/n2s3_cluster/n2s3_cluster.iml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/main/scala" isTestSource="false" /> + <excludeFolder url="file://$MODULE_DIR$/target" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="sbt: org.scala-lang:scala-library:2.12.7:jar" level="project" /> + </component> +</module> \ No newline at end of file diff --git a/n2s3_daemon/build.sbt b/n2s3_daemon/build.sbt index 945a328e6c602fe43b7728c0e4f95f12b0f9ed68..bde605f680f6885cf8a793db680283ff6eda05ed 100755 --- a/n2s3_daemon/build.sbt +++ b/n2s3_daemon/build.sbt @@ -10,7 +10,7 @@ name := "N2S3-daemon" libraryDependencies ++= { val akkaV = "2.3.7" Seq( - "fr.univ-lille.cristal" %% "n2s3" % "0.3-SNAPSHOT", + "fr.univ-lille.cristal" %% "n2s3" % "1.1.1", "com.typesafe.akka" %% "akka-cluster" % akkaV ) -} \ No newline at end of file +} diff --git a/n2s3_examples/src/main/scala/fr/univ_lille/cristal/emeraude/n2s3/apps/ExampleDistribution.scala b/n2s3_examples/src/main/scala/fr/univ_lille/cristal/emeraude/n2s3/apps/ExampleDistribution.scala deleted file mode 100755 index be7ef48f8510d6d1c5babcc11a6b15f80b210e29..0000000000000000000000000000000000000000 --- a/n2s3_examples/src/main/scala/fr/univ_lille/cristal/emeraude/n2s3/apps/ExampleDistribution.scala +++ /dev/null @@ -1,70 +0,0 @@ -package fr.univ_lille.cristal.emeraude.n2s3.apps - -import akka.cluster.Cluster -import fr.univ_lille.cristal.emeraude.n2s3.cluster.RandomActorDeploymentStrategy -import fr.univ_lille.cristal.emeraude.n2s3.core.models.properties.{MembranePotentialThreshold, SynapseLTP} -import fr.univ_lille.cristal.emeraude.n2s3.features.builder.N2S3 -import fr.univ_lille.cristal.emeraude.n2s3.features.builder.connection.types.FullConnection -import fr.univ_lille.cristal.emeraude.n2s3.features.io.input.N2S3InputStreamCombinators._ -import fr.univ_lille.cristal.emeraude.n2s3.features.io.input._ -import fr.univ_lille.cristal.emeraude.n2s3.models.neurons.LIF -import fr.univ_lille.cristal.emeraude.n2s3.models.synapses.{InhibitorySynapse, QBGParameters, SimplifiedSTDPWithNegative} -import fr.univ_lille.cristal.emeraude.n2s3.support.UnitCast._ -import fr.univ_lille.cristal.emeraude.n2s3.support.actors.N2S3ActorSystem -import squants.electro.ElectricPotentialConversions._ - -object ExampleDistribution extends App { - - QBGParameters.alf_m = 0.02f - QBGParameters.alf_p = 0.06f - QBGParameters.beta_m = 3f - QBGParameters.beta_p = 2f - - val oversampling = 2 - - val n2s3 = new N2S3("N2S3ClusterSystem") - val cluster = Cluster(n2s3.system.asInstanceOf[N2S3ActorSystem].system) - n2s3.buildProperties.actorDeploymentPolicy = new RandomActorDeploymentStrategy(cluster) - cluster.registerOnMemberUp { - - println("I'm up!") - - val inputStream = - InputDigitalHex.Entry >> - //StreamOversampling[SampleInput](oversampling, oversampling) >> - SampleToSpikeTrainConverter[Float, InputSample2D[Float]](0, 23, 150 MilliSecond, 350 MilliSecond) >> N2S3Entry - //InputNoiseGenerator(1 hertz) - - val inputLayer = n2s3.createInput(inputStream) - - val unsupervisedLayer = n2s3.createNeuronGroup("Layer1", 18) - unsupervisedLayer.setNeuronModel(LIF, Seq( - (MembranePotentialThreshold, 2 * oversampling millivolts), - (SynapseLTP, 50 MilliSecond) - )) - inputLayer.connectTo(unsupervisedLayer, (new FullConnection).setDefaultConnectionConstructor(() => new SimplifiedSTDPWithNegative)) - unsupervisedLayer.connectTo(unsupervisedLayer, (new FullConnection).setDefaultConnectionConstructor(() => new InhibitorySynapse)) - n2s3.createSynapseWeightGraphOn(inputLayer, unsupervisedLayer) - - - println("Start Training ...") - inputStream.append(new DigitalHexInputStream().repeat(1).shuffle()) - n2s3.runAndWait() - - - println("Start Testing ...") - unsupervisedLayer.fixNeurons() - inputStream.clean() - inputStream.append(new DigitalHexInputStream().repeat(1).shuffle()) - // n2s3.runAndWait(100) - // inputLayer.setInput(DigitalHex.distributedInput(2, 1)) - val benchmarkMonitor = n2s3.createBenchmarkMonitor(unsupervisedLayer) - - n2s3.runAndWait() - - println(benchmarkMonitor) - benchmarkMonitor.exportToHtmlView("results/test.html") - - System.exit(0) - } -} diff --git a/n2s3_integration_tests/src/multi-jvm/scala/fr/univ_lille/cristal/emeraude/n2s3/MultiNodeSample.scala b/n2s3_integration_tests/src/multi-jvm/scala/fr/univ_lille/cristal/emeraude/n2s3/MultiNodeSample.scala deleted file mode 100755 index 3b77aaa401373b152b75bea46b3bf1b17dff1994..0000000000000000000000000000000000000000 --- a/n2s3_integration_tests/src/multi-jvm/scala/fr/univ_lille/cristal/emeraude/n2s3/MultiNodeSample.scala +++ /dev/null @@ -1,96 +0,0 @@ -package fr.univ_lille.cristal.emeraude.n2s3 - -import akka.remote.testkit.MultiNodeSpec -import akka.testkit.ImplicitSender -import fr.univ_lille.cristal.emeraude.n2s3.cluster.{ExplicitActorDeploymentStrategy, N2S3ClusteredActorSystem} -import fr.univ_lille.cristal.emeraude.n2s3.features.builder.{N2S3, NeuronGroupRef} -import fr.univ_lille.cristal.emeraude.n2s3.models.neurons.LIF -import fr.univ_lille.cristal.emeraude.n2s3.support.actors.ActorPerNeuronPolicy - -class MultiNodeSampleSpecMultiJvmMaster extends MultiNodeSample -class MultiNodeSampleSpecMultiJvmSlave1 extends MultiNodeSample -class MultiNodeSampleSpecMultiJvmSlave2 extends MultiNodeSample - -class MultiNodeSample extends MultiNodeSpec(MultiNodeSampleConfig) - with STMultiNodeSpec with ImplicitSender { - - import MultiNodeSampleConfig._ - - def initialParticipants = roles.size - - "An explicit cluster node selector" must { - - "put all actors in given node if global" in { - runOn(master) { - enterBarrier("deployed") - val actorSystem = new N2S3ClusteredActorSystem(system) - val n2s3 = new N2S3(actorSystem) - n2s3.buildProperties.actorDeploymentPolicy = new ExplicitActorDeploymentStrategy(node(slave1).address) - - val neuronGroup = new NeuronGroupRef(n2s3) - neuronGroup.setNeuronModel(LIF) - neuronGroup.setNumberOfNeurons(2) - - neuronGroup.setActorPolicy(new ActorPerNeuronPolicy(n2s3)) - neuronGroup.ensureActorDeployed(n2s3) - - val firstAddress = neuronGroup.neurons.head.getNetworkAddress - val secondAddress = neuronGroup.neurons(1).getNetworkAddress - - firstAddress.actor.path.address shouldBe secondAddress.actor.path.address - firstAddress.actor.path.address shouldBe node(slave1).address - firstAddress.actor.path.address shouldNot be(node(master).address) - } - - runOn(slave1) { - enterBarrier("deployed") - } - - runOn(slave2) { - enterBarrier("deployed") - } - - enterBarrier("finished") - } - - "put all actors in locally configured node" in { - runOn(master) { - enterBarrier("deployed") - val actorSystem = new N2S3ClusteredActorSystem(system) - val n2s3 = new N2S3(actorSystem) - - val neuronGroup = new NeuronGroupRef(n2s3) - neuronGroup.setIdentifier("1") - neuronGroup.setNeuronModel(LIF) - neuronGroup.setNumberOfNeurons(10) - neuronGroup.setActorPolicy(new ActorPerNeuronPolicy(new ExplicitActorDeploymentStrategy(node(slave1).address))) - neuronGroup.ensureActorDeployed(n2s3) - - val neuronGroup2 = new NeuronGroupRef(n2s3) - neuronGroup2.setIdentifier("2") - neuronGroup2.setNeuronModel(LIF) - neuronGroup2.setNumberOfNeurons(10) - neuronGroup2.setActorPolicy(new ActorPerNeuronPolicy(new ExplicitActorDeploymentStrategy(node(slave2).address))) - neuronGroup2.ensureActorDeployed(n2s3) - - - neuronGroup.neurons.foreach( n => { - n.getNetworkAddress.actor.path.address should be(node(slave1).address) - }) - - neuronGroup2.neurons.foreach( n => - n.getNetworkAddress.actor.path.address should be (node(slave2).address)) - } - - runOn(slave1) { - enterBarrier("deployed") - } - - runOn(slave2) { - enterBarrier("deployed") - } - - enterBarrier("finished") - } - } -} \ No newline at end of file