Comprehensive Example: Trapezoidal Approximation

 

Description

SALSA provides a great support for parallel and distributed programming. Its support for code and data mobility and asynchronous message passing makes programming for distributed systems a natural task. Its coordination model provides an attractive feature for parallel programming where multiple CPUs need to coordinate and communicate between themselves in an efficient manner. SALSA depends on Java, hence it inherits Java’s powerful feature of portability across different platforms. All of this makes SALSA an attractive language for both distributed and parallel programming.

 

Trapezoidal Approximation

This application approximates the integral of a function over an interval [a, b] by using the trapezoidal approximation. The application solves this approximation through parallelism by dividing the approximation into several intervals. Different worker actors are started and migrated to different theaters. They all compute the integral approximation in parallel and send their results to bootstrapping actor. This latter collects the results from all the worker actors, adds them up, and displays the final result to the end user. The application consists of two behaviors: the Trap behavior, which implements the bootstrapping actor and the TrapWorker behavior, which implements the worker actors.

 

Executing demo.Trap

  1. Edit the theater config file. The default file is theatersFile.txt. Add host name with port number to that file.
  2. Start theaters at each host specifying in theatersFile.txt
  3. Execute demo.Trap:
    java demo.Trap <left point> <right point> <# of trapezoids> <# of actors> <nameserver> <theater file>

 

Source file

 

return to the salsa home page