...
Code Block | ||||
---|---|---|---|---|
| ||||
object FindPrimesCncDefinition {
def main(args: Array[String]): Unit = {
ApplicationName("FindPrimes")
TargetPackage("findprimes") // default package
TargetDirectory("findprimes")
Comment("Item Collections")
// The prime numbers as identified by the compute step
ItemCollection[Point, Int]("primes")
Comment("Tag Collections")
// The tag values are the odd numbers in the range [3..n]
TagCollection[Point]("oddNums")
Comment("Step Dependences")
// The compute step may produce a prime number (in the form of a tag instance)
StepDependence("compute", List[String](), List("primes"))
Comment("Step Prescriptions")
// For each oddNums instance, there is
Presription("oddNums", List("compute"))
Comment("Environment Collections")
// Input from the environment: initialize all tags
// Output to the environment is the collection of the prime numbers
EnvironmentDependence(
List("oddNums"),
List("primes")
)
}
}
|
...
File Name | Function |
---|---|
| A textual form of the CnC graph understood by other CnC implementations. |
| A Scala class representation the CnC graph. Users will need to instantiate instances of this graph and invoke the |
| This file includes Scala traits for the different Step instances. Users will need to implement these interfaces in their custom Steps. The file also includes default implementations of the Tag Collections. Users should not need to edit the contents of this file. |
Here is how a tarit trait for the Step looks like:
Code Block | ||||
---|---|---|---|---|
| ||||
import edu.rice.cnc.api._ import edu.rice.cnc.runtime._ import util.continuations.cps trait ComputeStep extends Step { def compute( tag: Point , outPrimes: OutputCollection[Point, Int] ): Unit@cps[Any] } |
...
Code Block |
---|
Determining primes from 1-100
Number of primes: 24
Contents of Collection'primes'
[3]=3
[5]=5
...
[83]=83
[89]=89
[97]=97
HabaneroRuntime:
num workers=4
executor service=jsr166y.ForkJoinPool@39385660[Terminated, parallelism = 4, size = 0, active = 0, running = 0, steals = 49, tasks = 0, submissions = 0]
async instances=50
activity instances=50
|