当前位置: 首页>>代码示例>>C++>>正文


C++ MPI_Type_extent函数代码示例

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


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

示例1: MPI_Alltoallv

int MPI_Alltoallv(void *sendbuf, int *sendcounts,
		  int *sdispls, MPI_Datatype sendtype,
                  void *recvbuf, int *recvcounts,
		  int *rdispls, MPI_Datatype recvtype,
                  MPI_Comm comm) 

{
  int send_offset;
  int recv_offset;
  MPI_Aint st_extent;
  MPI_Aint rt_extent;

  MPI_Type_extent(sendtype, &st_extent);
  MPI_Type_extent(recvtype, &rt_extent);

  send_offset=sdispls[0]*st_extent;
  recv_offset=rdispls[0]*rt_extent;

  copy_data2((char*)sendbuf+send_offset, sendcounts[0], sendtype,
             (char*)recvbuf+recv_offset, recvcounts[0], recvtype);
  
//  memcpy( (char *)recvbuf+recv_offset, (char *)sendbuf+send_offset,
//	  sendcounts[0] * sendtype);


  return(MPI_SUCCESS);
}
开发者ID:ACME-Climate,项目名称:cime,代码行数:27,代码来源:collective.c

示例2: ompi_coll_libnbc_ialltoallv_inter

/* simple linear Alltoallv */
int ompi_coll_libnbc_ialltoallv_inter (void* sendbuf, int *sendcounts, int *sdispls,
				       MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *rdispls,
				       MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request,
				       struct mca_coll_base_module_2_0_0_t *module)
{
  int rank, res, i, rsize;
  MPI_Aint sndext, rcvext;
  NBC_Schedule *schedule;
  char *rbuf, *sbuf;
  NBC_Handle *handle;
  ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request;
  ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module;

  res = NBC_Init_handle(comm, coll_req, libnbc_module);
  if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; }
  handle = (*coll_req);
  res = MPI_Comm_rank(comm, &rank);
  if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; }
  res = MPI_Type_extent(sendtype, &sndext);
  if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", res); return res; }
  res = MPI_Type_extent(recvtype, &rcvext);
  if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", res); return res; }

  MPI_Comm_remote_size (comm, &rsize);

  schedule = (NBC_Schedule*)malloc(sizeof(NBC_Schedule));
  if (NULL == schedule) { printf("Error in malloc() (%i)\n", res); return res; }

  handle->tmpbuf=NULL;

  res = NBC_Sched_create(schedule);
  if(res != NBC_OK) { printf("Error in NBC_Sched_create (%i)\n", res); return res; }

  for (i = 0; i < rsize; i++) {
    /* post all sends */
    if(sendcounts[i] != 0) {
      sbuf = ((char *) sendbuf) + (sdispls[i] * sndext);
      res = NBC_Sched_send(sbuf, false, sendcounts[i], sendtype, i, schedule);
      if (NBC_OK != res) { printf("Error in NBC_Sched_send() (%i)\n", res); return res; }
    }
    /* post all receives */
    if(recvcounts[i] != 0) {
      rbuf = ((char *) recvbuf) + (rdispls[i] * rcvext);
      res = NBC_Sched_recv(rbuf, false, recvcounts[i], recvtype, i, schedule);
      if (NBC_OK != res) { printf("Error in NBC_Sched_recv() (%i)\n", res); return res; }
    }
  }

  /*NBC_PRINT_SCHED(*schedule);*/

  res = NBC_Sched_commit(schedule);
  if (NBC_OK != res) { printf("Error in NBC_Sched_commit() (%i)\n", res); return res; }

  res = NBC_Start(handle, schedule);
  if (NBC_OK != res) { printf("Error in NBC_Start() (%i)\n", res); return res; }

  return NBC_OK;
}
开发者ID:Dissolubilis,项目名称:ompi-svn-mirror,代码行数:59,代码来源:nbc_ialltoallv.c

示例3: MTestTypeContigCheckbuf

