Re: Default value for numCapabilities?

2010-04-30 Thread Simon Marlow

On 28/04/2010 10:25, Dimitry Golubovsky wrote:


Can the documentation for forkProcess be fixed then? Instead of
forkProcess comes with a giant warning... it could say: forkProcess
is not supported by GHC in multicore setting.


Yes, will do.

Cheers,
Simon
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Default value for numCapabilities?

2010-04-28 Thread Bryan O'Sullivan
On Tue, Apr 27, 2010 at 7:02 PM, Dimitry Golubovsky golubov...@gmail.comwrote:


 This is probably about forkProcess rather than forkIO/forkOS, but why
 this limitation?


That's a standard Unix limitation. A child process is forked with one
thread, so if the parent has multiple threads running, it's overwhelmingly
likely that the child will be unable to execute correctly.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Default value for numCapabilities?

2010-04-28 Thread Johan Tibell
On Wed, Apr 28, 2010 at 8:02 AM, Bryan O'Sullivan b...@serpentine.com wrote:
 On Tue, Apr 27, 2010 at 7:02 PM, Dimitry Golubovsky golubov...@gmail.com
 wrote:

 This is probably about forkProcess rather than forkIO/forkOS, but why
 this limitation?

 That's a standard Unix limitation. A child process is forked with one
 thread, so if the parent has multiple threads running, it's overwhelmingly
 likely that the child will be unable to execute correctly.

One problem used to be that the I/O manager would get killed but Simon
Marlow fixed that. I think we should support forking, with some
caveats, so that we can daemonize processes.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Default value for numCapabilities?

2010-04-28 Thread Dimitry Golubovsky
Simon,

Can the documentation for forkProcess be fixed then? Instead of
forkProcess comes with a giant warning... it could say: forkProcess
is not supported by GHC in multicore setting.

PS I have created ticket #4027 with more detailed proposal.

On Wed, Apr 28, 2010 at 4:26 AM, Simon Marlow marlo...@gmail.com wrote:
 On 28/04/2010 03:02, Dimitry Golubovsky wrote:

 this limitation? rawSystem works fine from within a thread started by
 forkIO, but why cannot I use forkProcess?

 No good reason, other than it's tremendously difficult to implement.

Thank you.

-- 
Dimitry Golubovsky

Anywhere on the Web
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Default value for numCapabilities?

2010-04-27 Thread Dimitry Golubovsky
Hi,

As a followup to the discussion [1] about the portable way to find the
number of CPUs/cores: how is the default value of numCapabilities [2]
set when +RTS -N is not on the command line?

Does GHC runtime figure out the number of cores itself, or it is by
default 1 unless specified on the command line?

Thanks.

---
[1] http://haskell.org/pipermail/haskell-cafe/2010-April/076911.html
[2] 
http://hackage.haskell.org/packages/archive/base/latest/doc/html/GHC-Conc.html#v:numCapabilities

-- 
Dimitry Golubovsky

Anywhere on the Web
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Default value for numCapabilities?

2010-04-27 Thread Bryan O'Sullivan
On Tue, Apr 27, 2010 at 9:09 AM, Dimitry Golubovsky golubov...@gmail.comwrote:



how is the default value of numCapabilities [2]
 set when +RTS -N is not on the command line?

 Does GHC runtime figure out the number of cores itself,


With 6.12.1 and newer, no -N argument implies 1 core, -N*k*
implies *k* cores,
and -N without an argument means use all.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Default value for numCapabilities?

2010-04-27 Thread Bulat Ziganshin
Hello Dimitry,

Tuesday, April 27, 2010, 8:09:49 PM, you wrote:

a few months ago i asked SimonM about using all cores by default, but
he said that it dramatically reduces performance in some cases

 Hi,

 As a followup to the discussion [1] about the portable way to find the
 number of CPUs/cores: how is the default value of numCapabilities [2]
 set when +RTS -N is not on the command line?

 Does GHC runtime figure out the number of cores itself, or it is by
 default 1 unless specified on the command line?

 Thanks.

 ---
 [1] http://haskell.org/pipermail/haskell-cafe/2010-April/076911.html
 [2]
 http://hackage.haskell.org/packages/archive/base/latest/doc/html/GHC-Conc.html#v:numCapabilities




-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Default value for numCapabilities?

2010-04-27 Thread Dimitry Golubovsky
Bulat,

All I need is to know how many cores I have. In my program, I can run
some actions in parallel, and knowing the number of cores helps set
the maximum number of parallel processes. These processes are in fact
external programs (CPU-intensive but not memory intensive, so number
of cores is main factor) rather than GHC threads.

I think I just need to check this experimentally as I have a 4-core
(Atom) and 1-core (Via) PCs and see what numCapabilities returns.


-- 
Dimitry Golubovsky

Anywhere on the Web
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Default value for numCapabilities?

2010-04-27 Thread Dimitry Golubovsky
Hi,

Interesting: my program is compiled with -threaded, and when I run it
with +RTS -N I get:

program name: forking not supported with +RTS -Nn greater than 1

This is probably about forkProcess rather than forkIO/forkOS, but why
this limitation? rawSystem works fine from within a thread started by
forkIO, but why cannot I use forkProcess?

On Tue, Apr 27, 2010 at 12:35 PM, Bryan O'Sullivan b...@serpentine.com wrote:

 With 6.12.1 and newer, no -N argument implies 1 core, -Nk implies
 k cores, and -N without an argument means use all.



-- 
Dimitry Golubovsky

Anywhere on the Web
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users