simple.c
/*****************************************************************/
/* */
/* Petit programme minimal en MPI */
/* */
/*****************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <mpi.h>
#include <sys/time.h>
#define BUFLEN 65536
long ms_time()
{
struct timeval tv;
gettimeofday(&tv, NULL);
return(tv.tv_sec/1000 + tv.tv_usec*1000);
}
void long_computation()
{
long now=ms_time();
while(ms_time()<now+4000)
{
}
}
int main(int argc, char **argv)
{
int nb_proc;
int my_id;
int buffer[BUFLEN];
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&nb_proc);
MPI_Comm_rank(MPI_COMM_WORLD,&my_id);
printf("Je suis le processus P%d et nous sommes %d au total.\n",
my_id, nb_proc);
MPI_Finalize();
return (0);
}
Generated by GNU enscript 1.6.3.