Some examples are provided in the standard distribution. The helloworld app is a good example to get started.

To run the helloworld example run the following commands in your shell:

$> cd ${HSCALA_HOME}/examples
$> hscalac primers/helloworld/HelloWorldApp.scala
$> hscala primers.helloworld.HelloWorldApp
Hello World

The example first compiles the HelloWorldApp.scala file and then runs the program to produce the "Hello World" output on the console.
Similarly, you can compile and run the other examples provided in the distribution or your own examples.

Habanero-Scala provides a few options that can be configured to manage the parallelism while running applications. These can be found by running hscala -help:

$> hscala -help
Usage: hscala [jvm-options] <HS-App-class> [arguments]
 where HS specific options include: 
  -Dhs.places=<num-places>:<threads-per-place> e.g. 2:4
  -Dhs.fj=true/false
  -Dhs.time=true/false
  -Dhs.stats=true/false
  -Dhs.threadBindingDiagnostics=true/false
  • hs.places is used to configure the number of places, e.g. 2:4 will create 2 places with 4 threads each, i.e. a total of 8 threads.
  • hs.fj controls whether we want to use the Fork/Join Executor service.
  • hs.time prints timing info for the application when enabled
  • hs.stats prints runtime statistics including number of tasks created and worker thread stats at the end of the execution
  • hs.threadBindingDiagnostics prints thread binding diagnostics when the application launches.
  • No labels