LAM MPI en Debian Etch

Dado el siguiente código:

#include <stdio.h>
#include “mpi.h”
int main(int argc, char **argv)
{
int taskid, numtasks;


MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &taskid);
MPI_Comm_size(MPI_COMM_WORLD, &numtasks);

printf("Soy %d y hay %d tareas en total\n", taskid, numtasks);

MPI_Finalize();
return 0;
}

Cómo compilar programas y ejecutarlos con LAM MPI en Debian Etch:

1. Instalar paquetes LAM:

apt-get install lam4c2 lam4-dev lam-runtime

2. Iniciar el servicio lamd. Esto hay que hacerlo una sola vez, cada vez que se reinicia la PC:

lamboot

3. Compilar el programa:

hcc -Wall -o programa programa.c

4. Ejecutar el programa en 4 nodos:

# mpirun.lam -np 4 programa -- "parametros"
Soy 0 y hay 4 tareas en total
Soy 1 y hay 4 tareas en total
Soy 2 y hay 4 tareas en total
Soy 3 y hay 4 tareas en total

2 Responses to “LAM MPI en Debian Etch”

  1. xavi Says:

    Muchas gracias tio!! me ha ayudado tu post a no tener que ir a los laboratorios para probar mis codigos en mpi.

    Gracias!!

  2. DavidB Says:

    Tio, GRACIAS!

Leave a Reply

Powered by WP Hashcash