Archives


- Beowulf
- Beowulf Announce
- Scyld-users
- Beowulf on Debian

[Beowulf] Stupid MPI programming question

Many of your questions may have already been answered in earlier discussions or in the FAQ. The search results page will indicate current discussions as well as past list serves, articles, and papers.

Search

Michael Will mwill at penguincomputing.com
Wed Sep 27 20:54:34 PDT 2006


Silly question of mine - does the directory /tmp/oooo/ already exist on
the compute nodes?

-----Original Message-----
From: beowulf-bounces at beowulf.org [mailto:beowulf-bounces at beowulf.org]
On Behalf Of Clements, Brent M (SAIC)
Sent: Wednesday, September 27, 2006 8:37 PM
To: Leone B. Bosi; beowulf at beowulf.org
Subject: RE: [Beowulf] Stupid MPI programming question

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

 

 

_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org To change your subscription
(digest mode or unsubscribe) visit
http://www.beowulf.org/mailman/listinfo/beowulf




More information about the Beowulf mailing list