static int MTestTypeContigCheckbuf( MTestDatatype *mtype )
{
    unsigned char *p;
    unsigned char expected;
    int  i, totsize, err = 0, merr;
    MPI_Aint size;

    p = (unsigned char *)mtype->buf;
    if (p) {
	merr = MPI_Type_extent( mtype->datatype, &size );
	if (merr) MTestPrintError( merr );
	totsize = size * mtype->count;
	for (i=0; i<totsize; i++) {
	    expected = (0xff ^ (i & 0xff));
	    if (p[i] != expected) {
		err++;
		if (mtype->printErrors && err < 10) {
		    printf( "Data expected = %x but got p[%d] = %x\n",
			    expected, i, p[i] );
		    fflush( stdout );
		}
	    }
	}
    }
    return err;
}
开发者ID:FlorianPO,项目名称:simgrid,代码行数:26,代码来源:mtest.c

示例4: MTestError

/* 
 * Setup indexed buffers for 1 copy of a datatype.  Initialize for
 * reception (e.g., set initial data to detect failure)
 */
static void *MTestTypeIndexedInitRecv( MTestDatatype *mtype )
{
    MPI_Aint totsize;
    int      merr;

    if (mtype->count > 1) {
	MTestError( "This datatype is supported only for a single count" );
    }
    if (mtype->count == 1) {
	signed char *p;
	int  i;
	merr = MPI_Type_extent( mtype->datatype, &totsize );
	if (merr) MTestPrintError( merr );
	if (!mtype->buf) {
	    mtype->buf = (void *) malloc( totsize );
	}
	p = (signed char *)(mtype->buf);
	if (!p) {
	    /* Error - out of memory */
	    MTestError( "Out of memory in type buffer init\n" );
	}
	for (i=0; i<totsize; i++) {
	    p[i] = 0xff;
	}
    }
    else {
	/* count == 0 */
	if (mtype->buf) {
	    free( mtype->buf );
	}
	mtype->buf = 0;
    }
    return mtype->buf;
}
开发者ID:FlorianPO,项目名称:simgrid,代码行数:38,代码来源:mtest.c

示例5: handle

/*@
    MPI_File_get_type_extent - Returns the extent of datatype in the file

Input Parameters:
. fh - file handle (handle)
. datatype - datatype (handle)

Output Parameters:
. extent - extent of the datatype (nonnegative integer)

.N fortran
@*/
int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, 
                             MPI_Aint *extent)
{
#ifndef PRINT_ERR_MSG
    int error_code;
    static char myname[] = "MPI_FILE_GET_TYPE_EXTENT";
#endif

#ifdef PRINT_ERR_MSG
    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
	FPRINTF(stderr, "MPI_File_get_type_extent: Invalid file handle\n");
	MPI_Abort(MPI_COMM_WORLD, 1);
    }
#else
    ADIOI_TEST_FILE_HANDLE(fh, myname);
#endif

    if (datatype == MPI_DATATYPE_NULL) {
#ifdef PRINT_ERR_MSG
        FPRINTF(stderr, "MPI_File_get_type_extent: Invalid datatype\n");
        MPI_Abort(MPI_COMM_WORLD, 1);
#else
	error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
				     myname, (char *) 0, (char *) 0);
	return ADIOI_Error(fh, error_code, myname);	    
#endif
    }

    return MPI_Type_extent(datatype, extent);
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:42,代码来源:get_extent.c

示例6: MPI_Type_extent

/* 
 * Setup contiguous buffers of n copies of a datatype.  Initialize for
 * reception (e.g., set initial data to detect failure)
 */
static void *MTestTypeContigInitRecv( MTestDatatype *mtype )
{
    MPI_Aint size;
    int      merr;

    if (mtype->count > 0) {
	signed char *p;
	int  i, totsize;
	merr = MPI_Type_extent( mtype->datatype, &size );
	if (merr) MTestPrintError( merr );
	totsize = size * mtype->count;
	if (!mtype->buf) {
	    mtype->buf = (void *) malloc( totsize );
	}
	p = (signed char *)(mtype->buf);
	if (!p) {
	    /* Error - out of memory */
	    MTestError( "Out of memory in type buffer init" );
	}
	for (i=0; i<totsize; i++) {
	    p[i] = 0xff;
	}
    }
    else {
	if (mtype->buf) {
	    free( mtype->buf );
	}
	mtype->buf = 0;
    }
    return mtype->buf;
}
开发者ID:FlorianPO,项目名称:simgrid,代码行数:35,代码来源:mtest.c

