An mpiJava application that performs a Potts Model Monte Carlo
simulation using parallel Metropolis algorithms in two dimensions
running on four processors is shown in Figure 6.6.
One of the good feature of mpiJava is that users have full
access to the Java AWT and other Java graphical packages to support GUI
and visualize graphical output of application.
Visualization of the collected data is a critical element in providing
developers or educators with the needed insight into the system
under study.
In this Potts model simulation, the different colors represent the Q
different spin states on a lattice. All the options of the simulation
are customizable through a GUI. Processor
handles all GUI
input and visualization of output data.
When users run simulation by clicking start button, input values are
broadcast to other processors and then, after the processors generate
a new configuration, processor
gathers all updated data to
plot the output in order to visualize the results.
Measurements of standard quantities such as energy and magnetization
are easily done in parallel by just calculating the quantities locally,
sum over sites in each processor, and then combining the partial sums from
all processors using MPI.Allreduce.
In this demo, the total number of processors is broken up into a 2D grid, in X and Y directions. Users can also choose data distribution as row-, column- or block-wise by selecting the nodes in X direction option in GUI. This option is set after the number of running processors is given at the starting time by execution command as follows;
prunjava 4 Potts
The prunjava script is a wrapper for the MPICH
mpirun script. The first argument is the number of processors
on which the program will be executed.
The number of nodes in Y direction is set automatically by total
number of running nodes and the number of nodes in X direction specified
in the GUI.
A list of available host computers may be given in an MPICH-style
machines file in the local directory.
From this simulation, one is able to determine the average magnetization, the average energy, and the specific heat of the system.