mfh
Sorry; the permissions were 640 for some reason. Fixed,
but it's just an output routine.
Jason
--
I'm not sure if I understand correctly how upc_alloc() works -- in
particular, is it true that upc_alloc() can allocate shared storage with
local affinity to _any_ thread, not just to thread zero? When a pointer
is declared `shared []' it has affinity to thread zero, so how can we
assign the result of upc_alloc() to a pointer which has been declared
`shared []' and expect that the affinity switches from thread zero to
the other thread?
If it helps -- I was looking at the UPC manual (p. 43), which is
available as a link on:
http://www.gwu.edu/~upc/documentation.html
Many thanks,
mfh
A test shows that upc_alloc apparently always returns a shared pointer
with affinity to thread zero. Source code for the test is listed below.
mfh
#include <upc.h>
#include <stdio.h>
shared [] int** p;
const int block_size = 10;
int
main()
{
int t;
p = (shared [] int**) upc_alloc (THREADS * sizeof (int*));
upc_forall (t = 0; t < THREADS; t++; t)
{
/* Same result even if return value of upc_alloc() is not
* typecast.
*/
p[t] = (shared [] int*) upc_alloc (block_size * sizeof(int));
printf ("Thread %d: allocated with upc_alloc; affinity to thread
%d\n",
MYTHREAD, upc_threadof(&p[t]));
upc_free (p[t]);
}
return 0;
}