I neglected in my earlier post to attach the small C code that the hdf5
folks supplied; it is attached here.




On Wed, Jan 15, 2014 at 10:04 AM, Ronald Cohen <rhco...@lbl.gov> wrote:

> I have been struggling trying to get a usable build of openmpi on Mac OSX
> Mavericks (10.9.1).  I can get openmpi to configure and build without
> error, but have problems after that which depend on the openmpi version.
>
> With 1.6.5, make check fails the opal_datatype_test, ddt_test, and ddt_raw
> tests.  The various atomic_* tests pass.    See checklogs_1.6.5, attached
> as a .gz file.
>
> Following suggestions from openmpi discussions I tried openmpi version
> 1.7.4rc1.  In this case make check indicates all tests passed.  But when I
> proceeded to try to build a parallel code (parallel HDF5) it failed.
> Following an email exchange with the HDF5 support people, they suggested I
> try to compile and run the attached bit of simple code Sample_mpio.c (which
> they supplied) which does not use any HDF5, but just attempts a parallel
> write to a file and parallel read.   That test failed when requesting more
> than 1 processor -- which they say indicates a failure of the openmpi
> installation.   The error message was:
>
> MPI_INIT: argc 1
> MPI_INIT: argc 1
> Testing simple C MPIO program with 2 processes accessing file
> ./mpitest.data
>     (Filename can be specified via program argument)
> Proc 0: hostname=Ron-Cohen-MBP.local
> Proc 1: hostname=Ron-Cohen-MBP.local
> MPI_BARRIER[0]: comm MPI_COMM_WORLD
> MPI_BARRIER[1]: comm MPI_COMM_WORLD
> Proc 0: MPI_File_open with MPI_MODE_EXCL failed (MPI_ERR_FILE: invalid
> file)
> MPI_ABORT[0]: comm MPI_COMM_WORLD errorcode 1
> MPI_BCAST[1]: buffer 7fff5a483048 count 1 datatype MPI_INT root 0 comm
> MPI_COMM_WORLD
>
> I then went back to my openmpi directories and tried running some of the
> individual tests in the test and examples directories.  In particular in
> test/class I found one test that seem to not be run as part of make check
> which failed, even with one processor; this is opal_bitmap.  Not sure if
> this is because 1.7.4rc1 is incomplete, or there is something wrong with
> the installation, or maybe a 32 vs 64 bit thing?   The error message is
>
> mpirun detected that one or more processes exited with non-zero status,
> thus causing the job to be terminated. The first process to do so was:
>
>   Process name: [[48805,1],0]
>   Exit code:    255
>
> Any suggestions?
>
> More generally has anyone out there gotten an openmpi build on Mavericks
> to work with sufficient success that they can get the attached
> Sample_mpio.c (or better yet, parallel HDF5) to build?
>
> Details: Running Mac OS X 10.9.1 on a mid-2009 Macbook pro with 4 GB
> memory; tried openmpi 1.6.5 and 1.7.4rc1.  Built openmpi against the stock
> gcc that comes with XCode 5.0.2, and gfortran 4.9.0.
>
> Files attached: config.log.gz, openmpialllog.gz (output of running
> ompi_info --all), checklog2.gz (output of make.check in top openmpi
> directory).
>
> I am not attaching logs of make and install since those seem to have been
> successful, but can generate those if that would be helpful.
>
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the files COPYING and Copyright.html.  COPYING can be found at the root   *
 * of the source code distribution tree; Copyright.html can be found at the  *
 * root level of an installed copy of the electronic HDF5 document set and   *
 * is linked from the top-level documents page.  It can also be found at     *
 * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
 * access to either file, you may request a copy from h...@hdfgroup.org.     *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Simple MPI-IO program testing if a parallel file can be created.
 * Default filename can be specified via first program argument.
 * Each process writes something, then reads all data back.
 */

#include <stdio.h>
#include <mpi.h>
#ifndef MPI_FILE_NULL           /*MPIO may be defined in mpi.h already       */
#   include <mpio.h>
#endif

#define DIMSIZE	10		/* dimension size, avoid powers of 2. */
#define PRINTID printf("Proc %d: ", mpi_rank)

