Hi,

Sorry by the multiples messages. I rewrote my program and executed it
again. This time a weird error ocurred. My program create the file
"teste.txt" but with these permissions:

[EMAIL PROTECTED]:/mnt/pvfs2/davivercillo$ ls -l
total 16
-rwxr-xr-x 1 davivercillo users 8674 2008-05-14 16:02 helloMPI
-rw-r--r-- 1 davivercillo users  112 2008-05-14 16:02 helloMPI.qsub
?--------- ? ?            ?        ?                ? teste.txt

This time, my program is:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mpi.h"

int main(int argc, char** argv) {
    int my_rank;          /* Rank of process */
    int p;                /* Number of processes */
    int source;           /* Rank of sender */
    int dest;             /* Rank of receiver */
    int tag = 50;         /* Tag for messages */
    char message[100];    /* Storage for the message */
    MPI_Status status;    /* Return status for receive */
    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
    MPI_Comm_size(MPI_COMM_WORLD, &p);

    FILE *pfile;

    if (my_rank != 0) {
        sprintf(message, "Greetings from process %d!", my_rank);
        dest = 0;
        MPI_Send(message, strlen(message)+1, MPI_CHAR, dest, tag,
MPI_COMM_WORLD);

    } else { /* my_rank == 0 */
        for (source = 1 ; source < p ; source++) {
             MPI_Recv(message, 100, MPI_CHAR, source, tag,
MPI_COMM_WORLD, &status);
             pfile = fopen("teste.txt","a");
             fprintf(pfile,"%s\n", message);
        }

        fclose(pfile);
    }

    MPI_Finalize();

    return 0;
}

This program works fine on NFS.

-- 
Davi Vercillo Carneiro Garcia

Universidade Federal do Rio de Janeiro
Departamento de Ciência da Computação
DCC-IM/UFRJ - http://www.dcc.ufrj.br

"Good things come to those who... wait." - Debian Project

"A computer is like air conditioning: it becomes useless when you open
windows." - Linus Torvalds

"Há duas coisas infinitas, o universo e a burrice humana. E eu estou
em dúvida quanto o primeiro." - Albert Einstein

_______________________________________________
Pvfs2-users mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users

Reply via email to