• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ H5Pset_fapl_mpio函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中H5Pset_fapl_mpio函数的典型用法代码示例。如果您正苦于以下问题:C++ H5Pset_fapl_mpio函数的具体用法?C++ H5Pset_fapl_mpio怎么用?C++ H5Pset_fapl_mpio使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了H5Pset_fapl_mpio函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: create_faccess_plist

/*
 * Create the appropriate File access property list
 */
hid_t
create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type,
                     hbool_t use_gpfs)
{
    hid_t ret_pl = -1;
    herr_t ret;                 /* generic return value */
    int mpi_rank;		/* mpi variables */

    /* need the rank for error checking macros */
    MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);

    ret_pl = H5Pcreate (H5P_FILE_ACCESS);
    VRFY((ret_pl >= 0), "H5P_FILE_ACCESS");

    if (l_facc_type == FACC_DEFAULT)
        return (ret_pl);

    if (l_facc_type == FACC_MPIO) {
        /* set Parallel access with communicator */
        ret = H5Pset_fapl_mpio(ret_pl, comm, info);
        VRFY((ret >= 0), "");
        return(ret_pl);
    }

    if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) {
        hid_t mpio_pl;

        mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
        VRFY((mpio_pl >= 0), "");
        /* set Parallel access with communicator */
        ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
        VRFY((ret >= 0), "");

        /* setup file access template */
        ret_pl = H5Pcreate (H5P_FILE_ACCESS);
        VRFY((ret_pl >= 0), "");
        /* set Parallel access with communicator */
        ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
        VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
        H5Pclose(mpio_pl);
        return(ret_pl);
    }

    if (l_facc_type == FACC_MPIPOSIX) {
        /* set Parallel access with communicator */
        ret = H5Pset_fapl_mpiposix(ret_pl, comm, use_gpfs);
        VRFY((ret >= 0), "H5Pset_fapl_mpiposix succeeded");
        return(ret_pl);
    }

    /* unknown file access types */
    return (ret_pl);
}
开发者ID:jackygrahamez,项目名称:DrugDiscovery-Home,代码行数:56,代码来源:testphdf5.c


示例2: defined

  void hdf_archive::set_access_plist(bool use_collective, Communicate* comm)
  {
    access_id=H5P_DEFAULT;
    if(comm && comm->size()>1) //for parallel communicator
    {
      if(use_collective)
      {
#if defined(H5_HAVE_PARALLEL) && defined(ENABLE_PHDF5)
        MPI_Info info=MPI_INFO_NULL;
        access_id = H5Pcreate(H5P_FILE_ACCESS);
        H5Pset_fapl_mpio(access_id,comm->getMPI(),info);
        xfer_plist = H5Pcreate(H5P_DATASET_XFER);
        H5Pset_dxpl_mpio(xfer_plist,H5FD_MPIO_COLLECTIVE);
#else
        use_collective=false;//cannot use collective
#endif
      }
      //true, if this task does not need to participate in I/O
      Mode.set(IS_PARALLEL,use_collective);
      Mode.set(NOIO,comm->rank()&&!use_collective);
    }
    else
    {
      Mode.set(IS_PARALLEL,false);
      Mode.set(NOIO,false);
    }
  }
开发者ID:digideskio,项目名称:qmcpack,代码行数:27,代码来源:hdf_archive.cpp


示例3: PetscViewerFileSetName_HDF5

PetscErrorCode  PetscViewerFileSetName_HDF5(PetscViewer viewer, const char name[])
{
  PetscViewer_HDF5 *hdf5 = (PetscViewer_HDF5*) viewer->data;
#if defined(PETSC_HAVE_H5PSET_FAPL_MPIO)
  MPI_Info          info = MPI_INFO_NULL;
#endif
  hid_t             plist_id;
  herr_t            herr;
  PetscErrorCode    ierr;

  PetscFunctionBegin;
  ierr = PetscStrallocpy(name, &hdf5->filename);CHKERRQ(ierr);
  /* Set up file access property list with parallel I/O access */
  plist_id = H5Pcreate(H5P_FILE_ACCESS);
#if defined(PETSC_HAVE_H5PSET_FAPL_MPIO)
  herr = H5Pset_fapl_mpio(plist_id, PetscObjectComm((PetscObject)viewer), info);CHKERRQ(herr);
#endif
  /* Create or open the file collectively */
  switch (hdf5->btype) {
  case FILE_MODE_READ:
    hdf5->file_id = H5Fopen(name, H5F_ACC_RDONLY, plist_id);
    break;
  case FILE_MODE_APPEND:
    hdf5->file_id = H5Fopen(name, H5F_ACC_RDWR, plist_id);
    break;
  case FILE_MODE_WRITE:
    hdf5->file_id = H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id);
    break;
  default:
    SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER, "Must call PetscViewerFileSetMode() before PetscViewerFileSetName()");
  }
  if (hdf5->file_id < 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, "H5Fcreate failed for %s", name);
  H5Pclose(plist_id);
  PetscFunctionReturn(0);
}
开发者ID:ZJLi2013,项目名称:petsc,代码行数:35,代码来源:hdf5v.c


