andreapav
02-10-2008, 17:11
ciao... ho un problema con le MPI... avvio un programma che non fa niente, non alloca memoria...non fra un tubo!!! e mi dice: segmentationfault(coredump)... qualcuno ha idea da cosa sia dovuto?
vi posto il codice...
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <mpi.h>
#define DEBUG
#define INIT 1 /* Message giving size and height */
#define DATA 2 /* Message giving vector to sort */
#define ANSW 3 /* Message returning sorted vector */
#define FINI 4 /* Send permission to terminate */
int main ( int argc, char* argv[] )
{
int myRank, nProc;
int rc;
int size; /* Size of the vector being sorted */
MPI_Status status; /* required by MPI_Recv */
printf ("Avviato!");
rc = MPI_Init(&argc, &argv);
if ( rc < 0 )
{
puts ("Failed to enroll in MPI. Abort!");
exit(-1);
}
size = 1000; /* atoi(argv[1]); */
rc = MPI_Comm_rank (MPI_COMM_WORLD, &myRank);
rc = MPI_Comm_size (MPI_COMM_WORLD, &nProc);
printf ("Started rank %d\n", myRank);
if ( myRank == 0 ) /* Host process */
{
printf("porca vacca sono il processore 0...\n");
}
else /* Node process */
{
printf ("%d resigning from MPI\n", myRank);
MPI_Finalize();
return 0;
}
/* Only the rank-0 process executes here. */
printf ("%d resigning from MPI\n", myRank);
printf ("" );
printf ("" );
printf ("");
MPI_Finalize();
}
vi posto il codice...
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <mpi.h>
#define DEBUG
#define INIT 1 /* Message giving size and height */
#define DATA 2 /* Message giving vector to sort */
#define ANSW 3 /* Message returning sorted vector */
#define FINI 4 /* Send permission to terminate */
int main ( int argc, char* argv[] )
{
int myRank, nProc;
int rc;
int size; /* Size of the vector being sorted */
MPI_Status status; /* required by MPI_Recv */
printf ("Avviato!");
rc = MPI_Init(&argc, &argv);
if ( rc < 0 )
{
puts ("Failed to enroll in MPI. Abort!");
exit(-1);
}
size = 1000; /* atoi(argv[1]); */
rc = MPI_Comm_rank (MPI_COMM_WORLD, &myRank);
rc = MPI_Comm_size (MPI_COMM_WORLD, &nProc);
printf ("Started rank %d\n", myRank);
if ( myRank == 0 ) /* Host process */
{
printf("porca vacca sono il processore 0...\n");
}
else /* Node process */
{
printf ("%d resigning from MPI\n", myRank);
MPI_Finalize();
return 0;
}
/* Only the rank-0 process executes here. */
printf ("%d resigning from MPI\n", myRank);
printf ("" );
printf ("" );
printf ("");
MPI_Finalize();
}