From: Steve Reinhardt (spr_at_SGI_dot_com)
Date: Sun Dec 04 2005 - 06:21:26 PST
Hi all, I'm trying to port a serial code that does a search for frequent subgraphs in a graph. The technique I'm thinking to use is to reuse as much as possible the serial code, with the primary changes being that the priority queue of candidate subgraphs would be shared. The subgraphs are structs that have pointers to other structs in them. For the priority queue to work as a truly shared structure, all of these structs need to be shared, and the pointers to them from the priority queue need to be shared. At least I claim this is so; if there are better ways of doing this with UPC, I'm open to suggestion. The program below captures the difficulty I'm having getting data structures defined as I need them. #include <upc.h> shared int a[10][THREADS]; shared int *shared c[10][THREADS]; typedef struct { int a; int b; } gink; typedef struct { int a; int b; shared gink *c; // private ptr to shared object shared gink *shared d; // shared ptr to shared object shared int *e; // private ptr to shared object shared int *shared f; // shared ptr to shared object } gink2; shared gink2 aa[10][THREADS]; shared gink2 *shared cc[10][THREADS]; int main(int argc, char *argv[]) { } The definitions of a and c work fine. The definition of gink2, however, gives the following error: hope2 137=> !! upcc -o simple simple.upc upcc: error during UPC-to-C translation (sgiupc stage): simple.upc:16: field `d' declared with shared qualifier simple.upc:17: field `f' declared with shared qualifier Having played with variations on this theme, it appears that UPC doesn't support a member of a structure that's a shared pointer to a shared object. Is this so? I have some appreciation of the difficulties involved in implementing that, with different blocking factors, etc. But I'm still left with wanting to have a shared data structure that has structs in it, and pointers to those. It seems like I'm left with the old approach of foregoing the use of structs and using a distinct shared array of shared objects for each element of the struct. Or at least each shared element of the struct. Seems doable, but hardly elegant. Is there a better way that somebody has experience with? And, are there any others who are using UPC for codes that work primarily on structs, and not just arrays of basic types? Thanks. Steve -- Steve Reinhardt Internet: spr_at_sgi_dot_com Principal Engineer and Phone: 1.651.683.5664 Parallel Architecture Wonk Vnet: 233.5664 SGI Fax: 1.651.683.3082 2750 Blue Water Road Chatty pager: spr_p_at_pager_dot_sgi_dot_com Eagan, MN 55121 USA Admin: Carol Gibson 1.651.683.5878 carol_at_sgi_dot_com