From: Dan Bonachea (bonachea_at_cs_dot_berkeley_dot_edu)
Date: Tue Oct 11 2005 - 21:49:42 PDT
At 03:46 PM 10/11/2005, Jaisudha Purushothaman wrote:
>Hi,
> I am interested in compiling MTU's collective library in Berkeley's UPC
>and run some performance measurements. But, I get messages that flags
>such as "UPC_IN_ALLSYNC are being redefined" because Berkeley's UPC has
>its own built-in collectives. Is there a way in which I can recompile the
>collectives replacing the built-in ones with my own library?
Hi Jaisudha -
The UPC_{IN,OUT}_*SYNC flags and upc_flag_t are no longer part of the
collectives library. As of UPC language spec 1.2, they are required to be
defined in upc.h, which means that every UPC 1.2 compliant compiler should
provide them for you. This change was made specifically to allow 3rd party
implementations of UPC collectives and UPC-IO (both of which use these
definitions) to work with UPC 1.2 compilers that provide built-in versions of
these libraries.
Consequently, the fix should be to remove those definitions from your
upc_collective.h and simply use the compiler-provided ones. Note doing so
means your code might need to be tweaked to avoid relying on any properties of
those definitions that are not required by the spec (eg if you were relying on
UPC_IN_ALLSYNC==4, that assumption may now be invalidated).
Because you may want to use your library with older pre-1.2 compilers, you can
handle both with something like:
your upc_collective.h:
#if __UPC_VERSION__ < 200505
typedef ... upc_flag_t;
#define UPC_IN_ALLSYNC ...
#else
/* UPC 1.2 and newer compilers provide all the above in upc.h */
#include <upc.h>
#endif
Dan