示例4: _io_domain_commit

void _io_domain_commit(cow_domain *d)
{
#if (COW_HDF5)
  for (int n=0; n<d->n_dims; ++n) {
    d->L_nint_h5[n] = d->L_nint[n]; // Selection size, target and destination
    d->L_ntot_h5[n] = d->L_ntot[n]; // Memory space total size
    d->L_strt_h5[n] = d->L_strt[n]; // Memory space selection start
    d->G_ntot_h5[n] = d->G_ntot[n]; // Global space total size
    d->G_strt_h5[n] = d->G_strt[n]; // Global space selection start
  }
  // Here we create the following property lists:
  //
  // file access property list   ........ for the call to H5Fopen
  // dset creation property list ........ for the call to H5Dcreate
  // dset transfer property list ........ for the call to H5Dwrite
  // ---------------------------------------------------------------------------
  d->fapl = H5Pcreate(H5P_FILE_ACCESS);
  d->dcpl = H5Pcreate(H5P_DATASET_CREATE);
  d->dxpl = H5Pcreate(H5P_DATASET_XFER);
#if (COW_HDF5_MPI && COW_MPI)
  if (cow_mpirunning()) {
    H5Pset_fapl_mpio(d->fapl, d->mpi_cart, MPI_INFO_NULL);
  }
#endif // COW_HDF5_MPI && COW_MPI
#endif // COW_HDF5
}
开发者ID:darien0,项目名称:cow,代码行数:26,代码来源:io.c


示例5: buf_size

OHDF5mpipp::OHDF5mpipp(std::string filename, int buf_size, nestio::Logger_type logger_type)
: buf_size(buf_size), RANK(2), logger_type(logger_type)
{
	//Init HDF5 file
	MPI_Comm_size(MPI_COMM_WORLD, &clientscount);
	
	hid_t fapl_id;
	fapl_id = H5Pcreate(H5P_FILE_ACCESS);
	H5Pset_fapl_mpio(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL);
    /* Create _a new file. If file exists its contents will be overwritten. */
	file = H5Fcreate (filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
	
	
	MPI_Comm_rank (MPI_COMM_WORLD, &own_id);
	
	int num_threads=omp_get_max_threads();
	if (logger_type == nestio::Buffered || logger_type == nestio::Collective) {
	  
	  buffer_multi = new oHDF5Buffer;
	  buffer_spike = new oHDF5Buffer;
	  //for (int i=0; i<num_threads;i++) {
	  buffer_multi->extend(buf_size*num_threads);
	  buffer_spike->extend(buf_size*num_threads);
	  //}
	}
	
	H5Pclose(fapl_id);
}
开发者ID:tillschumann,项目名称:nestio_inm6,代码行数:28,代码来源:ohdf5mpipp.cpp


示例6: open

hid_t seissol::checkpoint::h5::Fault::initFile(int odd, const char* filename)
{
	hid_t h5file;

	if (loaded()) {
		// Open the file
		h5file = open(filename, false);
		checkH5Err(h5file);

		// Fault writer
		m_h5timestepFault[odd] = H5Aopen(h5file, "timestep_fault", H5P_DEFAULT);
		checkH5Err(m_h5timestepFault[odd]);

		// Data
		for (unsigned int i = 0; i < NUM_VARIABLES; i++) {
			m_h5data[odd][i] = H5Dopen(h5file, VAR_NAMES[i], H5P_DEFAULT);
			checkH5Err(m_h5data[odd][i]);
		}
	} else {
		// Create the file
		hid_t h5plist = H5Pcreate(H5P_FILE_ACCESS);
		checkH5Err(h5plist);
		checkH5Err(H5Pset_libver_bounds(h5plist, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST));
#ifdef USE_MPI
		checkH5Err(H5Pset_fapl_mpio(h5plist, comm(), MPI_INFO_NULL));
#endif // USE_MPI

		h5file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, h5plist);
		checkH5Err(h5file);
		checkH5Err(H5Pclose(h5plist));

		// Create scalar dataspace for attributes
		hid_t h5spaceScalar = H5Screate(H5S_SCALAR);
		checkH5Err(h5spaceScalar);

		// Fault writer
		m_h5timestepFault[odd] = H5Acreate(h5file, "timestep_fault",
				H5T_STD_I32LE, h5spaceScalar, H5P_DEFAULT, H5P_DEFAULT);
		checkH5Err(m_h5timestepFault[odd]);
		int t = 0;
		checkH5Err(H5Awrite(m_h5timestepFault[odd], H5T_NATIVE_INT, &t));

		checkH5Err(H5Sclose(h5spaceScalar));

		// Variables
		for (unsigned int i = 0; i < NUM_VARIABLES; i++) {
			h5plist = H5Pcreate(H5P_DATASET_CREATE);
			checkH5Err(h5plist);
			checkH5Err(H5Pset_layout(h5plist, H5D_CONTIGUOUS));
			checkH5Err(H5Pset_alloc_time(h5plist, H5D_ALLOC_TIME_EARLY));
			m_h5data[odd][i] = H5Dcreate(h5file, VAR_NAMES[i], H5T_IEEE_F64LE, m_h5fSpaceData,
				H5P_DEFAULT, h5plist, H5P_DEFAULT);
			checkH5Err(m_h5data[odd][i]);
			checkH5Err(H5Pclose(h5plist));
		}
	}

	return h5file;
}
开发者ID:fsimonis,项目名称:SeisSol,代码行数:59,代码来源:Fault.cpp


