SMP question

Simon Marlow simonmarhaskell at gmail.com
Wed May 9 04:48:32 EDT 2007


Cristian Perfumo wrote:
> Some days ago I sent an email to the list asking about the reason why I 
> couldn't run my programs with the "-Nx" RTS option even if I compiled 
> them with -threaded.
> AH! by the way, the architecture is ia64 (Itanium).
> Today I realized that when I ./configure, a preprocessor variable called 
> "NOSMP" is defined and it disallows the multiple OS threads (the -Nx 
> option).
> Looking a bit deeper I figured out that there's no Itanium version for 
> the functions xchg (exchange), cas (compare-and-swap) and write_barrier 
> in the header file SMP.h (includes/SMP.h) so there's no way that the 
> holy -N option is available.
> My question is: is it enough to implement xchg, cas and write_barrier 
> for ia64 to make multiple OSthreads available on ia64? If not, what else 
> should be implemented/changed?

Yes, that should be enough.  The main concern is that on architectures that 
don't have strong memory ordering, that the thunk update sequence is safe.  See 
section 3.3:

   http://www.haskell.org/~simonmar/papers/multiproc.pdf

At the moment the update code contains a memory barrier, which compiles to 
nothing on x86/x86_64 (see SMP.h:write_barrier()).  You should check that this 
doesn't impose a significant performance penalty on ia64: try one of the 
benchmarks that does a lot of updates (e.g. nofib/imaginary/exp3_8) with and 
without -threaded.

Cheers,
	Simon



More information about the Glasgow-haskell-users mailing list