Multi core CPU
Re: Multi core CPU
I attach the print screen for the error.
- Attachments
-
- error.GIF (19.04 KiB) Viewed 18646 times
Re: Multi core CPU
Hi, Stu.
Is "XppRt1.DLL" in the path of your program? What version is it (run "xppload" to get version information)? The error message is an eXpress++-error, so you don't run the Alaska-sample from ..\Source\Samples\Solution\Smp, but something else. Does this work at your site?
Is "XppRt1.DLL" in the path of your program? What version is it (run "xppload" to get version information)? The error message is an eXpress++-error, so you don't run the Alaska-sample from ..\Source\Samples\Solution\Smp, but something else. Does this work at your site?
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Multi core CPU
Hi Tom
There is no problem when I run from ..\Source\Samples\Solution\Smp. The problem arise only when I copy and paste the SMP code into my own program.
When I remove the SMP code, my application run well. Once I add in the SMP code, runtime error occur. I am still using xbase 1.8 and express build 236.
There is no problem when I run from ..\Source\Samples\Solution\Smp. The problem arise only when I copy and paste the SMP code into my own program.
When I remove the SMP code, my application run well. Once I add in the SMP code, runtime error occur. I am still using xbase 1.8 and express build 236.
Re: Multi core CPU
hi,
where did you add what Code ? please show us some Line of Code how you have implement it ...STLau wrote:There is no problem when I run from ..\Source\Samples\Solution\Smp.
...
Once I add in the SMP code, runtime error occur.
greetings by OHR
Jimmy
Jimmy
Re: Multi core CPU
I have removed all codes and left with very simple program as attached. You can build the exe and run it to see the runtime error.
if you remove the 3 lines as indicated in the program, there will be no error.
Attached is x123.prg and x123.xpj.
if you remove the 3 lines as indicated in the program, there will be no error.
Attached is x123.prg and x123.xpj.
Re: Multi core CPU
#include "dcdialog.ch"
#include "dcbitmap.ch"
#include "dcicon.ch"
#include "appevent.ch"
#include "xbp.ch"
#include "inkey.ch"
#include "dcmsg.ch"
#include "dll.ch"
Procedure appsys
RETURN
PROCEDURE MAIN
LOCAL GETOPTIONS,GETLIST:={},oApp:=SetAppWindow(),oXbp,nCPU
MSGBOX('TEST 1')
** remove this 3 lines will have no error
*----------------------------------------
thread():new():start("stress")
Ncpu:=smpgetcpu()
msgbox(str(Ncpu))
*----------------------------------------
MSGBOX('TEST 2')
DCREAD GUI
RETURN
FUNCTION SMPGETCPU()
LOCAL I
I:=DLLCALL("XPPRT1.DLL",DLL_CDECL,"_SYSGETCPU")
RETURN I
procedure stress()
local a:={3,2,1,0}
do while .t.
asort(a)
enddo
return
* xpj ---------------------------------------------
[PROJECT]
COMPILE = xpp
COMPILE_FLAGS = /q /n /m /p /dll:DYNAMIC
DEBUG = yes
GUI = yes
LINKER = alink
LINK_FLAGS =
RC_COMPILE = arc
RC_FLAGS = -v
OBJ_FORMAT = COFF
X123.XPJ
[X123.XPJ]
X123.EXE
[X123.EXE]
DCLIPX.LIB
X123.PRG
#include "dcbitmap.ch"
#include "dcicon.ch"
#include "appevent.ch"
#include "xbp.ch"
#include "inkey.ch"
#include "dcmsg.ch"
#include "dll.ch"
Procedure appsys
RETURN
PROCEDURE MAIN
LOCAL GETOPTIONS,GETLIST:={},oApp:=SetAppWindow(),oXbp,nCPU
MSGBOX('TEST 1')
** remove this 3 lines will have no error
*----------------------------------------
thread():new():start("stress")
Ncpu:=smpgetcpu()
msgbox(str(Ncpu))
*----------------------------------------
MSGBOX('TEST 2')
DCREAD GUI
RETURN
FUNCTION SMPGETCPU()
LOCAL I
I:=DLLCALL("XPPRT1.DLL",DLL_CDECL,"_SYSGETCPU")
RETURN I
procedure stress()
local a:={3,2,1,0}
do while .t.
asort(a)
enddo
return
* xpj ---------------------------------------------
[PROJECT]
COMPILE = xpp
COMPILE_FLAGS = /q /n /m /p /dll:DYNAMIC
DEBUG = yes
GUI = yes
LINKER = alink
LINK_FLAGS =
RC_COMPILE = arc
RC_FLAGS = -v
OBJ_FORMAT = COFF
X123.XPJ
[X123.XPJ]
X123.EXE
[X123.EXE]
DCLIPX.LIB
X123.PRG
Re: Multi core CPU
this is WRONG !!!STLau wrote:I:=DLLCALL("XPPRT1.DLL",DLL_CDECL,"_SYSGETCPU")
ist must be "lower()"oError:args :
-> VALTYPE: C VALUE: Xpprt1.dll
-> VALTYPE: N VALUE: 8
-> VALTYPE: C VALUE: _SYSGETCPU
oError:canDefault : J
oError:canRetry : N
oError:canSubstitute: N
oError:cargo : NIL
oError:description : Unbekannte Funktion
oError:filename :
oError:genCode : 21
oError:operation : dllPrepareCall
Code: Select all
i := DllCall("Xpprt1.dll",DLL_CDECL, "_sysGetCPU")
greetings by OHR
Jimmy
Jimmy
Re: Multi core CPU
Hi Auge_Ohr
Yes, the problem is solved. Never thought of such possible cause. Thank you very much for your help.
regards
Yes, the problem is solved. Never thought of such possible cause. Thank you very much for your help.
regards
Re: Multi core CPU
After implementing the DC_setcpu() as provided by Roger, the assignment of CPU core works, however, the assignment is based on the last CPU# saved in the file created. Therefore, it can end up with a situation where the same core is running for a few application when all application in other core quit.
eg, I execute 12 times the same program on a 4 CORE CPU. The Core use is 0123 0123 0123 for a start. But when the program ended in core 1,2 and 3. It will left with core 0 runnning for 3 appilcation.
I would like to know is there a way to detect the next available CPU and assign to that CPU instead of sequentially allocate to the next CPU.
Regards
eg, I execute 12 times the same program on a 4 CORE CPU. The Core use is 0123 0123 0123 for a start. But when the program ended in core 1,2 and 3. It will left with core 0 runnning for 3 appilcation.
I would like to know is there a way to detect the next available CPU and assign to that CPU instead of sequentially allocate to the next CPU.
Regards
- Markus Walter
- Posts: 54
- Joined: Thu Jan 28, 2010 12:49 am
- Location: Germany
Re: Multi core CPU
Hello,
i think that would be useless. Even if you test the load of the core units in this moment, you can't look in the future. Perhaps one core is now with small load, but in the next second a task which runs on this core unit generates a big load... In my opinion analyzing cpu loads could only help if we could switch a running task from one unit to another, but this is not possible with xbase or if the os can do the job, but this isn't possible with xbase-exes, too.
I use a random algorithsm and this works good (exp. on Terminal Server)...
i think that would be useless. Even if you test the load of the core units in this moment, you can't look in the future. Perhaps one core is now with small load, but in the next second a task which runs on this core unit generates a big load... In my opinion analyzing cpu loads could only help if we could switch a running task from one unit to another, but this is not possible with xbase or if the os can do the job, but this isn't possible with xbase-exes, too.
I use a random algorithsm and this works good (exp. on Terminal Server)...
-----------------
Greetings
Markus Walter
Greetings
Markus Walter