示例7: readConvergence

/* ------- begin -------------------------- readConvergence.c  --- */
void readConvergence(void) {
  /* This is a self-contained function to read the convergence matrix,
     written by RH. */
  const char routineName[] = "readConvergence";
  char *atmosID;
  int ncid, ncid_mpi, nx, ny;
  size_t attr_size;
  hid_t plist;
  H5T_class_t type_class;

  mpi.rh_converged = matrix_int(mpi.nx, mpi.ny);

  /* --- Open the inputdata file --- */
  if (( plist = H5Pcreate(H5P_FILE_ACCESS )) < 0) HERR(routineName);
  if (( H5Pset_fapl_mpio(plist, mpi.comm, mpi.info) ) < 0) HERR(routineName);
  if (( ncid = H5Fopen(INPUTDATA_FILE, H5F_ACC_RDWR, plist) ) < 0)
    HERR(routineName);
  if (( H5Pclose(plist) ) < 0) HERR(routineName);
  /* Get ncid of the MPI group */
  if (( ncid_mpi = H5Gopen(ncid, "mpi", H5P_DEFAULT) ) < 0) HERR(routineName);

  /* --- Consistency checks --- */
  /* Check that atmosID is the same */
  if (( H5LTget_attribute_info(ncid, "/", "atmosID", NULL, &type_class,
                               &attr_size) ) < 0) HERR(routineName);
  atmosID = (char *) malloc(attr_size + 1);
  if (( H5LTget_attribute_string(ncid, "/", "atmosID", atmosID) ) < 0)
    HERR(routineName);
  if (!strstr(atmosID, atmos.ID)) {
    sprintf(messageStr,
       "Indata file was calculated for different atmosphere (%s) than current",
	     atmosID);
    Error(WARNING, routineName, messageStr);
    }
  free(atmosID);
  /* Check that dimension sizes match */
  if (( H5LTget_attribute_int(ncid, "/", "nx", &nx) ) < 0) HERR(routineName);
  if (nx != mpi.nx) {
    sprintf(messageStr,
	    "Number of x points mismatch: expected %d, found %d.",
	    mpi.nx, (int)nx);
    Error(WARNING, routineName, messageStr);
  }
  if (( H5LTget_attribute_int(ncid, "/", "ny", &ny) ) < 0) HERR(routineName);
  if (ny != mpi.ny) {
    sprintf(messageStr,
	    "Number of y points mismatch: expected %d, found %d.",
	    mpi.ny, (int)ny);
    Error(WARNING, routineName, messageStr);
  }
  /* --- Read variable --- */
  if (( H5LTread_dataset_int(ncid_mpi, CONV_NAME,
                             mpi.rh_converged[0]) ) < 0) HERR(routineName);
  /* --- Close inputdata file --- */
  if (( H5Gclose(ncid_mpi) ) < 0) HERR(routineName);
  if (( H5Fclose(ncid) ) < 0) HERR(routineName);
  return;
}
开发者ID:kouui,项目名称:rh,代码行数:59,代码来源:writeindata_p.c


