If you want to do a distributed
execution, you must follow these instructions:
1.- We need to know the IP address for every host. Easily, we can
see it in the /etc/hosts file in each hosts.
2.- Later, we put the IP address and the number of island in the
configuration file. For example, for 8 island it will be.
.................. (now put your own
problem configuration)
If you're going to run all the islands only in one host, you have
to put all IP address equal to the IP host address or to the local
IP host address (127.0.0.1).
3. We run the islands: Each island can represents different
work stations or different run windows inside one host.
3.1. One option is to run the islands in only one host:
We must open so many run windows as islands, and we execute in each
of them one island:
>
Run window 1: Java Island 8 -o out8.txt -c config.txt
|
>
Run window 2: Java Island 7 -o out7.txt -c config.txt
|
>
Run window 3: Java Island 6 -o out6.txt -c config.txt
|
>
Run window 4: Java Island 5 -o out5.txt -c config.txt
|
>
Run window 5: Java Island 4 -o out4.txt -c config.txt
|
>
Run window 6: Java Island 3 -o out3.txt -c config.txt
|
>
Run window 7: Java Island 2 -o out2.txt -c config.txt
|
>
Run window 8: Java Island 1 -o out1.txt -c config.txt
|
If we are using Linux or Unix we could create scrip files that
execute the islands on background mode in the same host. For Example.
File execute:
Java Island
8 -o out8.txt -c config.txt & |
Java Island
7 -o out7.txt -c config.txt & |
Java Island
6 -o out6.txt -c config.txt & |
Java Island
5 -o out5.txt -c config.txt & |
Java Island
4 -o out4.txt -c config.txt & |
Java Island
3 -o out3.txt -c config.txt & |
Java Island
2 -o out2.txt -c config.txt & |
Java Island
1 -o out1.txt -c config.txt |
(this file has a problem
that later will be commented)
And to execute the islands you only have to put in the
command line:
>
sh execute
IMPORTANT: The island 1 should be the last one to be executed.
The final results will be shown on the screen of the island
1 (leader).
So, it's possible that the file "execute" created to
simply the execution doesn't work correctly, because, perhaps,
the leader island becomes to run before the other ones. To
solve this problem we can put a delay before to run the leader
island, in other file, and then we run it from "execute".
That is:
File execute:
Java Island
8 -o out8.txt -c config.txt & |
Java Island
7 -o out7.txt -c config.txt & |
Java Island
6 -o out6.txt -c config.txt & |
Java Island
5 -o out5.txt -c config.txt & |
Java Island
4 -o out4.txt -c config.txt & |
Java Island
3 -o out3.txt -c config.txt & |
Java Island
2 -o out2.txt -c config.txt & |
sh delay_leader |
File delay_leader:
delay=0 |
until [ $delay
-eq 5000 ] |
do |
delay=`exp
$delay + 1` |
done |
Java Island
1 -o out1.txt -c config.txt |
NOTE: You should notice that the 5000 value depends
on the system speed, and that the simple inverted commas
using in delay=`exp $delay + 1` are located next to
"P key", normally in the same key that ^ key (french commas).
You must put all spaces.
Finally, we only put the next command in the command
line:
>
sh execute
3.2. If you run using so many hosts as islands: We have
to run Island in every host.
> Host
8: Java Island 8 -o out8.txt -c config.txt
|
> Host
7: Java Island 7 -o out7.txt -c config.txt
|
> Host
6: Java Island 6 -o out6.txt -c config.txt
|
> Host
5: Java Island 5 -o out5.txt -c config.txt
|
> Host
4: Java Island 4 -o out4.txt -c config.txt
|
> Host
3: Java Island 3 -o out3.txt -c config.txt
|
> Host
2: Java Island 2 -o out2.txt -c config.txt
|
> Host
1: Java Island 1 -o out1.txt -c config.txt
|
You must remember that the leader island will be the last. In
Unix/Linux systems, you can also run the islands in all hosts
from one of them. This is done by remote way.
First, we have to create a new file in
the home directory called .rhosts, and we put inside the
hosts names (we can see the hosts names in the file etc/host of
each host) and the login:
File .rhosts
<hosts_name> <user_name>
For example:
sun1
victor |
sun2 victor
|
sun3 victor
|
sun4 victor |
sun5 victor |
sun6 victor |
sun7 victor |
sun8 victor |
Then, we must change the .rhosts permissions into read/write
for user. To do it, we have to run:
>
chmod 600 .rhost
Now, it is possible to do a remote connection with these hosts.
You can try to do:
>
rsh sun7 ls -al
Evidently, we aren't on host sun7.
Later, we make a script file similar to "execute",
named "execute_remote", that does all the remote
executions.
File execute_remote:
rsh
sun8 Java Island 8 -o out8.txt -c config.txt & |
rsh sun7 Java
Island 7 -o out7.txt -c config.txt & |
rsh sun6 Java
Island 6 -o out6.txt -c config.txt & |
rsh sun5 Java
Island 5 -o out5.txt -c config.txt & |
rsh sun4 Java
Island 4 -o out4.txt -c config.txt & |
rsh sun3 Java
Island 3 -o out3.txt -c config.txt & |
rsh sun2 Java
Island 2 -o out2.txt -c config.txt & |
sh delay_leader_remote |
File delay_leader_remote:
delay=0 |
until [ $delay
-eq 10000 ] |
do |
delay=`exp
$delay + 1` |
done |
Java Island
1 -o out1.txt -c config.txt |
Notice that we are in sun1, because we suppose that we only
have 8 hosts, but we can run the 8 hosts in a remote way,
from other host.
delay=0 |
until [ $delay
-eq 10000 ] |
do |
delay=`exp
$delay + 1` |
done |
rsh sun1 Java
Island 1 -o out1.txt -c config.txt |
Don't forget to include the other host in the .rhost file.
Finally, we execute the hosts:
> sh execute_remote