Page 1 of 1

Using _sysSetCPU

Posted: Mon Mar 05, 2018 6:53 am
by omni
Roger,

A while back you showed how to use the multi-core option. Works fine. Larger users now want to expand the usage to use more than 4.
the example you have uses up o 4 cpu's. They have 12 and the first 4 are getting real high, causing some slow downs.

Can it be expanded to use more? If so, does it matter on Alaska version? One still has 1.9. We are trying to get them all on 2.0, but still working on that.

We are using your dc_setcpu()

Thanks

Fred
Omni

Re: Using _sysSetCPU

Posted: Mon Mar 05, 2018 9:28 am
by rdonnay
Did you try passing a larger number to DC_SetCPU() ?

//255 = 8 CPUs
//127 = 7 CPUs
// 63 = 6 CPUs
// 31 = 5 CPUs
// 15 = 4 CPUs
// 7 = 3 CPUs
// 3 = 2 CPUs
// 1 = 1 CPU

Re: Using _sysSetCPU

Posted: Mon Mar 05, 2018 12:03 pm
by Victorio
I am using this

function to swith to other CPU core :
prepnicpu(2^(cprocesora-1))

where cprocesora = 1,2,3,4,5,6,... , then 2^(cprocesora-1) = 1,2,4,6,8,16,...

FUNCTION PrepniCPU(nCpu)
IF SmpSetCPU(nCpu) = 0
msgbox("Cannot swith to CPU : " + var2char(nCpu))
ELSE
msgbox("App switched to CPU : " + Var2char(BitSet2Array(nCpu) ) )
ENDIF
RETURN nil

this works fine also on 12 core Windows 2012 server

As I remember, Jimmy was wrote, when other number, 3,5,... then works more than one CPU simultaneously

Now I cannot test this because I have not access to this server, on virtual servers number of CPU can be big number ... 24 or other,

Re: Using _sysSetCPU

Posted: Tue Mar 06, 2018 9:36 am
by unixkd
Hi Victorio

Where in your application do you call this function.

Thanks

Joe

Re: Using _sysSetCPU

Posted: Tue Mar 06, 2018 10:47 am
by Victorio
I start main application, from this I call several other modules by Runshell and put parameter number CPU for every module
runshell(" 1",program.exe... blabla)
runshell(" 2",program.exe... blabla)
runshell(" 3",program.exe... blabla)

and every "program.exe" start on own CPU.

In one "exe" cannot run more CPU core, only one. I know from this forum, it is not way to run other thread in same program on other CPU....

My application works fine, I am using it for divide big processes to 12 CPU, and time to processing is then about 1/12 time if compare to work only on one CPU.