示例8: parse_options

/*
 * parse the command line options
 */
static int
parse_options(int argc, char **argv)
{
    while (--argc){
  if (**(++argv) != '-'){
      break;
  }else{
      switch(*(*argv+1)){
    case 'v':   if (*((*argv+1)+1))
        ParseTestVerbosity((*argv+1)+1);
          else
        SetTestVerbosity(VERBO_MED);
          break;
    case 'f':   if (--argc < 1) {
        nerrors++;
        return(1);
          }
          if (**(++argv) == '-') {
        nerrors++;
        return(1);
          }
          paraprefix = *argv;
          break;
    case 'h':   /* print help message--return with nerrors set */
          return(1);
    default:    nerrors++;
          return(1);
      }
  }
    } /*while*/

    /* compose the test filenames */
    {
  int i, n;
  hid_t plist;

  plist = H5Pcreate (H5P_FILE_ACCESS);
  H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL);
  n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1;  /* exclude the NULL */

  for (i=0; i < n; i++)
      if (h5_fixname(FILENAME[i],plist,filenames[i],sizeof(filenames[i]))
    == NULL){
    printf("h5_fixname failed\n");
    nerrors++;
    return(1);
      }
  H5Pclose(plist);
  if (VERBOSE_MED){
      printf("Test filenames are:\n");
      for (i=0; i < n; i++)
    printf("    %s\n", filenames[i]);
  }
    }

    return(0);
}
开发者ID:ArielleBassanelli,项目名称:gempak,代码行数:60,代码来源:t_mpi.c


示例9: releaseSignal

void BigArray<T>::loadNC(const std::string &fileName)
{
    dataFileName = fileName;

    connection.disconnect();
    connection = releaseSignal().connect(boost::bind(&gurls::BigArray<T>::close, this));

    std::string errorString = "Error opening file " + fileName + ":";


    // Set up file access property list with parallel I/O access
    plist_id = H5Pcreate(H5P_FILE_ACCESS);
    if(plist_id == -1)
        throw gException(errorString);

    herr_t status;

#ifdef USE_MPIIO
    status = H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPI_INFO_NULL);
#else
    status = H5Pset_fapl_mpiposix(plist_id, MPI_COMM_WORLD, false);
#endif
    CHECK_HDF5_ERR(status, errorString)

    // Create a new file collectively and release property list identifier.
    file_id = H5Fopen(fileName.c_str(), H5F_ACC_RDWR, plist_id);
    CHECK_HDF5_ERR(file_id, errorString)

    status = H5Pclose(plist_id);
    CHECK_HDF5_ERR(status, errorString)

    dset_id =  H5Dopen(file_id, "mat", H5P_DEFAULT);
    CHECK_HDF5_ERR(dset_id, errorString)

    hid_t filespace = H5Dget_space( dset_id );
    CHECK_HDF5_ERR(filespace, errorString)

    hsize_t dims[2], maxDims[2];
    status = H5Sget_simple_extent_dims(filespace, dims, maxDims);
    CHECK_HDF5_ERR(status, errorString)

    status = H5Sclose(filespace);
    CHECK_HDF5_ERR(status, errorString)

    this->numrows = static_cast<unsigned long>(dims[1]);
    this->numcols = static_cast<unsigned long>(dims[0]);

    // Create property list for collective dataset write.
    plist_id = H5Pcreate(H5P_DATASET_XFER);
    if(plist_id == -1)
        throw gException(errorString);

    status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_INDEPENDENT);
    CHECK_HDF5_ERR(status, errorString)

}
开发者ID:elen4,项目名称:GURLS,代码行数:56,代码来源:bigarray.hpp