示例7: MPI_Scatterv

int MPI_Scatterv(void* sendbuf, int *sendcounts, int *displs, 
		 MPI_Datatype sendtype, void* recvbuf, int recvcount, 
		 MPI_Datatype recvtype, int root, MPI_Comm comm)
{
  int offset;
  MPI_Aint st_extent;

  if (recvbuf==MPI_IN_PLACE)
    return(MPI_SUCCESS);

  if (root==MPI_ROOT)
    return(MPI_SUCCESS);

  if (root!=0)
    {
      fprintf(stderr,"MPI_Scatterv: bad root = %d\n",root);
      abort();
    }
  MPI_Type_extent(sendtype, &st_extent);
  offset=displs[0]*st_extent;

  copy_data2((char*)sendbuf+offset, sendcounts[0], sendtype,
             recvbuf, recvcount, recvtype);
//  memcpy(recvbuf,(char *)sendbuf+offset,sendcounts[0] * sendtype);
  
  return(MPI_SUCCESS);
}
开发者ID:ACME-Climate,项目名称:cime,代码行数:27,代码来源:collective.c

示例8: derived_resized_test

/* derived_resized_test()
 *
 * Tests behavior with resizing of a simple derived type.
 *
 * Returns the number of errors encountered.
 */
int derived_resized_test(void)
{
    int err, errs = 0;

    int count = 2;
    MPI_Datatype newtype, resizedtype;

    int size;
    MPI_Aint extent;

    err = MPI_Type_contiguous(count, MPI_INT, &newtype);
    if (err != MPI_SUCCESS) {
        if (verbose) {
            fprintf(stderr, "error creating type in derived_resized_test()\n");
        }
        errs++;
    }

    err = MPI_Type_create_resized(newtype,
                                  (MPI_Aint) 0, (MPI_Aint) (2 * sizeof(int) + 10), &resizedtype);

    err = MPI_Type_size(resizedtype, &size);
    if (err != MPI_SUCCESS) {
        if (verbose) {
            fprintf(stderr, "error obtaining type size in derived_resized_test()\n");
        }
        errs++;
    }

    if (size != 2 * sizeof(int)) {
        if (verbose) {
            fprintf(stderr,
                    "error: size != %d in derived_resized_test()\n", (int) (2 * sizeof(int)));
        }
        errs++;
    }

    err = MPI_Type_extent(resizedtype, &extent);
    if (err != MPI_SUCCESS) {
        if (verbose) {
            fprintf(stderr, "error obtaining type extent in derived_resized_test()\n");
        }
        errs++;
    }

    if (extent != 2 * sizeof(int) + 10) {
        if (verbose) {
            fprintf(stderr,
                    "error: invalid extent (%d) in derived_resized_test(); should be %d\n",
                    (int) extent, (int) (2 * sizeof(int) + 10));
        }
        errs++;
    }

    MPI_Type_free(&newtype);
    MPI_Type_free(&resizedtype);

    return errs;
}
开发者ID:NexMirror,项目名称:MPICH,代码行数:65,代码来源:simple-resized.c

示例9: contig_test

/* contig_test()
 *
 * Tests behavior with a zero-count contig.
 *
 * Returns the number of errors encountered.
 */
