![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

I have a need to utilize the additional processors that are now coming in windows boxes. I had assumed that adding threads would automatically utilize these extra processes and I was surprised to learn I was wrong. I have the 'affinity' for SF.EXE set to both CPU1 and CPU0 in the windows task manager and when I run the following from the command line I use 50% of the CPU on the performance graph. In fact, sometimes one or the other processor is more heavily used during this operation.
The code snip-it included below is the heart of a monte-carlo simulation program. The actual calculations in CHAIN are rather extensive and take many seconds for the full set of experiments to complete. When I tried running the experiments in 2 tasks Q1 and Q1 the CPU usage dropped to only 35-40% and the time to finish extended accordingly. I then added QQ1 AND QQ2 to increase the priority of the threads. I now can get back to the 50% CPU utilization I had with a single task, but the other CPU is still not being utilized.
Does anyone have information on how to gain full attention of both CPU's?
Thanks, Ken B
<snip-it>
1000 to #gates
100 to #exp
: EXPERIMENT
/GATES
GATE RATES /. TO MicroS/Fs
0 0 ET 2!
0 \ INITIAL TIME
#GATES 0 DO
GATES{{ @ I [ |GATES| 1 - ] LITERAL AND |EPSILON| * + ^GATE !
GATE NEGATE +
BEGIN
DUP 0<
WHILE
MicroS/Fs TIME
DUP ET 2@ ROT M+ ET 2!
+
CHAIN
REPEAT
GATE>FEYNMAN
LOOP
NEGATE ET 2@ ROT M+ ET 2!
;
: EXPERIMENTS ( SUMS INTO PREVIOUS TALLEYS )
/GATES
#EXP |EXP| MIN 0 DO PAUSE
EXPERIMENT
LOOP
;
8192 TASK TASK1
8192 TASK TASK2
: Q1 TASK1 ACTIVATE EXPERIMENTS GATES{{ @ FREE TO malloc-fail? TERMINATE ;
: Q2 TASK2 ACTIVATE EXPERIMENTS GATES{{ @ FREE TO malloc-fail? TERMINATE ;
Function: SetThreadPriority ( a b -- x )
: qq1 q1 task1 taskhandle THREAD_PRIORITY_HIGHEST SetThreadPriority . ;
: qq2 q2 task1 taskhandle THREAD_PRIORITY_HIGHEST SetThreadPriority . ;
Dr. Kenneth B Butterfield
phone: 505 667 8944
PO Box 1663
ms J562
Los Alamos National Laboratory
Los Alamos New Mexico 87545
"I do not trust a computer that I am not carrying!"
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Wed May 09 2007 - 11:51:05 PDT
This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:18 PST