SMP enabled or not?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

SMP enabled or not?

Zabrane Mickael
Hi,

Is there an Erlang way which let me know if:

1. the Erlang VM was compiled with SMP support or not?
2. the Erlang VM was started with SMP enabled (i.e "erl -smp enable" )
3. how many cores are available on my machine?

Regards
Z.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: SMP enabled or not?

Barry Nicholson
I have no idea about questions 1 & 2.

Theoretically, you can use the following code to discover how
many cpus are on a machine.

application:start(sasl).
application:start(os_mon).
cpu_sup:util([per_cpu]).

However, it doesn't work on Macs or at least mine.

We also write a small library routine that parses /proc/cpuinfo on
Linux.  /proc/cpuinfo has a line of the
form

processor: x

where x is the cpu id.   We simply retrieved the largest x found in the
file.  Thus we then have the number of cpus on that machine.  Remember
this doesn't work on Windows, Mac, embedded or many other OSs.

But the second method isn't an Erlang way.

Barry Nicholson

On 7/23/11 3:10 PM, Zabrane Mickael wrote:

> Hi,
>
> Is there an Erlang way which let me know if:
>
> 1. the Erlang VM was compiled with SMP support or not?
> 2. the Erlang VM was started with SMP enabled (i.e "erl -smp enable" )
> 3. how many cores are available on my machine?
>
> Regards
> Z.
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: SMP enabled or not?

Michael Schreckenbauer
In reply to this post by Zabrane Mickael
Hi,

On Saturday 23 July 2011 22:10:06 Zabrane Mickael wrote:
> Hi,
 
> Is there an Erlang way which let me know if:

> 1. the Erlang VM was compiled with SMP support or not?
> 2. the Erlang VM was started with SMP enabled (i.e "erl -smp enable" )

erlang:system_info(smp_support).

> 3. how many cores are available on my machine?

erlang:system_info(logical_processors_available).

> Regards
> Z.

HTH,
Michael

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: SMP enabled or not?

ERLANG-3
Thanks guys.

Le 23 juil. 2011 à 22:48, Michael Schreckenbauer a écrit :

> Hi,
>
> On Saturday 23 July 2011 22:10:06 Zabrane Mickael wrote:
>> Hi,
>
>> Is there an Erlang way which let me know if:
>
>> 1. the Erlang VM was compiled with SMP support or not?
>> 2. the Erlang VM was started with SMP enabled (i.e "erl -smp enable" )
>
> erlang:system_info(smp_support).
>
>> 3. how many cores are available on my machine?
>
> erlang:system_info(logical_processors_available).

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: SMP enabled or not?

Frank Goenninger
In reply to this post by Michael Schreckenbauer
Am 23.07.2011 um 22:48 schrieb Michael Schreckenbauer:

> erlang:system_info(smp_support).
>
> erlang:system_info(logical_processors_available).

$ erl
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.4  (abort with ^G)
1> erlang:system_info(smp_support).
true
2> erlang:system_info(logical_processors_available).
unknown

... on my 4 core MacBook Pro ...

Cheers
  Frank

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: SMP enabled or not?

Tomasz Maciejewski
Dnia 24-07-2011 o 12:00:12 Frank Goenninger <[hidden email]> napisał(a):

> [smp:4:4]

Here it is.

--
Tomasz Maciejewski
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: SMP enabled or not?

Frank Goenninger

Am 24.07.2011 um 12:12 schrieb Tomasz Maciejewski:

> Dnia 24-07-2011 o 12:00:12 Frank Goenninger <[hidden email]> napisał(a):
>
>> [smp:4:4]
>
> Here it is.

I know. But why does this show up as "unknown" when asked for programmatically ?

Frank

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: SMP enabled or not?

Sam Elliott
try

1> erlang:system_info(logical_processors).
2

That got me the right thing on my mbp when logical_processors_available wasn't. Maybe also try:

2> erlang:system_info(logical_processors_online).
2

Sam
--
Sam Elliott
[hidden email]
--
On Sun, Jul 24, 2011 at 11:13 AM, Frank Goenninger <[hidden email]> wrote:

Am 24.07.2011 um 12:12 schrieb Tomasz Maciejewski:

> Dnia 24-07-2011 o 12:00:12 Frank Goenninger <[hidden email]> napisał(a):
>
>> [smp:4:4]
>
> Here it is.

I know. But why does this show up as "unknown" when asked for programmatically ?

Frank

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: SMP enabled or not?

Frank Goenninger
Am 24.07.2011 um 12:42 schrieb Sam Elliott:

> try
>
> 1> erlang:system_info(logical_processors).
> 2
>
> That got me the right thing on my mbp when logical_processors_available wasn't. Maybe also try:
>
> 2> erlang:system_info(logical_processors_online).
> 2

Cool! Works!

Thanks.

Frank

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions