Re: dynamically allocating memory for two dimensional array

From: Gary Funck (gary_at_intrepid_dot_com)
Date: Fri Jul 17 2009 - 11:17:35 PDT

  • Next message: Gary Funck: "Re: dynamically allocating memory for two dimensional array"
    On 07/17/09 16:56:21, sainath l wrote:
    >    Thank you for the reply.
    >    Actually I am not worried about the performance here. I am interested in
    >    finding out how much time  the allocation routine in itself takes.
    > 
    >    I would need an array of pointers like
    > 
    >    shared int *shared a[N];
    
    As others have pointed out, it isn't clear that a shared pointer to
    an array of pointers to rows is the best way to express a shared
    matrix in UPC, because it may lead to poor performance, and
    leaves open the question of thread affiinity.
    
    I've attached a simple program that illustrates dynamic allocation
    of an NxM array using the method of representing 'a' that you've
    suggested above.  Note that all allocated elements have affinity
    to thread 0 in this implementation, and that is likely not a good
    representation for a real world problem.
    
    - Gary
    
    


  • Next message: Gary Funck: "Re: dynamically allocating memory for two dimensional array"