Example #1
0
smi_error_t _smi_copy_globally_distributed_to_local(int global_region_id,
        int local_region_id)
{
    DSECTION("_smi_copy_globally_distributed_to_local");
    smi_error_t error;
    size_t       i, j, k;							   /* loop counters                      */
    smi_rlayout_t* distributed_layout;               /* description of the detailed memory */
    smi_rlayout_t* local_layout;                     /* layout of the two regions          */
    void*      own_global_segment_start = NULL;  /* start address and size of a segment*/
    size_t     own_global_segment_size = 0;      /* and it's size of the entire copy   */
    void*      other_global_segment_start = NULL;/* proceedure; once for the own source*/
    size_t     other_global_segment_size = 0;    /* segment, once for the remote       */
    /* source segment                     */
    double*       ptr;                              /* tmp var                            */
    int           other_machine_rank;
    size_t        no_iterations;                 /* specifies how many                 */
    /* SMI_COPY_BUFFER_SIZE-byte blocks   */
    /* the largest segment of the distrib.*/
    /* region contains                    */
    int tmp_machine, tmp_proc;
    size_t act_inner_iterations;
    size_t remaining_bytes;
    size_t tmp_it;

    double* tmp_ptr;
    size_t no_inner_iterations = SMI_COPY_BUFFER_SIZE/sizeof(double);
    double* s;
    double* d;

    DSECTENTRYPOINT;

    /* _smi_allocate buffer space, if not already done */
    if (buffer__smi_allocated == false)
    {
        buffer__smi_allocated = true;

        error = SMI_Init_PC(&progress_counter);
        ASSERT_R((error==SMI_SUCCESS),"Could not init progress-counter",error);

        ALLOCATE( buffer,  double**, _smi_nbr_machines * sizeof(double*) );
        for(i=0; i<(size_t)_smi_nbr_machines; i++)
        {
            tmp_proc = _smi_first_proc_on_node((int) i);
            error = SMI_Cmalloc(SMI_COPY_BUFFER_SIZE, tmp_proc|INTERNAL,
                                (char**)(&(buffer[i])));
            ASSERT_R((error==SMI_SUCCESS),"Could not allocate memory",error);
        }
    }
Example #2
0
static void list_init(node_t** ppRoot)
{
  smi_error_t error;
  
  error = SMI_Cmalloc(sizeof(node_t), iShregId, (void **)ppRoot);
  if (error != SMI_SUCCESS) {
    fprintf(stderr, "No memory left\n");
    SMI_Abort(-1);
  }
  (*ppRoot)->pNext = NULL;
/*
  SMI_Mutex_init(&listLock);
*/
  SMI_MUTEX_INIT(&listLock, BL_MUTEX,0 /*LOCAL_ONLY*/);
  SMI_Barrier();
}