示例10: dtkError

void pHdf5IoDataModel::fileOpen(const QString &file_name, FileMode mode)
{
    //if file is already open tell it to the user and return
    if(!d->file_is_open) {

        //if we didn't set the communicator error
        if(d->comm==nullptr) {
            dtkError() << __func__ << "communicator not set";
        }

        // H5P_FILE_ACCESS applies to H5Fcreate and H5Fopen
        d->prop_list_id = H5Pcreate(H5P_FILE_ACCESS);

        MPI_Info info = MPI_INFO_NULL;
        MPI_Comm comm = *static_cast<MPI_Comm *>(d->comm->data());
        H5Pset_fapl_mpio(d->prop_list_id, comm, info);

        switch (mode) {
        case dtkIoDataModel::Trunc:
            d->file_id = H5Fcreate (file_name.toUtf8().constData(), H5F_ACC_TRUNC,
                                   H5P_DEFAULT, d->prop_list_id);

            break;
        case dtkIoDataModel::NotExisting:
            d->file_id = H5Fcreate(file_name.toUtf8().constData(), H5F_ACC_EXCL,
                                   H5P_DEFAULT, d->prop_list_id);
            break;
        case dtkIoDataModel::ReadOnly:
            d->file_id = H5Fopen(file_name.toUtf8().constData(), H5F_ACC_RDONLY,
                                 d->prop_list_id);
            break;
        case dtkIoDataModel::ReadWrite:
            d->file_id = H5Fopen(file_name.toUtf8().constData(), H5F_ACC_RDWR,
                                 d->prop_list_id);
            break;
        default:
            dtkError() << "unsupported fileMode";
        };

        //close the property list for file
        H5Pclose(d->prop_list_id);
        if(d->file_id<0) {
            dtkError() << "error in fileOpen for file_name " << file_name;
        }
        else {
            //if the file is correctly open, create a propery list to collectively write datasets
            d->file_is_open = true;
            d->prop_list_id = H5Pcreate(H5P_DATASET_XFER);
            H5Pset_dxpl_mpio(d->prop_list_id, H5FD_MPIO_COLLECTIVE);
        }
    }
    else {
        qDebug() << "File" << file_name << "is already open, please close it before opening a new one";
    }
}
开发者ID:d-tk,项目名称:dtk-plugins-io,代码行数:55,代码来源:pHdf5IoDataModel.cpp


示例11: ASDF_create_new_file

hid_t ASDF_create_new_file(const char *filename, MPI_Comm comm) {
  hid_t plist_id, file_id;

  CHK_H5(plist_id = H5Pcreate(H5P_FILE_ACCESS));
  CHK_H5(H5Pset_fapl_mpio(plist_id, comm, MPI_INFO_NULL));
  /* Create the file collectively.*/
  CHK_H5(file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id));
  CHK_H5(H5Pclose(plist_id));

  return file_id;
}
开发者ID:QuLogic,项目名称:asdf-library,代码行数:11,代码来源:ASDF_write.c


示例12: main

/*-------------------------------------------------------------------------
 * Function:	main
 *
 * Purpose:	Part 2 of a two-part H5Fflush() test.
 *
 * Return:	Success:	0
 *
 *		Failure:	1
 *
 * Programmer:	Robb Matzke
 *              Friday, October 23, 1998
 *
 * Modifications:
 * 		Leon Arber
 * 		Sept. 26, 2006, expand to check for case where the was file not flushed.
 *
 *-------------------------------------------------------------------------
 */
