[Beowulf] Stupid MPI programming question

Clements, Brent M (SAIC) brent.clements at bp.com
Wed Sep 27 20:37:15 PDT 2006


Ok, here is the code I'm working with....mkdir keeps giving me a -1 failure...can anyone spot what I"m doing wrong?
 
#include <stdio.h>  /* all IO stuff lives here */
#include <stdlib.h> /* exit lives here */
#include <string.h> /* strcpy lives here */
#include <mpi.h>    /* MPI and MPI-IO live here */
#include <sys/stat.h>

#define MASTER_RANK 0
#define TRUE 1
#define FALSE 0
#define BOOLEAN int
int main( argc, argv )
    int argc;
    char* argv [];
    {
    int my_rank, i,pool_size;
    BOOLEAN i_am_the_master   = FALSE;
    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
    MPI_Comm_size(MPI_COMM_WORLD, &pool_size);
    if (my_rank == MASTER_RANK)
        i_am_the_master = TRUE;
  // MASTER CODE
    if (i_am_the_master)
        {
        }
    // SLAVE CODE (THIS IS WHERE THE MAGIC HAPPENS
        if (!i_am_the_master)
        {
         char fullpath[10000];
         sprintf(fullpath,"/tmp/oooo/RANK%d", my_rank);
         printf("MY PATH TO CREATE %s", fullpath);
         int mkdir_return;
         mkdir_return = mkdir(fullpath,0777);
         printf("mkdir results: %d\n", mkdir_return);
        }
    MPI_Finalize();
    exit(0);
    }

 

 




More information about the Beowulf mailing list