Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cs267 hw3: broken link to example code?

25 views
Skip to first unread message

Mark Frederick Augustine Hoemmen

unread,
Mar 19, 2004, 2:44:12 AM3/19/04
to Jason Riedy
The link to `c_print_results.c' in the example code
provided in ~ejr/GSI/cs267-s04/homework-3/cg/basic
appears to be broken -- is that a very important file,
or is it (as the name suggests) just a few output
routines?

mfh

Edward Jason Riedy

unread,
Mar 19, 2004, 1:08:00 PM3/19/04
to
And Mark Hoemmen writes:
- The link to `c_print_results.c' in the example code
- provided in ~ejr/GSI/cs267-s04/homework-3/cg/basic
- appears to be broken -- is that a very important file,
- or is it (as the name suggests) just a few output
- routines?

Sorry; the permissions were 640 for some reason. Fixed,
but it's just an output routine.

Jason
--

Mark Frederick Augustine Hoemmen

unread,
Mar 28, 2004, 12:01:52 AM3/28/04
to Jason Riedy
Greetings!

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

Mark Frederick Augustine Hoemmen

unread,
Mar 28, 2004, 9:51:52 AM3/28/04
to Jason Riedy
Mark Frederick Augustine Hoemmen wrote:
> 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?

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;
}

0 new messages