Re: Defining block size during runtime

From: James Dinan (dinan_at_cse.ohio-state.edu)
Date: Wed Jul 22 2009 - 18:29:11 PDT

  • Next message: Gary Funck: "Re: Defining block size during runtime"
    sainath l wrote:
    > Hello Guys,
    > 
    > I am very much interested in knowing any workaround, if possible, for
    > dynamically allocating an array with variable block size at runtime.
    >  
    > Lets say I want to know if it is possible to create the following array
    > dynamically where N and M are some variables. If yes then how can we do it.
    > 
    > shared [M] int A[N][M];
    > 
    > Once again I thank you all for the Help.
    
    Hi Sainath,
    
    The UPC spec states that M has to be a compile time constant if you
    declare the array statically.  You should be able to accomplish this via
    dynamic allocation using upc_all_alloc(N*M, M*sizeof(int)).  The first
    parameter gives the number of blocks and the second, the block size.
    Also, upc_all_alloc is collective.
    
    Good luck,
     ~Jim.
    

  • Next message: Gary Funck: "Re: Defining block size during runtime"