This project is read-only.

ParallelFox Initial Release

Aug 9, 2010 at 3:56 AM
Edited Aug 9, 2010 at 3:58 AM
ParallelFox is a parallel processing library for Visual FoxPro. I just posted the first Beta release, along with a couple of training videos. More videos are coming, but I will get more info on the ParallelFox page before those are ready. In the meantime, please download ParallelFox, play with it, and let me know what you think. Thanks!
Aug 9, 2010 at 9:33 AM
Nice. Excellent job Joel.
Aug 9, 2010 at 4:54 PM
Edited Aug 9, 2010 at 5:01 PM

Joel

First off I have an older Core 2 DUO.

I ran the example call_before and call_after and if the results on screen are correct, then I am truly impressed with what you have done. So I checked this out some more.

For instance callmethod_before takes 22.091 seconds but callmethod_after completes in a flat 0.125 seconds!!! Here I am assuming that your example _before shows normal VFP code running and _after is similar code but with parallel processing enabled thru your classes? Is that so? However on further checking all is not what it seems. For instance I changed the code to this (below) in callmethod_before.prg and callmethod_after.prg:

DEFINE CLASS MyObject AS Custom

Procedure SimulateWork
Local i

For i = 1 to 1000000
* Peg CPU
EndFor
SET SAFETY OFF && I added this line
STRTOFILE(TTOC(DATETIME()),"test.txt") && and this line
EndProc

callmethod_before - Takes much longer to run the code - 22+ seconds, but at the end there is a file "test.txt" in the folder.

callmethod_after - Runs in 0.120 seconds - but there is NO file "test.txt" created which means that the Procedure SimulateWork() which is supposed to simulate some lengthy process is never called. That is why it is faster.

In callmethod_before, if I comment out the FOR loop in SimulateWork() I get the even more impressive results - 0.021 seconds and this is without Parallel processing.

So could you explain what exactly these examples are supposed to prove?

I watched your videos and your first example shows STEPS.PRG running as normal VFP and then you add your classes and run it as a "parallel" process.

I added similar code as above to make sure the processor was actually being "pegged" in Steps_before and steps_after.

Procedure SimulateWork

LPARAMETERS cStep

Local i

For i = 1 to 1000000

    * Peg CPU

ENDFOR

SET SAFETY OFF

STRTOFILE("Step:"+cStep,"Step"+cStep+".txt")

EndProc

and each call to this method is made like this:

For step1

SimulateWork("1")

For step2

SimulateWork("2")

etc.

For Steps_before - takes long to run but after completion there are 5 TXT files as expected.

For Steps_after - At the end of the run, I find only step1.txt and step5.txt (created in normal vfp) which proved to me that SimulateWork() is never called by your "parallel process" code. Only the normal vfp code runs it. Step2, 3 & 4 .txt which are supposed to be created in parallel are never created. This is why it appears to run faster.

Can you please explain what exactly is going on and why your "parallel process" code in your examples do not call SimulateWork() and create the appropriate files on my computer?

Can you also please change the examples as I have and see if those files are created ? Bernard

Aug 9, 2010 at 6:36 PM
Bernard, I was able to repro your problem the first time I tried it, but then I got pulled away and I can't do it again. I think it is a pathing problem. Try a CLEAR ALL or restart Fox, then move the example files into the same directory as ParallelFox.vcx (which is where I originally created them) and run the example again from there. You should then get more realistic times. Thanks, Joel
Aug 9, 2010 at 10:46 PM
Ok, the main ParallelFox page has been updated with basic info that will be included in each video. The videos will go into more detail, but this should be enough to get you started. Let me know if you have questions. Thanks!
Aug 10, 2010 at 3:19 AM
Edited Aug 10, 2010 at 3:21 AM

Joel

Joel

Ok. After receiving your email I actually copied the example files into the main folder where the Parallellfox.vcx was.

Then I ran them and they "work as advertised"

One thing though (I know this is beta) the separate VFP processes open a separate session of VFP and leave them open. These should be:

1. Hidden
2. Closed when work is done.

Also

1. As I suggested you should change all those references in NEWOBJECT from "Parallellfox.vcx" to This.ClassLibrary to avoid pathing problems.

2. What is the purpose of the EXE COM Server Parallellfox.exe when you use the classes everywhere?

Great work and thanks for the documentation.

Bernard

Aug 10, 2010 at 1:31 PM

Perfect work Joel, I'm really impressed.

But one question:

all worker classes are in prg's, isn't it possible to work with visual classes also?

bbout wrote:
One thing though (I know this is beta) the separate VFP processes open a separate session of VFP and leave them open. These should be:

1. Hidden

  As far as I know, you can reach this by changing the debugswitch of startworkers to .F.:

Parallel.StartWorkers("Call_After.prg",,.F.)

 

Best regards

Jochen

Aug 10, 2010 at 9:56 PM
Very Impressive job, Joel. This is really great work. Just a note: On my Dell Dimension 8400 Pentium 4, GetEnv("NUMBER_OF_PROCESSORS") returns 2 (from parpoolmgr.init.) Must be the Hyperthreading. Sorry, I haven't compiled or tested anything yet. Thanks for keeping the VFP world alive. Yitzy
Aug 16, 2010 at 2:48 PM
JochenKauz wrote:

all worker classes are in prg's, isn't it possible to work with visual classes also?

Yes, you can use ParallelFox with visual classes.
Aug 16, 2010 at 2:50 PM
uncleyitz wrote:
On my Dell Dimension 8400 Pentium 4, GetEnv("NUMBER_OF_PROCESSORS") returns 2 (from parpoolmgr.init.) Must be the Hyperthreading.
Correct. GetEnv("NUMBER_OF_PROCESSORS") returns the number of "logical" processors, which is doubled by Hyperthreading, and is also what ParallelFox uses.
Aug 16, 2010 at 3:48 PM
joelleach wrote:
JochenKauz wrote:

all worker classes are in prg's, isn't it possible to work with visual classes also?

Yes, you can use ParallelFox with visual classes.

 Thanks for the answer. But I think I must be a little bit more precise. As I have seen in your code you issue a SET PROCEDURE TO command for the worker class, this would not work if I use a VCX, correct?

 

Aug 16, 2010 at 4:15 PM
JochenKauz wrote:
joelleach wrote:
JochenKauz wrote:

all worker classes are in prg's, isn't it possible to work with visual classes also?

Yes, you can use ParallelFox with visual classes.

 Thanks for the answer. But I think I must be a little bit more precise. As I have seen in your code you issue a SET PROCEDURE TO command for the worker class, this would not work if I use a VCX, correct?

 

Correct, but your VCX is compiled into an APP/EXE, is it not? So, you set procedure to that APP/EXE, rather than a PRG, and your VCXs will be found inside it.