main(int ac, char **av)
{
    char hostname[128];
    int  mpi_size, mpi_rank;
    MPI_File fh;
    char *filename = "./mpitest.data";
    char mpi_err_str[MPI_MAX_ERROR_STRING];
    int  mpi_err_strlen;
    int  mpi_err;
    char writedata[DIMSIZE], readdata[DIMSIZE];
    char expect_val;
    int  i, irank; 
    int  nerrors = 0;		/* number of errors */
    MPI_Offset  mpi_off;
    MPI_Status  mpi_stat;

    MPI_Init(&ac, &av);
    MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
    MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);

    /* get file name if provided */
    if (ac > 1){
	filename = *++av;
    }
    if (mpi_rank==0){
	printf("Testing simple C MPIO program with %d processes accessing file %s\n",
	    mpi_size, filename);
        printf("    (Filename can be specified via program argument)\n");
    }

    /* show the hostname so that we can tell where the processes are running */
    if (gethostname(hostname, 128) < 0){
	PRINTID;
	printf("gethostname failed\n");
	MPI_Abort(MPI_COMM_WORLD, 1);
    }
    PRINTID;
    printf("hostname=%s\n", hostname);

    if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename,
	    MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE,
	    MPI_INFO_NULL, &fh))
	    != MPI_SUCCESS){
	MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
	PRINTID;
	printf("MPI_File_open failed (%s)\n", mpi_err_str);
	MPI_Abort(MPI_COMM_WORLD, 1);
    }

    /* each process writes some data */
    for (i=0; i < DIMSIZE; i++)
	writedata[i] = mpi_rank*DIMSIZE + i;
    mpi_off = mpi_rank*DIMSIZE;
    if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, MPI_BYTE,
	    &mpi_stat))
	    != MPI_SUCCESS){
	MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
	PRINTID;
	printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n",
		(long) mpi_off, (int) DIMSIZE, mpi_err_str);
	MPI_Abort(MPI_COMM_WORLD, 1);
    };

    /* make sure all processes has done writing. */
    MPI_Barrier(MPI_COMM_WORLD);

    /* each process reads all data and verify. */
    for (irank=0; irank < mpi_size; irank++){
	mpi_off = irank*DIMSIZE;
	if ((mpi_err = MPI_File_read_at(fh, mpi_off, readdata, DIMSIZE, MPI_BYTE,
		&mpi_stat))
		!= MPI_SUCCESS){
	    MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
	    PRINTID;
	    printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n",
		    (long) mpi_off, (int) DIMSIZE, mpi_err_str);
	    MPI_Abort(MPI_COMM_WORLD, 1);
	};
	for (i=0; i < DIMSIZE; i++){
	    expect_val = irank*DIMSIZE + i;
	    if (readdata[i] != expect_val){
		PRINTID;
		printf("read data[%d:%d] got %d, expect %d\n", irank, i,
			readdata[i], expect_val);
		nerrors++;
	    }
	}
    }
    if (nerrors)
	MPI_Abort(MPI_COMM_WORLD, 1);

    MPI_File_close(&fh);

    /* Verify that created file is deleted upon closing. */
    if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDWR,
	    MPI_INFO_NULL, &fh))
	    == MPI_SUCCESS){
	MPI_File_close(&fh);
	PRINTID;
	printf("File existed. MPI_MODE_DELETE_ON_CLOSE failed.\n");
	MPI_Abort(MPI_COMM_WORLD, 1);
    }

    /* Verify that MPI_MODE_EXCL works correctly with non-existing file.
     * It has been reported that this fails in the Panasas parallel filesystem
     * using the PathScale MPI. (See Bug 1468)
     */
    if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename,
	    MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_EXCL,
	    MPI_INFO_NULL, &fh))
	    != MPI_SUCCESS){
	MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
	PRINTID;
	printf("MPI_File_open with MPI_MODE_EXCL failed (%s)\n", mpi_err_str);
	MPI_Abort(MPI_COMM_WORLD, 1);
    }
    MPI_File_close(&fh);

    /* Verify MPI_File_delete works. Only 1 calls, the other waits. */
    if (mpi_rank==0){
	if ((mpi_err = MPI_File_delete(filename, MPI_INFO_NULL)) != MPI_SUCCESS)
	    MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
    }
    MPI_Bcast(&mpi_err, 1, MPI_INT, 0, MPI_COMM_WORLD);
    if (mpi_err != MPI_SUCCESS){
       if (mpi_rank==0){
	    PRINTID;
	    printf("MPI_File_delete failed (%s)\n", mpi_err_str);
	}
	MPI_Abort(MPI_COMM_WORLD, 1);
    }

    /* Check file no longer exist. */
    if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDWR,
	    MPI_INFO_NULL, &fh))
	    == MPI_SUCCESS){
	MPI_File_close(&fh);
	PRINTID;
	printf("File existed. MPI_File_delete failed.\n");
	MPI_Abort(MPI_COMM_WORLD, 1);
    }


    PRINTID;
    printf("all tests passed\n");

    MPI_Finalize();
    return 0;
}

Reply via email to