int
main(int argc, char* argv[])
{
    hid_t fapl1, fapl2;
    H5E_auto2_t func;

    char	name[1024];
    const char *envval = NULL;

    int mpi_size, mpi_rank;
    MPI_Comm comm  = MPI_COMM_WORLD;
    MPI_Info info  = MPI_INFO_NULL;

    MPI_Init(&argc, &argv);
    MPI_Comm_size(comm, &mpi_size);
    MPI_Comm_rank(comm, &mpi_rank);

    fapl1 = H5Pcreate(H5P_FILE_ACCESS);
    H5Pset_fapl_mpio(fapl1, comm, info);

    fapl2 = H5Pcreate(H5P_FILE_ACCESS);
    H5Pset_fapl_mpio(fapl2, comm, info);


    if(mpi_rank == 0)
	TESTING("H5Fflush (part2 with flush)");

    /* Don't run this test using the core or split file drivers */
    envval = HDgetenv("HDF5_DRIVER");
    if (envval == NULL)
        envval = "nomatch";
    if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split")) {
	/* Check the case where the file was flushed */
	h5_fixname(FILENAME[0], fapl1, name, sizeof name);
	if(check_file(name, fapl1))
	{
	    H5_FAILED()
	    goto error;
	}
	else if(mpi_rank == 0)
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:58,代码来源:t_pflush2.c


示例13: test_split_comm_access

/*
 * test file access by communicator besides COMM_WORLD.
 * Split COMM_WORLD into two, one (even_comm) contains the original
 * processes of even ranks.  The other (odd_comm) contains the original
 * processes of odd ranks.  Processes in even_comm creates a file, then
 * cloose it, using even_comm.  Processes in old_comm just do a barrier
 * using odd_comm.  Then they all do a barrier using COMM_WORLD.
 * If the file creation and cloose does not do correct collective action
 * according to the communicator argument, the processes will freeze up
 * sooner or later due to barrier mixed up.
 */
void
test_split_comm_access(char filenames[][PATH_MAX])
{
    MPI_Comm comm;
    MPI_Info info = MPI_INFO_NULL;
    int color, mrc;
    int newrank, newprocs;
    hid_t fid;			/* file IDs */
    hid_t acc_tpl;		/* File access properties */
    herr_t ret;			/* generic return value */

    if (verbose)
	printf("Independent write test on file %s %s\n",
	    filenames[0], filenames[1]);

    color = mpi_rank%2;
    mrc = MPI_Comm_split (MPI_COMM_WORLD, color, mpi_rank, &comm);
    assert(mrc==MPI_SUCCESS);
    MPI_Comm_size(comm,&newprocs);
    MPI_Comm_rank(comm,&newrank);

    if (color){
	/* odd-rank processes */
	mrc = MPI_Barrier(comm);
	assert(mrc==MPI_SUCCESS);
    }else{
	/* even-rank processes */
	/* setup file access template */
	acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
	assert(acc_tpl != FAIL);

	/* set Parallel access with communicator */
	ret = H5Pset_fapl_mpio(acc_tpl, comm, info);
	assert(ret != FAIL);

	/* create the file collectively */
	fid=H5Fcreate(filenames[color],H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl);
	assert(fid != FAIL);
	MESG("H5Fcreate succeed");

	/* Release file-access template */
	ret=H5Pclose(acc_tpl);
	assert(ret != FAIL);

	ret=H5Fclose(fid);
	assert(ret != FAIL);
    }
    if (mpi_rank == 0){
	mrc = MPI_File_delete(filenames[color], info);
	assert(mrc==MPI_SUCCESS);
    }
}
开发者ID:fortnern,项目名称:H5Tuner,代码行数:63,代码来源:ph5example.c


示例14: ch5_open

/**
* \brief Opens an HDF file at the given path
* \param[in]  path    Path to the HDF file to open
* \param[out] file_id Pointer to an hid_t
* \returns Status code
* \retval 1 Failure
* \retval 0 Success
* \sa ch5_close
*/
int ch5_open(const char *path, hid_t *file_id) {
  hid_t plist = H5P_DEFAULT;
#ifdef HAVE_MPIIO
  hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS);
  H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPIO_INFO_NULL);
#endif
  hid_t id = H5Fopen(path, H5F_ACC_RDWR, plist);
#ifdef HAVE_MPIIO
  H5Pclose(plist_id);
#endif
  if (id < 0) return 1;
  *file_id = id;
  return 0;
}
开发者ID:cardiosolv,项目名称:meshalyzer,代码行数:23,代码来源:file.c


示例15: ch5_create

/**
* \brief Creates a new HDF file at the given path
* \note Will overwrite/truncate an existing file at the given path
* \param[in]  path    Path to the HDF file to create
* \param[out] file_id Pointer to an hid_t
* \returns Status code
* \retval 1 Failure
* \retval 0 Success
* \sa ch5_close
*/
int ch5_create(const char *path, hid_t *file_id) {
  hid_t plist = H5P_DEFAULT;
#ifdef HAVE_MPIIO
  hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS);
  H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPIO_INFO_NULL);
