Problems with H5Pset_fapl_mpio

Hello,

I am having problems creating a file using PHDF5 v. 1.8.10 compiled with MPI. This model used fortran to pass information to C, to then run MPI-IO. Here is my procedure:

MPI initialization in C
/*==========================================================================*/
/*==========================================================================*/

void par_init_fortran (argc,fargv,farglen,machnum,machsize)
     int *argc,*farglen; char *fargv;
     int *machnum, *machsize;
{
  int i,numarg,carglen;
  char *argvp[20];
#if defined (RAMS_MPI)
  char **argv;
#endif

     numarg=*argc;
     carglen=*farglen;
    printf("par init numargs: %d %s %d %d\n",numarg,fargv,carglen,*machnum);

  for (i = 0; i < numarg; i++) {
    argvp[i]=&(fargv[i*carglen]);
    printf("par init args: %d %s %s\n",i,"argvp[i]",argvp[i]);
    }

#if defined (RAMS_MPI)
    printf("par init RAMS_MPI defined \n");
  argv=&(argvp[0]);
  MPI_Init(&numarg, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD,machnum);
  MPI_Comm_size(MPI_COMM_WORLD,machsize);
#endif

  printf("par_init: %d %d \n",*machnum,*machsize);
}
/*==========================================================================*/

C-call within fortran
      call fh5f_create(trim(locfn)//char(0), iaccess, hdferr, iparallel)

C routine that creates the HDF file
/******/
void fh5f_create(char *locfn, int *iaccess, int *hdferr, int *iparallel)
{

unsigned flags;
hid_t access_id,create_id;
//SEIGEL PHDF5
hid_t plist_id;
extern hid_t fileid;

access_id = H5P_DEFAULT;
create_id = H5P_DEFAULT;
if(*iaccess == 1) flags = H5F_ACC_TRUNC;
if(*iaccess == 2) flags = H5F_ACC_EXCL ;

//*************************************************************
// SEIGEL PHDF5
// This checks whether we are running in parallel mode
// if parallel==true, then we need to initialize PHF5 with
// property list
//*************************************************************
printf("fh5f_create: %c %d %d %d\n",*locfn,*iaccess,*hdferr,*iparallel);
if (*iparallel == 1)
   {
     //Set up file access property list with parallel I/O access
     plist_id = H5Pcreate(H5P_FILE_ACCESS);
printf("1 plist_id: %d",plist_id);
     H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPI_INFO_NULL);
printf("2");

Output:
fh5f_create: . 2 0 1
1 plist_id: 167772177

The process then just stalls in this location and never reaches the printf("2"); command. Any ideas?

Thanks!
Rob

···

____________________________
Robert Seigel, Ph.D.
Colorado State University
Department of Atmospheric Science
1371 Campus Delivery
Fort Collins, CO 80523
(970) 491-8331
rseigel@atmos.colostate.edu

Hi Rob,

H5Pset_fapl_mpio() is collective function. So It seems that the 'if' condition is not satisfied by all the processes. Could you verify that?

Jonathan

···

On 12/12/2012 10:21 PM, Robert Seigel wrote:

Hello,

I am having problems creating a file using PHDF5 v. 1.8.10 compiled with MPI. This model used fortran to pass information to C, to then run MPI-IO. Here is my procedure:

_MPI initialization in C_
/*==========================================================================*/

void par_init_fortran (argc,fargv,farglen,machnum,machsize)
     int *argc,*farglen; char *fargv;
     int *machnum, *machsize;
{
  int i,numarg,carglen;
  char *argvp[20];
#if defined (RAMS_MPI)
  char **argv;
#endif

     numarg=*argc;
     carglen=*farglen;
    printf("par init numargs: %d %s %d %d\n",numarg,fargv,carglen,*machnum);

  for (i = 0; i < numarg; i++) {
    argvp[i]=&(fargv[i*carglen]);
    printf("par init args: %d %s %s\n",i,"argvp[i]",argvp[i]);
    }

#if defined (RAMS_MPI)
    printf("par init RAMS_MPI defined \n");
  argv=&(argvp[0]);
  MPI_Init(&numarg, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD,machnum);
  MPI_Comm_size(MPI_COMM_WORLD,machsize);
#endif

  printf("par_init: %d %d \n",*machnum,*machsize);
}
/*==========================================================================*/

_C-call within fortran_
      call fh5f_create(trim(locfn)//char(0), iaccess, hdferr, iparallel)

_C routine that creates the HDF file_
/******/
void fh5f_create(char *locfn, int *iaccess, int *hdferr, int *iparallel)
{

unsigned flags;
hid_t access_id,create_id;
//SEIGEL PHDF5
hid_t plist_id;
extern hid_t fileid;

access_id = H5P_DEFAULT;
create_id = H5P_DEFAULT;
if(*iaccess == 1) flags = H5F_ACC_TRUNC;
if(*iaccess == 2) flags = H5F_ACC_EXCL ;

//*************************************************************
// SEIGEL PHDF5
// This checks whether we are running in parallel mode
// if parallel==true, then we need to initialize PHF5 with
// property list
//*************************************************************
printf("fh5f_create: %c %d %d %d\n",*locfn,*iaccess,*hdferr,*iparallel);
if (*iparallel == 1)
   {
     //Set up file access property list with parallel I/O access
     plist_id = H5Pcreate(H5P_FILE_ACCESS);
printf("1 plist_id: %d",plist_id);
     H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPI_INFO_NULL);
printf("2");

_Output:_
fh5f_create: . 2 0 1
1 plist_id: 167772177

The process then just stalls in this location and never reaches the printf("2"); command. Any ideas?

Thanks!
Rob

____________________________
Robert Seigel, Ph.D.
Colorado State University
Department of Atmospheric Science
1371 Campus Delivery
Fort Collins, CO 80523
(970) 491-8331
rseigel@atmos.colostate.edu <mailto:rseigel@atmos.colostate.edu>

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org