Is it possible to find the number of cores

2014-04-12 Thread Cecil Westerhof
I am experimenting with concurrent programming. Is it possible to determine
how many cores there are on a system? Because it is in the case I am
working on at the moment not profitable to use more threads as there are
cores. (That slows the program down.) Can I find out the number of cores of
the system where the program is running. Preferable system independent.

Is there also a possibility to get the load of a system? When the load is
low, I could start more threads as when the load is high.

-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to find the number of cores

2014-04-12 Thread Patrick Kristiansen
http://stackoverflow.com/questions/4759570/finding-number-of-cores-in-java

On Saturday, April 12, 2014 4:43:56 PM UTC+2, Cecil Westerhof wrote:
>
> I am experimenting with concurrent programming. Is it possible to 
> determine how many cores there are on a system? Because it is in the case I 
> am working on at the moment not profitable to use more threads as there are 
> cores. (That slows the program down.) Can I find out the number of cores of 
> the system where the program is running. Preferable system independent.
>
> Is there also a possibility to get the load of a system? When the load is 
> low, I could start more threads as when the load is high.
>
> -- 
> Cecil Westerhof 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to find the number of cores

2014-04-12 Thread Cecil Westerhof
2014-04-12 16:51 GMT+02:00 Patrick Kristiansen :

> http://stackoverflow.com/questions/4759570/finding-number-of-cores-in-java
>

Thanks. I use now:
(. (. Runtime (getRuntime)) availableProcessors)



> On Saturday, April 12, 2014 4:43:56 PM UTC+2, Cecil Westerhof wrote:
>>
>> I am experimenting with concurrent programming. Is it possible to
>> determine how many cores there are on a system? Because it is in the case I
>> am working on at the moment not profitable to use more threads as there are
>> cores. (That slows the program down.) Can I find out the number of cores of
>> the system where the program is running. Preferable system independent.
>>
>> Is there also a possibility to get the load of a system? When the load is
>> low, I could start more threads as when the load is high.
>>
>
-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to find the number of cores

2014-04-12 Thread Fergal Byrne
(.. Runtime getRuntime availableProcessors) is a bit cleaner


On Sat, Apr 12, 2014 at 4:18 PM, Cecil Westerhof wrote:

> 2014-04-12 16:51 GMT+02:00 Patrick Kristiansen :
>
>> http://stackoverflow.com/questions/4759570/finding-number-of-cores-in-java
>>
>
> Thanks. I use now:
> (. (. Runtime (getRuntime)) availableProcessors)
>
>
>
>> On Saturday, April 12, 2014 4:43:56 PM UTC+2, Cecil Westerhof wrote:
>>>
>>> I am experimenting with concurrent programming. Is it possible to
>>> determine how many cores there are on a system? Because it is in the case I
>>> am working on at the moment not profitable to use more threads as there are
>>> cores. (That slows the program down.) Can I find out the number of cores of
>>> the system where the program is running. Preferable system independent.
>>>
>>> Is there also a possibility to get the load of a system? When the load
>>> is low, I could start more threads as when the load is high.
>>>
>>
> --
> Cecil Westerhof
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Fergal Byrne, Brenter IT

Author, Real Machine Intelligence with Clortex and NuPIC
https://leanpub.com/realsmartmachines

http://inbits.com - Better Living through
Thoughtful Technology
http://ie.linkedin.com/in/fergbyrne/
https://github.com/fergalbyrne

e:fergalbyrnedub...@gmail.com t:+353 83 4214179
Formerly of Adnet edi...@adnet.ie http://www.adnet.ie

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to find the number of cores

2014-04-12 Thread Cecil Westerhof
2014-04-12 17:20 GMT+02:00 Fergal Byrne :

> (.. Runtime getRuntime availableProcessors) is a bit cleaner
>

Did not know that one. Definitely better. But I already changed the way I
do it. I think I will use Runtime more often, so I do now:
(def runtime (. Runtime (getRuntime)))
(.availableProcessors runtime) 




> On Sat, Apr 12, 2014 at 4:18 PM, Cecil Westerhof 
> wrote:
>
>> 2014-04-12 16:51 GMT+02:00 Patrick Kristiansen :
>>
>>>
>>> http://stackoverflow.com/questions/4759570/finding-number-of-cores-in-java
>>>
>>
>> Thanks. I use now:
>> (. (. Runtime (getRuntime)) availableProcessors)
>>
>
-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.