caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] native threads not parallel?
@ 2001-06-15 16:49 Markus Mottl
  2001-06-15 17:10 ` Xavier Leroy
  0 siblings, 1 reply; 15+ messages in thread
From: Markus Mottl @ 2001-06-15 16:49 UTC (permalink / raw)
  To: OCAML

Hello,

I am having problems using native threads (under Solaris; don't know
about other architectures): I can't get them to run in parallel on a
dual-processor machine even though I turn off the master lock on the
C-side around an external function that should execute in parallel.

There are four threads running (I actually create two only - ?) as I can
observe with "ps -L". The two created ones reach the external Fortran
routine (in LAPACK) at about the same time, obviously in parallel or at
least interleaved up this point as I can see in the logged checkpoints.

I turn off/on the lock around this routine as in:

  enter_blocking_section();

    some_really_expensive_function ();

  leave_blocking_section();

Unfortunately, the expensive function is executed sequentially only.

What could be the cause of the lack of parallelism? Am I just
misunderstanding how things work? If this could be a bug, I can send
you more information to the bug-tracker, of course.

Regards,
Markus Mottl

-- 
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [Caml-list] native threads not parallel?
@ 2003-02-20 23:10 Shivkumar Chandrasekaran
  2003-02-21  0:15 ` Jacques Garrigue
  2003-02-21  0:32 ` Chris Uzdavinis
  0 siblings, 2 replies; 15+ messages in thread
From: Shivkumar Chandrasekaran @ 2003-02-20 23:10 UTC (permalink / raw)
  To: caml-list

Not sure if this issue from an earlier discussion was fully resolved or 
not. But I seem to have the same problem as discussed by Markus Mottl 
(see attachment below) on Mac OS X 10.2.4 on a dual processor G4 
machine. An earlier message in that thread mentioned that there was no 
such problem on dual-processor Linux machines.

I have two questions:

1. Has anybody else figured out how to get parallelism using native 
threads on Mac OS X?

2. Will I get the parallelism if I switch to LinuxPPC?

Thanks,

--shiv--

PS: Does ocaml work properly on LinuxPPC?




> Re: [Caml-list] native threads not parallel?
> To :Xavier Leroy < Xavier.Leroy@inria.fr >
> Subject :Re: [Caml-list] native threads not parallel?
> From :Markus Mottl < mottl@miss.wu-wien.ac.at >
> Date: Thu, 21 Jun 2001 15:43:16 +0200
> Cc: OCAML < caml-list@inria.fr >
> Content-Disposition: inline
> In-Reply-To: < 20010615233325.B24915@miss.wu-wien.ac.at >; from 
> mottl@miss.wu-wien.ac.at on Fri, Jun 15, 2001 at 23:33:26 +0200
> References: < 20010615184931.A25835@miss.wu-wien.ac.at > < 
> 20010615191046.A20258@pauillac.inria.fr > < 
> 20010615204218.C25835@miss.wu-wien.ac.at > < 
> 20010615233325.B24915@miss.wu-wien.ac.at >
> User-Agent: Mutt/1.2.5i
> On Fri, 15 Jun 2001, Markus Mottl wrote:
> > I have just been told that things work smoothly with dual-processor
> > machines under Linux, and it also turned out due to more 
> experimentation
> > that the behaviour of native threads under Solaris is comparable to
> > a lottery: when running very long, it seems that multiple threads are
> > used. Sometimes. But sometimes you can also get bus errors. It's 
> really
> > unpredictable. Better don't bother with native threads under 
> Solaris...
>
> I couldn't resist and have done another test now. First, I have made
> sure that multiple threads work under C. As Xavier has pointed out, 
> this
> requires setting the concurrency level to more than the default of 1.
> Works fine (= in parallel).
>
> Then I have written a small test program that tries to do the same 
> under
> OCaml - but no success...
>
> Here are the the timings achieved by calling C via OCaml:
>
>   Running sequentially:
>   Wall clock time: 6.598713
>
>   Running in parallel:
>   Wall clock time: 6.601169
>
>
> Here are the the timings achieved by using C only (clearly runs faster
> with threads):
>
>   Running sequentially
>   Wall clock time: 6.995337
>
>   Running in parallel
>   Wall clock time: 3.910411
>
> The only thing I can imagine is that OCaml somehow changes
> scheduling so that the threads cannot run in parallel anymore, even if
> "enter_blocking_section" is used. Is this possible? Or am I just making
> some stupid mistake?
>
> Regards,
> Markus Mottl

--shiv--

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2003-02-24 17:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-15 16:49 [Caml-list] native threads not parallel? Markus Mottl
2001-06-15 17:10 ` Xavier Leroy
2001-06-15 18:42   ` Markus Mottl
2001-06-15 21:33     ` Markus Mottl
2001-06-21 13:43       ` Markus Mottl
2003-02-20 23:10 Shivkumar Chandrasekaran
2003-02-21  0:15 ` Jacques Garrigue
2003-02-21  4:24   ` shivkumar chandrasekaran
2003-02-21 10:43     ` Markus Mottl
2003-02-21 15:11     ` Jacques Garrigue
2003-02-21 17:57       ` Markus Mottl
2003-02-24 17:39       ` Shivkumar Chandrasekaran
2003-02-21  0:32 ` Chris Uzdavinis
2003-02-21  1:56   ` james woodyatt
2003-02-21  4:43   ` shivkumar chandrasekaran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).