Re: struct-based pointers and block size

From: Costin Iancu (cciancu_at_lbl_dot_gov)
Date: Thu Jul 10 2008 - 13:11:55 PDT

  • Next message: Natalie Freed: "Re: struct-based pointers and block size"
    Have you tried  --enable-sptr-struct ?
    
    Here are the relevant bits from upcr_sptr.h
    ========================
    /*
          * "regular" struct pointer representation
          */
         typedef struct shared_ptr_struct {
             uintptr_t   s_addr;   /* First field to speed pointer  
    use           */
             uint32_t    s_thread;
             uint32_t    s_phase;
         } upcr_shared_ptr_t;
         /* representation is a struct type, so restrict prohibited by C  
    compiler */
         #define UPCR_RESTRICT_SHARED
         #define UPCRI_PHASE_BITS     32
         #define UPCRI_THREAD_BITS    32
         #define UPCRI_ADDR_BITS      (8*SIZEOF_VOID_P)
         #define UPCR_NULL_SHARED          { 0, 0, 0 }
         #define UPCR_INITIALIZED_SHARED   { 1, 0, 0 }
    
         #if !UPCRI_SYMMETRIC_PSHARED
           typedef struct pshared_ptr_struct {
               uintptr_t s_addr;   /* First field to speed pointer  
    use           */
               uint32_t  s_thread;
           } upcr_pshared_ptr_t;
           #define UPCR_NULL_PSHARED         { 0, 0 }
           #define UPCR_INITIALIZED_PSHARED  { 1, 0 }
           #define UPCR_RESTRICT_PSHARED
         #endif
    
    
    
    On Jul 10, 2008, at 12:57 PM, Natalie Freed wrote:
    
    > Hello,
    >
    > I built the Berkeley UPC compiler, v. 2.6.0 with the
    > --disable-sptr-packed option.
    >
    > I get this message when I compile some of my programs:
    > Maximum block size in this implementation is 1048576
    >
    > This is smaller than the default size for 64-bit systems without using
    > struct-based pointers (I'm basing all this off the INSTALL document
    > here http://upc.lbl.gov/download/dist/INSTALL). I'm working with some
    > fairly large problem sizes and it would be a big help if I could scale
    > the block sizes accordingly.
    >
    > Is there any advice you can give me? If this could be specific to my
    > system or installation I will add any details, I'm not sure what's
    > relevant here and I might be missing something more basic about how
    > this option is intended to work.
    >
    > Thank you,
    > Natalie
    >
    > P.S. For search reference this is the section I was looking at:
    >
    > http://upc.lbl.gov/download/dist/INSTALL
    >
    > 'PACKED', 'UNPACKED', AND 'SYMMETRIC' SHARED POINTERS
    >
    >   The Berkeley UPC runtime supports three different implementations  
    > for shared
    >   pointers: one which is implemented with a C structure, another  
    > 'packed' one
    >   which uses a 64 bit integral value to store all the fields in a  
    > shared
    >   pointer, and a 'symmetric' variant that optimizes an important  
    > class of
    >   shared pointers (those with either blocksize==1 or indefinite  
    > blocksize) by
    >   using regular C pointers (the packed representation is used for  
    > the general
    >   case).  The 'packed' implementation is the default, and should be  
    > best for
    >   most users.  Symmetric pointers currently require shared-memory  
    > semantics,
    >   and thus work only on certain machines with -network=shmem, and/or  
    > for
    >   programs compiled with '-network=smp' (i.e. no network) on any  
    > system
    >   supporting pthreads.  They generally provide the fastest  
    > performance on
    >   configurations that support them, but are currently still  
    > experimental.  To
    >   use them, pass '--enable-sptr-symmetric'.  Struct shared pointers  
    > are
    >   primarily useful for increasing the UPC_MAX_BLOCKSIZE supported by  
    > the
    >   implementation, and for debugging by the members of the Berkeley
    > UPC effort (as
    >   they provide more type safety than the other versions).  To use  
    > them, pass
    >   '--disable-sptr-packed'.
    >
    >   TRADING-OFF MAXIMUM 'THREADS', BLOCKSIZE, AND HEAP SIZE
    >
    >   The default 'packed' shared pointer representation stores all the  
    > fields of a
    >   shared pointer (address, thread, and phase offset) in a single 64- 
    > bit integer
    >   type.  The limited number of bits forces each element to have a  
    > maximum
    >   value.  By default, 32 bit systems use 22 bits for the phase  
    > offset, 10 for
    >   the thread field, and 32 for the address field, resulting in a  
    > maximum
    >   blocksize of 4194304, a maximum of 1024 threads per application, and
    >   4 GB maximum of shared memory per thread,    The default for 64  
    > bit systems
    >   are 20,10,34 bits, respectively, or 2097152 max blocksize/1024  
    > threads/16 GB.
    >
    >   You can adjust the number of bits that is assigned to each  
    > subfield of packed
    >   shared pointers at configure time, via the '--with-sptr-packed- 
    > bits' flag.
    >   The flag must be passed three comma-separated integers,  
    > representing the
    >   number of bits for the phase, thread, and address fields (in that  
    > order),
    >   with the total adding up to 64 bits.  For instance,
    >
    >        --with-sptr-packed-bits=8,20,36
    >
    >   limits the maximum number of threads to 256, but expands the  
    > maximum shared
    >   memory per thread to 64 GB.
    >
    >   If you find that 64 bits is not enough to contain the maximum  
    > values you need
    >   for your system, pass '--disable-sptr-packed', and your UPC build  
    > will use
    >   'struct' based pointers, which are slower, but have larger maximum  
    > values.
    
    -- 
    Costin C. Iancu                                                       cciancu_at_lbl_dot_gov
    Future Technologies Group                                 Phone:  
    510-495-2122
    Lawrence Berkeley National Laboratory           Fax:   510-486-6900
    

  • Next message: Natalie Freed: "Re: struct-based pointers and block size"