int contig_test(void)
{
    int err, errs = 0;

    int count = 0;
    MPI_Datatype newtype;

    int size;
    MPI_Aint extent;

    err = MPI_Type_contiguous(count,
			     MPI_INT,
			     &newtype);
    if (err != MPI_SUCCESS) {
	if (verbose) {
	    fprintf(stderr,
		    "error creating type in contig_test()\n");
	}
	errs++;
    }

    err = MPI_Type_size(newtype, &size);
    if (err != MPI_SUCCESS) {
	if (verbose) {
	    fprintf(stderr,
		    "error obtaining type size in contig_test()\n");
	}
	errs++;
    }
    
    if (size != 0) {
	if (verbose) {
	    fprintf(stderr,
		    "error: size != 0 in contig_test()\n");
	}
	errs++;
    }    

    err = MPI_Type_extent(newtype, &extent);
    if (err != MPI_SUCCESS) {
	if (verbose) {
	    fprintf(stderr,
		    "error obtaining type extent in contig_test()\n");
	}
	errs++;
    }
    
    if (extent != 0) {
	if (verbose) {
	    fprintf(stderr,
		    "error: extent != 0 in contig_test()\n");
	}
	errs++;
    }    

    MPI_Type_free( &newtype );

    return errs;
}
开发者ID:Julio-Anjos,项目名称:simgrid,代码行数:65,代码来源:contig-zero-count.c

示例10: main

int main (int argc, char *argv[]){

	int   i,
		  numtasks, rank;
	int tag=1;
	float a[16] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0};
	float b[SIZE];
	int blockcounts[2] ={4, 2};
	MPI_Datatype oldtypes[2] = {MPI_FLOAT, MPI_INT};
	int offsets[2];
	MPI_Aint extent;
	MPI_Status status;
	MPI_Datatype particletype;
	Particle particles[NELEMENTS], p[NELEMENTS];

	MPI_Init(&argc,&argv);
	MPI_Comm_rank(MPI_COMM_WORLD, &rank); 
	MPI_Comm_size(MPI_COMM_WORLD, &numtasks);


	MPI_Type_extent(MPI_FLOAT,&extent);
	offsets[0]=0;
	offsets[1]=4*extent;
	MPI_Type_struct(2,blockcounts,offsets,oldtypes,&particletype);
	MPI_Type_commit(&particletype);



	if (rank == RANK_MASTER) {

		for(i=0;i<NELEMENTS;i++){

			particles[i].x=1;
     		particles[i].y=2;
     		particles[i].z=3;
     		particles[i].velocity=4;
     		particles[i].n=5;
     		particles[i].type=6;

		}


		for (i=0; i<numtasks; i++)
		MPI_Send(particles,NELEMENTS, particletype, i, tag, MPI_COMM_WORLD);
	}

	MPI_Recv(p, NELEMENTS, particletype, 0, tag, MPI_COMM_WORLD, &status);

	for(i=0;i<NELEMENTS;i++)
		printf("RANK #%d: %.1f %.1f %.1f %.1f %d %d\n", rank,p[i].x,
     p[i].y,p[i].z,p[i].velocity,p[i].n,p[i].type);


	MPI_Type_free(&particletype);

	MPI_Finalize();
	return 0;

}  /* end of main */
开发者ID:bertuccio,项目名称:ASP,代码行数:59,代码来源:structType.c

示例11: ompi_coll_libnbc_igatherv_inter

