Ejemplo n.º 1
0
int A1D_Allocate_shared(void * ptrs[], int bytes)
{
    void *  tmp_ptr       = NULL;
    int     max_bytes     = 0;

#ifdef DEBUG_FUNCTION_ENTER_EXIT
    fprintf(stderr,"entering A1D_Allocate_shared(void* ptrs[], int bytes) \n");
#endif

    A1D_Barrier();

#ifdef __CRAYXE
    A1D_Allreduce_max32( bytes, &max_bytes );

    /* allocate memory from symmetric heap */
    tmp_ptr = dmapp_sheap_malloc( (size_t)max_bytes );
    assert(tmp_ptr!=NULL);
#endif

    /* allgather addresses into pointer vector */
    A1D_Allgather( &tmp_ptr, ptrs, sizeof(void*) );

#ifdef DEBUG_FUNCTION_ENTER_EXIT
    fprintf(stderr,"exiting A1D_Allocate_shared(void* ptrs[], int bytes) \n");
#endif

    return(0);
}
Ejemplo n.º 2
0
int A1D_Allocate_comm(MPI_Comm comm, void * ptrs[], int bytes)
{
    int mpi_status = MPI_SUCCESS;

    void *  tmp_ptr       = NULL;
    int     max_bytes     = 0;

#ifdef DEBUG_FUNCTION_ENTER_EXIT
    fprintf(stderr,"entering A1D_Allocate_comm(MPI_Comm comm, void * ptrs[], int bytes)\n");
#endif

    mpi_status = MPI_Barrier(comm);
    assert(mpi_status==0);

#ifdef __CRAYXE
    A1D_Allreduce_max32(comm, bytes, &max_bytes );

    /* allocate memory from symmetric heap */
    tmp_ptr = dmapp_sheap_malloc( (size_t)max_bytes );
    assert(tmp_ptr!=NULL);
#endif

    /* allgather addresses into pointer vector */
    A1D_Allgather(comm, &tmp_ptr, ptrs, sizeof(void*) );

#ifdef DEBUG_FUNCTION_ENTER_EXIT
    fprintf(stderr,"exiting A1D_Allocate_comm(MPI_Comm comm, void * ptrs[], int bytes)\n");
#endif

    return(0);
}