Program 1 FAQ/Tips
1. You can do a man on PVM 3 routines. E.g.:
prompt> man pvm_joingroup
prompt> man pvm_catchout
2. Where can I find a working Makefile.aimk for program 1?
Download Makefile.aimk
Note that PVMDIR needs to be the absolute path to your pvm3 directory.
E.g. /home/solaris/ieng9/cs160s/yourusename/pvm3
3. I'm getting weird compilation errors about pvm3 libraries
that can't be found. How can I fix this?
A. Make sure your directory structure exactly matches that described in
the pvm primer. That is, pvm3 should be the top, then
bin,conf,examples,include,prog1,lib under that.
B. Also, when setting PVMDIR as described in the pvm primer, PVMDIR must
be the absolute path to the pvm3 directory. E.g.
/home/solaris/ieng9/oce...
C. You must have the /pvm3/examples directory
Thanks to Mike Houston for these tips.
4. What format should the host file be in and how do we
determine the number of hosts?
The host file should be of the format:
host1\n
host2\n
host3\n
.
.
.
host4\n
The number of hosts can be determined by counting the number of host names
read in from the host file.
5. How do we determine the name of the host on which a task is running?
Use pvm_tidtohost (mytid) to get the task id of the PVM daemon on
the host. Use hostp of the type pvmhostinfo struct initialized by
pvm_config( &nhost, &narch, &hostp ) to find the hostname that corresponds
to the daemon task id. After calling pvm_config, hostp will have a
pointer to an array of structures, each of which contains infomation on
the host. Do a 'man pvm_config' to find out more about the pvmhostinfo
struct.
6. What UNIX command do we use to determine the load?
Get the load from the output of the 'uptime' command. For example, from
this output of uptime:
9:32pm up 74 day(s), 5:14, 130 users, load average: 0.70, 0.78, 0.81
use the first float that appears after the words "load average" (0.70 in
this case).
7. What should the format of our final output be?
Your output must be in the following format:
instance: 0
hostname: hostname0
tid: tid0
load: load0
\n
instance: 1
hostname: hostname1
tid: tid1
load: load1
.
.
.
instance: N-1
hostname: hostnameN-1
tid: tidN-1
load: loadN-1
average load: averageLoadAsFloat
Please make sure your output matches this format exactly (including case).
7. My program seems to be executing inconsistently. What's the deal?
Try typing 'reset' at the pvm console to kill any errant tasks.
8. How do we redirect the output of uptime?
Use popen/pclose to open up a stream, which you may use like any FILE *.
9. Hint: you could use myLauncher to test the ringGatherer and
treeGatherer.
10. If you're having trouble passing the load as a float
(e.g. you can't type cast it to a void *, or you can't make a deep copy of
its string representation), you may pass it as an int.
11. Don't worry about printing the tree gather info in tree
order if you haven't done this already.
12. It's getting late and nothing seems to be
working. !@%@$@$%!$^@#. What do I do?
Try your best to get myLauncher working. Once you get that done, try your
best to pack and unpack ndata among the N processes for the ringGatherer
and the treeGatherer so that task 0 can print out the resulting value of
ndata. Don't worry about the rest of the data until you can successfully
pass ndata to each task until it reaches process 0. Finally, try to pass
the rest of the data (instance id, ...).