int ompi_coll_libnbc_igatherv_inter (void* sendbuf, int sendcount, MPI_Datatype sendtype,
				     void* recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype,
				     int root, struct ompi_communicator_t *comm, ompi_request_t ** request,
				     struct mca_coll_base_module_2_0_0_t *module) {
  int rank, p, res, i, rsize;
  MPI_Aint rcvext;
  NBC_Schedule *schedule;
  char *rbuf;
  NBC_Handle *handle;
  ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request;
  ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module;

  res = NBC_Init_handle(comm, coll_req, libnbc_module);
  if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; }
  handle = (*coll_req);
  res = MPI_Comm_rank(comm, &rank);
  if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; }
  res = MPI_Comm_size(comm, &p);
  if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_size() (%i)\n", res); return res; }
  res = MPI_Comm_remote_size (comm, &rsize);
  if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_remote_size() (%i)\n", res); return res; }

  if (MPI_ROOT == root) {
    res = MPI_Type_extent(recvtype, &rcvext);
    if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", res); return res; }
  }
  handle->tmpbuf = NULL;

  schedule = (NBC_Schedule*)malloc(sizeof(NBC_Schedule));
  if (NULL == schedule) { printf("Error in malloc() (%i)\n", res); return res; }

  res = NBC_Sched_create(schedule);
  if(res != NBC_OK) { printf("Error in NBC_Sched_create (%i)\n", res); return res; }

  /* send to root */
  if (MPI_ROOT != root && MPI_PROC_NULL != root) {
    /* send msg to root */
    res = NBC_Sched_send(sendbuf, false, sendcount, sendtype, root, schedule);
    if (NBC_OK != res) { printf("Error in NBC_Sched_send() (%i)\n", res); return res; }
  } else if (MPI_ROOT == root) {
    for (i = 0 ; i < rsize ; ++i) {
      rbuf = ((char *)recvbuf) + (displs[i]*rcvext);
      /* root receives message to the right buffer */
      res = NBC_Sched_recv(rbuf, false, recvcounts[i], recvtype, i, schedule);
      if (NBC_OK != res) { printf("Error in NBC_Sched_recv() (%i)\n", res); return res; }
    }
  }

  res = NBC_Sched_commit(schedule);
  if (NBC_OK != res) { printf("Error in NBC_Sched_commit() (%i)\n", res); return res; }

  res = NBC_Start(handle, schedule);
  if (NBC_OK != res) { printf("Error in NBC_Start() (%i)\n", res); return res; }

  return NBC_OK;
}
开发者ID:Dissolubilis,项目名称:ompi-svn-mirror,代码行数:56,代码来源:nbc_igatherv.c

示例12: ompi_coll_libnbc_iallgatherv_inter

int ompi_coll_libnbc_iallgatherv_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *displs,
				       MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request,
				       struct mca_coll_base_module_2_1_0_t *module)
{
  int rank, res, r, rsize;
  MPI_Aint rcvext;
  NBC_Schedule *schedule;
  NBC_Handle *handle;
  ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request;
  ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module;

  res = NBC_Init_handle(comm, coll_req, libnbc_module);
  if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; }
  handle = (*coll_req);
  res = MPI_Comm_rank(comm, &rank);
  if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; }
  res = MPI_Comm_remote_size(comm, &rsize);
  if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_remote_size() (%i)\n", res); return res; }
  res = MPI_Type_extent(recvtype, &rcvext);
  if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", res); return res; }

  schedule = (NBC_Schedule*)malloc(sizeof(NBC_Schedule));
  if (NULL == schedule) { printf("Error in malloc() (%i)\n", res); return res; }

  handle->tmpbuf=NULL;

  res = NBC_Sched_create(schedule);
  if(res != NBC_OK) { printf("Error in NBC_Sched_create, (%i)\n", res); return res; }

  /* do rsize  rounds */
  for (r = 0 ; r < rsize ; ++r) {
    char *rbuf = ((char *)recvbuf) + (displs[r]*rcvext);

    if (recvcounts[r]) {
      res = NBC_Sched_recv(rbuf, false, recvcounts[r], recvtype, r, schedule);
      if (NBC_OK != res) { printf("Error in NBC_Sched_recv() (%i)\n", res); return res; }
    }
  }

  if (sendcount) {
    for (r = 0 ; r < rsize ; ++r) {
      res = NBC_Sched_send(sendbuf, false, sendcount, sendtype, r, schedule);
      if (NBC_OK != res) { printf("Error in NBC_Sched_send() (%i)\n", res); return res; }
    }
  }

  res = NBC_Sched_commit(schedule);
  if (NBC_OK != res) { printf("Error in NBC_Sched_commit() (%i)\n", res); return res; }

  res = NBC_Start(handle, schedule);
  if (NBC_OK != res) { printf("Error in NBC_Start() (%i)\n", res); return res; }

  return NBC_OK;
}
开发者ID:ORNL,项目名称:ompi,代码行数:54,代码来源:nbc_iallgatherv.c

示例13: mpi_type_extent_f

