Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why Processing Performance is Not Increasing ?
Message
De
15/02/2014 06:26:42
 
 
À
15/02/2014 06:16:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01594373
Message ID:
01594384
Vues:
43
Sir, Thank you very Much. I will try both the things tonight and will also try to GUITHREAD and will respond you.

Thank You
Regards.
Harsh



>>>>What is the thing that might be hindering my performance. and how can I improve it. Please provide appropriate solution.
>>>
>>>
>>>VFP is not a good tool for parallel processing.
>>>
>>>What is your algorithm doing? Scanning a directory and feeding the DLL files? Or more?
>>>
>>>Did you try using multiple DLL copies?
>>
>>No Sir, That day told me to do so, but I was wondering how it will be done. I will create multiple copy of my DLL like ps2pdf-2.dll, ps2pdf-3.dll but What is to be done next. Here is my example Can you please Exemplify me.
>
>In the future, please try to post your code between [pre] and [/pre] blocks. You have [pre] and [pre] on this one, and it loses formatting.
>
>In your code below, you would include an additional parameter indicating which thread you are. In that case rather than using "ps2pdf.dll" you would do this:
>
PARAMETERS iFilename,oFilename,RCNON, iThreadNum
>LOCAL lcDllName
>
>* Other code goes here
>
>lcDllName = "ps2pdf-" + TRANSFORM(iThreadNum) + ".dll"
>IF NOT FILE(lcDllName)
>    lcDllName = "ps2pdf.dll"  && Fallback on original DLL if we're past our copies
>ENDIF
>
>* Declare the functions
>DECLARE INTEGER _apCreate@0   IN (lcDllName) AS apCreate
>DECLARE         _apClose@4    IN (lcDllName) AS apClose   INTEGER id
>DECLARE INTEGER _apConvert@4  IN (lcDllName) AS apConvert INTEGER id
>DECLARE INTEGER _apSetFunc@24 IN (lcDllName) AS apSetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>DECLARE INTEGER _apGetFunc@24 IN (lcDllName) AS apGetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>
>
>In this way you will be using a different DLL in each case. You're probably also safe with Intel chips of using 2 to 4 threads per CPU. Intel's chips implement something called HyperThreading, and whereas it's not the same as having an additional full core running through your data, it is often several percentage points faster than running a single thread per core as it has multiple decoders and can switch back and forth during blocking operations (like retrieving some data from memory in hyperthread-1, it can continue work on hyperthread-2, then switch back, and so on).
>
>
Parallel.SetWorkerCount(Parallel.CPUCount * 2)
>
>I'm not sure how Parallel fox works, but I don't know if it's spawning multiple processes and communicating with them that way. If you want to use the same code, you can use my GuiThreads library and modify it to do your work. You'll change the message passing system to create a table for each thread and keep it saturated from your main thread. In that way you should be able to create up to 32 threads (four per core) and have decent performance on an Intel Core i7 8-way.
>
>See: https://github.com/RickCHodgin/guithread
>
>To clone:
>
C:\> cd c:\vfp\
>C:\vfp\> git clone https://github.com/RickCHodgin/guithread.git
>C:\vfp\> _
>
>If you need help modifying it, let me know. But please spend some time examining the code before you ask me to code everything for you. :-) It is pretty self-explanatory, and I can help you with the migration to your particular program needs if you like.
>
>Please note this part as well. You will have to execute the reset command to restore it to a working version. The help file on the github link above should help you get started. Basically run it as it says, and then you can examine the source code to figure out how it works:
>
Jun.19.2013 -- This program is currently undergoing a massive revision.
>If you need to access a prior stable version, clone the repository and execute:
>        git reset --hard de02495229ddc96acbf0a1718f72a4eaf5173c38
>
>After you clone from github, you must execute this command to get to a stable, working version.
>
>>
>>

>>Local loMyObject
>>loMyObject = CreateObject("MyObject")
>>loMyObject.Mainprocess()
>>Return
>>
>>DEFINE CLASS MyObject AS Custom
>>PROCEDURE Mainprocess
>>Local Parallel as Parallel
>>Parallel = NewObject("Parallel", "ParallelFox.vcx")
>>Parallel.SetWorkerCount(Parallel.CPUCount)
>>Parallel.StartWorkers()
>>
>>SCAN
>>iFilename=ALLTRIM(Fullpath)
>>oFilename=ALLTRIM(Newpath)
>>RCNON=Recno()
>>Parallel.CallMethod("ps2pdf", This.Class, This.ClassLibrary,,,iFilename,oFilename,RCNON)
>>ENDSCAN
>>ENDPROC
>>
>>** Convert ps files to PDF Using ps2PDF.Dll
>>PROCEDURE ps2PDF
>>PARAMETERS iFilename,oFilename,RCNON
>>DECLARE INTEGER _apCreate@0 IN ps2pdf.dll AS apCreate
>>DECLARE _apClose@4 IN ps2pdf.dll AS apClose INTEGER id
>>DECLARE INTEGER _apConvert@4 IN ps2pdf.dll AS apConvert INTEGER id
>>DECLARE INTEGER _apSetFunc@24 IN ps2pdf.dll AS apSetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>>DECLARE INTEGER _apGetFunc@24 IN ps2pdf.dll AS apGetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>>#define AP_Set_Output 3000
>>#define AP_Set_Input 3001
>>id=apCreate()
>>IF (id # 0)
>>apSetFunc(id, AP_Set_Input , 0, 0,iFilename, 0) &&input file.
>>apSetFunc(id, AP_Set_Output, 0, 0,oFilename, 0) &&output format and file.
>>apConvert(id)
>>apClose(id)
>>Sys(2335, 1) && disable unattended mode, allow UI
>>WAIT WINDOW 'Converting to PDF..'+ALLTRIM(STR(RCNON)) NOWAIT
>>ENDIF
>>ENDPROC
>>
>>
>>
>>
>>
>>
>>

Harsh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform