On Sat, Sep 01, 2007 at 01:43:37PM -0400, Diego Novillo wrote: > > Have you considered using the data sharing machinery in OpenMP? We > simply create a data structure holding all shared variables, allocate > that in shared memory and re-write all references to shared variables > as dereferences to that structure.
Diego, thanks. Some other implmentations of UPC reference all shared variables indirectly through a table, built at runtime. The compiler tells the runtime how much space each variable reauires, and the runtime alloctes this from the shared memory region. The current strategy used by GCC/UPC is somewhat simpler; it lets the linker create the layout of the shared variable section. Perhaps we need to re-visit this design decision, and adopt a scheme similar to that used by GOMP. I'll review omp-low.c for ideas. GCC/UPC does have a pthreads mode of operation, but that is a special case. UPC threads are usually mapped to separate processes. The shared memory region is potentially distributed across network nodes, often accessed via a high speed interconnect. The runtime that is part of the GCC/UPC's release supports only SMP configurations and relies on mmap(). However, GCC/UPC also works with a more general runtime developed by Berkeley, which supports many network interconnects. > > This trick you are implementing with cloning the VAR_DECLs is > guaranteed not to work, sorry. We very explicitly assume that if > DECL_UID (x1) == DECL_UID (x2) then x1 == x2. This is not something > that will change. Yeah, I suspected as much when I first wrote that code. I wasn't too surprised to see that it failed a consistency check in GCC 4.2.