Defining a table dynamically ...

From: Konstantin Kleisouris (kkonst_at_cs_dot_rutgers_dot_edu)
Date: Tue Jun 13 2006 - 10:43:08 PDT

  • Next message: Dan Bonachea: "Re: Defining a table dynamically ..."
       I am interested in defining a table dynamically in UPC.
    This table should have affinity to Thread 0. I would like
    to define an array like data1 below.
    shared [] int data1[10][2];
       The way I did it is as follows:
    shared [] int * shared [] * shared data2;
    if (MYTHREAD == 0) {
          data2 = (shared [] int * shared [] *) upc_alloc(10 *
    sizeof(int *));
          for(i = 0; i < 10; i++) {
    	data2[i] = (shared [] int *) upc_alloc(2 * sizeof(int));
    Howevever when I use data1 in a gather it works fine
     upc_all_gather(data1, data, sizeof(int)*4,
    Imagine that data in the gather above is defined as
    shared [2] int data[10][2];
    But when I use data2 in the same gather as bellow
     upc_all_gather(data2, data, sizeof(int)*4,
    I get the following message:
    UPC Runtime error: Attempt to use a bogus
    upcr_pshared_ptr_t: addrfield out of range
      <pshared_ptr: addr=0xe2fed004 (offset=0x4), thread=0,
      at /UPC_DEBUG//include/upcr_sptr.h:1245
    Any idea?

  • Next message: Dan Bonachea: "Re: Defining a table dynamically ..."