#endif
  hid_t id = H5Fcreate(path, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
#ifdef HAVE_MPIIO
  H5Pclose(plist_id);
#endif
  if (id < 0) return 1;
  *file_id = id;
  ch5_meta_set_name( *file_id, path );
  return 0;
}
开发者ID:cardiosolv,项目名称:meshalyzer,代码行数:25,代码来源:file.c


示例16: op_decl_set_hdf5

op_set op_decl_set_hdf5(char const *file, char const *name)
{
  //create new communicator
  int my_rank, comm_size;
  MPI_Comm_dup(MPI_COMM_WORLD, &OP_MPI_HDF5_WORLD);
  MPI_Comm_rank(OP_MPI_HDF5_WORLD, &my_rank);
  MPI_Comm_size(OP_MPI_HDF5_WORLD, &comm_size);

  //MPI variables
  MPI_Info info  = MPI_INFO_NULL;

  //HDF5 APIs definitions
  hid_t       file_id; //file identifier
  hid_t plist_id;  //property list identifier
  hid_t dset_id; //dataset identifier

  //Set up file access property list with parallel I/O access
  plist_id = H5Pcreate(H5P_FILE_ACCESS);
  H5Pset_fapl_mpio(plist_id, OP_MPI_HDF5_WORLD, info);

  file_id = H5Fopen(file, H5F_ACC_RDONLY, plist_id );
  H5Pclose(plist_id);

  //Create the dataset with default properties and close dataspace.
  dset_id = H5Dopen(file_id, name, H5P_DEFAULT);

  //Create property list for collective dataset write.
  plist_id = H5Pcreate(H5P_DATASET_XFER);
  H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);

  int g_size = 0;
  //read data
  H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, plist_id, &g_size);

  H5Pclose(plist_id);
  H5Dclose(dset_id);

  H5Fclose(file_id);

  //calculate local size of set for this mpi process
  int l_size = compute_local_size (g_size, comm_size, my_rank);
  MPI_Comm_free(&OP_MPI_HDF5_WORLD);

  return op_decl_set(l_size,  name);
}
开发者ID:ioz9,项目名称:OP2-Common,代码行数:45,代码来源:op_mpi_hdf5.c


示例17: H5Pcreate

  int mpi_mesh_grdecl::open_file_mpi_hdf5(const char *file_name)
  {
    //Set up file access property list with parallel I/O access
    hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS); // Creates a new property as an instance of a property li_startt class.

    //Each process of the MPI communicator creates an access template and sets i_end up wi_endh MPI parallel access information. Thi_start i_start2 done wi_endh the H5Pcreate call to obtain the file access property li_startt and the H5Pset_fapl_mpio call to set up parallel I/O access.
    H5Pset_fapl_mpio(plist_id, mpi_comm, mpi_info);

    // Open a new file and release property list identifier
    hid_t file_id = H5Fopen (file_name, H5F_ACC_RDONLY, H5P_DEFAULT); // H5F_ACC_RDONLY - Allow read-only access to file.
    if (file_id < 0)
      {
        printf("Error: Can't open file %s!\n", file_name);
        return -1;
      }
    H5Pclose (plist_id);
    return file_id;
  }
开发者ID:bs-eagle,项目名称:bs-eagle,代码行数:18,代码来源:mpi_mesh_grdecl.cpp


示例18: nh5pset_fapl_mpio_c

/*----------------------------------------------------------------------------
 * Name:        h5pset_fapl_mpio_c
 * Purpose:     Call H5Pset_fapl_mpio to set mode for parallel I/O and the user
 *              supplied communicator and info object
 * Inputs:      prp_id - property list identifier
 *              comm   - MPI communicator
 *              info   - MPI info object
 * Returns:     0 on success, -1 on failure
 * Programmer:  Elena Pourmal
 *              Thursday, October 26, 2000
 * Modifications:
 *---------------------------------------------------------------------------*/
int_f
nh5pset_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info)
{
     int ret_value = -1;
     hid_t c_prp_id;
     herr_t ret;
     MPI_Comm c_comm;
     MPI_Info c_info;
     c_comm = MPI_Comm_f2c(*comm);
     c_info = MPI_Info_f2c(*info);

     /*
      * Call H5Pset_mpi function.
      */
     c_prp_id = *prp_id;
     ret = H5Pset_fapl_mpio(c_prp_id, c_comm, c_info);
     if (ret < 0) return ret_value;
     ret_value = 0;
     return ret_value;
}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:32,代码来源:H5FDmpiof.c


