PDA

View Full Version : [C MPI] segmentation fault(coredump)


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();
}

andreapav
02-10-2008, 17:22
se può essere "di aiuto"...
compilo con
mpcc MPI_Sort.c
e avvio con
./a.out -rmpool 0 -procs 4

Unrue
02-10-2008, 18:23
Dovresti lanciare il tuo programma MPI con mpirun o qualcosa del genere, dipendente dalla tua implementazione MPI. Non puoi lanciarlo così a dritto..

andreapav
02-10-2008, 19:05
l'errore stava che non avevo creato il file host.list per dirgli che processori usre oppure il file file.job che fa lo stesso... o meglio... quest'ultimo l'avevo fatto ma non ho invocato il comando "llsubmit file.job"

attenti comunque che con il .job l'output va nel file che scrivete voi alla voce oputput...!

altro comando da segnalare: "llq" che vi dice a che punto è il vostro programma per l'esecuzione...

Unrue
03-10-2008, 11:42
l'errore stava che non avevo creato il file host.list per dirgli che processori usre oppure il file file.job che fa lo stesso... o meglio... quest'ultimo l'avevo fatto ma non ho invocato il comando "llsubmit file.job"

attenti comunque che con il .job l'output va nel file che scrivete voi alla voce oputput...!

altro comando da segnalare: "llq" che vi dice a che punto è il vostro programma per l'esecuzione...

Quindi stai usando Load Leveler?