void mpi_type_extent_f(MPI_Fint *type, MPI_Fint *extent, MPI_Fint *ierr)
{
    MPI_Datatype c_type = MPI_Type_f2c(*type);
    MPI_Aint c_extent;

    *ierr = OMPI_INT_2_FINT(MPI_Type_extent(c_type, &c_extent));

    if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
        *extent = (MPI_Fint)c_extent;
    }
}
开发者ID:315234,项目名称:OpenFOAM-2.2.x-OSX,代码行数:11,代码来源:type_extent_f.c

示例14: p_vegasrewrite

/*
 * This function sends the results collected by one worker back to
 * the master. It first assembles a result_buf in order to send
 * everything in one single operation.
 */
void p_vegasrewrite(binAccu r_Ab[FNMX], double r_d[NDMX][MXDIM], double r_di[NDMX][MXDIM])
{
  int i, j;
  
  /* assemble the send-buffer */
  for (j=0; j<functions; j++) {
    result_buf[j] = r_Ab[j].ti;
  }
  for (j=0; j<functions; j++) {
    result_buf[j+functions] = r_Ab[j].tsi;
  } 
  for (j=0; j<gndim; j++) {
    for (i=0; i<nd; i++) 
      result_buf[2*functions + j*nd + i] = r_d[i][j];
    for (i=0; i<nd; i++) 
      result_buf[2*functions + gndim*nd + j*nd + i] = r_di[i][j];
  }
  MPI_Send(result_buf, (2*functions + 2*(gndim*nd)), MPI_DOUBLE, 0, 1, MPI_COMM_WORLD);
  
  
// MARKUS: define MPI_HISTO for transmitting C histogram structs
  MPI_Datatype MPI_HISTO, oldtypes[2]; 
  int blockcounts[2];
  MPI_Aint offsets[2], extent;
  offsets[0] = 0;
  oldtypes[0] = MPI_DOUBLE;
  blockcounts[0] = 2*MXHISTOBINS;
  MPI_Type_extent(MPI_DOUBLE, &extent);
  offsets[1] = blockcounts[0] * extent;
  oldtypes[1] = MPI_INT;
  blockcounts[1] = 1*MXHISTOBINS; 
  MPI_Type_struct(2, blockcounts, offsets, oldtypes, &MPI_HISTO);
  MPI_Type_commit(&MPI_HISTO);   
  
  
  ReducedCHistogram CHisto[NUMHISTO];   /* MARKUS: declare C hisograms */
  
  int SelectHisto;
  for(SelectHisto=1; SelectHisto<=NUMHISTO; SelectHisto++) {     /* MARKUS: loop over all histograms and copy fortran type into C struct */
       modkinematics_mp_getredhisto_(&CHisto[SelectHisto-1],&SelectHisto);
  };
//   printf("Printing final CHistograms \n");
//   for (j=0; j<NUMHISTO; j++) { 
//   for (i=0; i<MXHISTOBINS; i++) {
//       printf(" %i %i %20.8e \n",j+1,i+1,CHisto[j].Value[i]);
//   };
//   };
  
      
//   printf("worker sending histo struct: %20.6e \n",CHisto.Value[0]);
  MPI_Send(CHisto,NUMHISTO,MPI_HISTO,0,2,MPI_COMM_WORLD);    /* MARKUS: send the array of C histogram structs back to the master  */


}
开发者ID:TOPAZdevelop,项目名称:TOPAZ,代码行数:59,代码来源:pvegas_mpi.c

示例15: clearFreeList

/*
 * Class:     mpi_Datatype
 * Method:    extent
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_mpi_Datatype_extent
  (JNIEnv *env, jobject jthis)
{
  MPI_Aint  result;

  clearFreeList(env) ;

  MPI_Type_extent(
      (MPI_Datatype)((*env)->GetLongField(env,jthis,DatatypehandleID)),
      &result);

  return result;
}
开发者ID:getvenubp,项目名称:ParallelPageRank,代码行数:18,代码来源:mpi_Datatype.c


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