On Mon, Dec 12, 2005 at 10:28:31PM +0100, Leopold Toetsch wrote:
>
> On Dec 12, 2005, at 17:53, Erik Paulson wrote:
>
> >Hi -
> >
> >I'm using an older version of Parrot (0.2.2) so I can use threads.
> >
> >It seems that Parrot on Solaris doesn't ever use more than one
> >processor.
>
> [ ... ]
>
> >Is there some way we can check to see if Parrot is actually creating
> >more than
> >one thread? Is it some sort of crazy green-thread issue?
>
> There are AFAIK some issues with solaris (but I don't know the details)
> It might need a different threading lib or some additional init code to
> create 'real' threads.
>
I've got it to work now, thanks to Joe Wilson who gave me the last clue.
I turned on pthreads in configure:
perl Configure.pl --ccflags=":add{ -pthreads -D_REENTERANT }"
--linkflags=":add{ -pthreads }"
and I changed the definitino of CREATE_THREAD_JOINABLE:
# define THREAD_CREATE_JOINABLE(t, func, arg) do {\
pthread_attr_t attr; \
int rc = pthread_attr_init(&attr); \
assert(rc == 0); \
rc = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); \
assert(rc == 0); \
rc = pthread_setconcurrency(8); \
assert(rc == 0); \
pthread_create(&t, NULL, func, arg); \
} while(0)
The default to attrsetsope on Solaris is SCOPE_PROCESS, the default on Linux
is SCOPE_SYSTEM.
I'm on Solaris 8, and without the call to pthread_setconcurrency, I only ran
one thread at a time. Starting in Solaris 9, pthread_setconcurrency doesn't
do anything. (I don't have a Solaris 9 SMP I can test on to see if parrot
uses multiple processors concurrently without the call to set_concurrency.
My runtimes get about twice as fast every time I add a processor. I'm not sure
what the minimal set of calls I need to add are - the setconcurrency was the
last thing I tried, and once I added it in things started working - I don't
know if that means I can remove my other changes and things will still work,
I'll do that experiment later.
-Erik