示例19: saveParticleComp_Int

void saveParticleComp_Int(int *data,char *fileName,char *dataName,int totalCnt,int cnt,int offSet)
{
  int i,j,k;
  int myrank, nTasks;
  MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
  MPI_Comm_size(MPI_COMM_WORLD, &nTasks);

  hid_t file_id,dset_id,plist_id,tic_id;
  herr_t status;
  hid_t total_file_space,subfilespace,filespace,memspace,ticspace;
  hsize_t dimsf[1],count[1],offset[1];

  plist_id=H5Pcreate(H5P_FILE_ACCESS);
  H5Pset_fapl_mpio(plist_id,MPI_COMM_WORLD,MPI_INFO_NULL);
//    H5Pset_fclose_degree(plist_id,H5F_CLOSE_SEMI);
//    MPI_Barrier(MPI_COMM_WORLD);

  file_id=H5Fopen(fileName,H5F_ACC_RDWR,plist_id);
  H5Pclose(plist_id);

  dimsf[0]=totalCnt;
  filespace=H5Screate_simple(1,dimsf,NULL);

  count[0]=cnt;
  offset[0]=offSet;
  memspace=H5Screate_simple(1,count,NULL);

  dset_id=H5Dcreate2(file_id,dataName,H5T_NATIVE_INT,filespace,H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
  subfilespace=H5Dget_space(dset_id);
  H5Sselect_hyperslab(subfilespace,H5S_SELECT_SET,offset,NULL,count,NULL);
  plist_id=H5Pcreate(H5P_DATASET_XFER);
  H5Pset_dxpl_mpio(plist_id,H5FD_MPIO_INDEPENDENT);
  status = H5Dwrite(dset_id, H5T_NATIVE_INT,memspace,subfilespace,plist_id,data);
  H5Pclose(plist_id);
  H5Sclose(subfilespace);
  H5Dclose(dset_id);

  H5Sclose(memspace);
  H5Sclose(filespace);
  H5Fclose(file_id);
}
开发者ID:scienter,项目名称:JoPIC,代码行数:41,代码来源:saveParticleHDF.c


示例20: write

	/*!
	 *
	 * \brief Write a set of particle position and properties into HDF5
	 *
	 * \tparam Pos Vector of positions type
	 * \taparam Prp Vector of properties type
	 * \tparam prp list of properties to output
	 *
	 * \param pos Vector with the positions
	 * \param prp Vector with the properties
	 * \param stop size of the vector to output
	 *
	 */
	template<typename VPos, typename VPrp, int ... prp > bool write(const std::string & file, openfpm::vector<VPos> & v_pos, openfpm::vector<VPrp> & v_prp, size_t stop)
	{
		Vcluster & v_cl = create_vcluster();

		// Open and HDF5 file in parallel

		hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS);
		H5Pset_fapl_mpio(plist_id, v_cl.getMPIComm(), MPI_INFO_NULL);
		file_id = H5Fcreate(file.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, plist_id);
		H5Pclose(plist_id);

		// Single coordinate positional vector
		openfpm::vector<typename VPos::coord_type> x_n;
		x_n.resize(stop);

		//for each component, fill x_n
		for (size_t i = 0 ; i < VPos::dims ; i++)
		{
			//
			for (size_t j = 0 ; j < stop ; j++)
				x_n.get(j) = v_pos.template get<0>(j)[i];

			std::stringstream str;
			str << "x" << i;

			HDF5CreateDataSet<typename VPos::coord_type>(file_id,str.str(),x_n.getPointer(),stop*sizeof(typename VPos::coord_type));
		}

		// Now we write the properties

		typedef typename to_boost_vmpl<prp ... >::type v_prp_seq;
		H5_prop_out<openfpm::vector<VPrp>,has_attributes<VPrp>::value> f(file_id,v_prp,stop);

		boost::mpl::for_each_ref<v_prp_seq>(f);

		H5Fclose(file_id);

		return true;
	}
开发者ID:incardon,项目名称:openfpm_io,代码行数:52,代码来源:HDF5_XdmfWriter_point_set.hpp



注:本文中的H5Pset_fapl_mpio函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ H5Sclose函数代码示例发布时间:2022-05-30
下一篇:
C++ H5Pset_chunk函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap