Ejecutar un programa paralelizado con PVM
Veamos hello/hello_other, uno de los ejemplos que trae PVM (paquete pvm-examples). Este ejemplo usa el modelo master/esclavo, el más habitual en los programas paralelizados con PVM: dos programas que colaboran, uno se ejecuta en el master (hello) y otro se ejecuta en los esclavos (hello_other). Otra posibilidad es el modelo padre/hijo, un único programa padre que se ejecuta en el master y se forkea en procesos hijos que envía a los esclavos.
Ubicaremos los archivos fuente (hello.c y hello_other.c) en ~/pvm3/examples y los compilaremos con aimk, un wrapper para make de PVM (se generarán los ejecutables hello y hello_other en ~/pvm3/bin/LINUX):
$ cd ~/pvm3/examples $ aimk hello hello_other
Copiamos hello_other en los esclavos:
francis@master:~$ scp hello_other francis@slave1:~/pvm3/bin/LINUX/hello_otherEjecutaremos hello desde la consola PVM:
pvm> spawn -> hello [1:t40014] i'm t40014 [1:t40014] from t100006: hello, world from pc266
Si sólo tenemos activo el master el programa se ejecutará sólo en ese nodo:
pvm>$ spawn -> hello [1:t40036] i'm t40036 [1:t40036] from t40037: hello, world from master
También podemos ejecutar hello desde el shell:
$ helloDeja un comentario
