Evolution of a Parallel Program

Prev Start Get Code

Compiling the Distributed Program

Compilation of the slave and master programs can be done from the directory the source lives in. The slave, called for example pvm_prime.c:
[scottyb@gil prime]$ make pvm_prime
gcc -D_REENTRANT -I/home/beowulf/scottyb/pvm/include -L/home/beowulf/scottyb/pvm/lib/LINUX  pvm_prime.c -o pvm_prime -lm -lpthread -lpvm3;
The resulting binary needs to be put where PVM can find it by copying it to the directory $PVM_ROOT/bin/$PVM_ARCH:
[scottyb@gil prime]$ cp pvm_prime $PVM_ROOT/bin/$PVM_ARCH/
The master program, called for example master.c:
[scottyb@gil prime]$ make master
gcc -I/home/beowulf/scottyb/pvm/include -L/home/beowulf/scottyb/pvm/lib/LINUX  master.c -o master -lpvm3
Can now be run giving the final desired result:
[scottyb@gil prime]$ ./master 10000000
Master task[40008]
Starting 15 PVM tasks: stride = 10000
664579 primes less than 1.0e+7, convergence = 6.65%
This program can be run from any directory, as PVM will know where to find the slave binaries specified by name in the master.c code.
Prev Start Get Code