How to find out the number of processor cores?

Jun 6, 2008 at 4:07pm

How to find out the number of processor cores?

Hi, I have a patch that does some heave off-line sound analysis, and on
mono-processor machines I throttle the CPU load a little, but for multi-core
machines it can and should go at full speed.

Is there a way to get the number of CPU cores in Max (still 4.6.3 as long as I
don’t have a second processor to render all these heavy graphics…)?

Cheers…
…Diemo


Diemo Schwarz, PhD — http://diemo.concatenative.net
Real-Time Music Interaction Team — http://imtr.ircam.fr
IRCAM – Centre Pompidou — 1, place Igor-Stravinsky, 75004 Paris, France
Phone +33-1-4478-4879 — Fax +33-1-4478-1540

#38270
Jun 6, 2008 at 5:48pm

Forget!

If I’m not wrong, and I’m sorry if I am, Max is not a multi core software. If you put Max running you can see on (win) task manager that it uses all cores, but not in the way we all like it to do!
A check box on all objects inspector to force object to run on a specific(s) core(s) is great, but it’s very hard to program Max like that… very hard!
probably only on Max6…. in 20 years from now!

#133180
Jun 6, 2008 at 8:12pm

On 6 juin 08, at 19:48, Fernando Silva wrote:

> Forget!
>
> If I’m not wrong, and I’m sorry if I am, Max is not a multi core
> software. If you put Max running you can see on (win) task manager
> that it uses all cores, but not in the way we all like it to do!
> A check box on all objects inspector to force object to run on a
> specific(s) core(s) is great, but it’s very hard to program Max like
> that… very hard!
> probably only on Max6…. in 20 years from now!

You can forget about that dream. It’s not how multi core architectures
works nowadays. Since Jitter 1.5, some processes are parallelized
which makes that it will take advantage of the multiple core when you
have such kind of computer. Since Max 5, audio processes can be
(automatically) assigned to different threads with the use of the
parallel attribute in poly~.

For Diemo question, AFAIK there’s no standard way to get the number of
cores at least with objects. You can do that via C for sure.

ej

#133181
Jun 10, 2008 at 11:25am

Thanks for your answer, Fernando, although that was not my question.

The situation is simpler: I do off-line batch sound analysis on the event level,
and in order to keep a mono-processor machine responsive, I need to insert short
breaks, so that the gui can get updated, sound can run, etc. On
multi-processors, these latter do run indeed in separate threads, so the breaks
are not necessary, and analysis can be faster.

Emmanuel, this is how to find out on UNIX (= OSX, dunno about Windows), I’ll add
that as a function to ftm:

#include
#include
#include

void main ()
{
int mib[2];
int ncpu, ret;
size_t intsize = sizeof(int);

mib[0] = CTL_HW;
mib[1] = HW_NCPU;

ret = sysctl(mib, 2, &ncpu, &intsize, NULL, 0);

if (ret == 0)
printf(“#proc %dn”, ncpu);
else
printf(“sysctl error %dn”, ret);
}

Emmanuel Jourdan wrote:
> Diemo wrote
>> Hi, I have a patch that does some heave off-line sound analysis, and on mono-processor machines I throttle the CPU load a little, but for multi-core machines it can and should go at full speed.
>>
> > Is there a way to get the number of CPU cores in Max (still 4.6.3 as long as
I don’t have a second processor to render all these heavy graphics…)?
>>
>> Cheers…
>> …Diemo
>
> On 6 juin 08, at 19:48, Fernando Silva wrote:
>
>> Forget!
>>
>> If I’m not wrong, and I’m sorry if I am, Max is not a multi core
>> software. If you put Max running you can see on (win) task manager
>> that it uses all cores, but not in the way we all like it to do!
>> A check box on all objects inspector to force object to run on a
>> specific(s) core(s) is great, but it’s very hard to program Max like
>> that… very hard!
>> probably only on Max6…. in 20 years from now!
>
> You can forget about that dream. It’s not how multi core architectures
> works nowadays. Since Jitter 1.5, some processes are parallelized which
> makes that it will take advantage of the multiple core when you have
> such kind of computer. Since Max 5, audio processes can be
> (automatically) assigned to different threads with the use of the
> parallel attribute in poly~.
>
> For Diemo question, AFAIK there’s no standard way to get the number of
> cores at least with objects. You can do that via C for sure.
>
> ej
>
>


…Diemo


Diemo Schwarz, PhD — http://diemo.concatenative.net
Real-Time Music Interaction Team — http://imtr.ircam.fr
IRCAM – Centre Pompidou — 1, place Igor-Stravinsky, 75004 Paris, France
Phone +33-1-4478-4879 — Fax +33-1-4478-1540

#133182

You must be logged in to reply to this topic.