Parallel processing questions
The following two code segments work faster on my 1.75ghz single core processor (1gb ram) than it does on another computer with 4 1.87ghz processors (8gb ram), and I cannot figure out why for the life of me.
In the first bit of code I made the smooth vi reentrant, and they do not depend on each other in anyway, so I would expect them to be running in parallel.
In the second bit of code I have 3 mathscripts which are not dependant on each other, so I would also expect them to run in parallel.
Does anyone have any ideas/suggestions on why it doesn't work?
Thanks,
Tim
Message Edited by elset191 on 02-05-2009 02:51 PM
Tim Elsey
LabVIEW 2010, 2012
Certified LabVIEW Architect
The contents of the subvi are actually just the mathscripts that you
see under them. I have the code configured in two ways. One way uses
the 4 subvi calls on 4 separate arrays. The other way calls the subvi
once on one array which is a combination of the other four.
The
attached vi is what is pictured as smooth. It contains three
mathscript structures which operate on the beginning, middle and end of
the input array. This is the second configuration I described above.
Another
way I do it, to see if it works better or runs faster, is to take the
components that go into the 1d array above, and run the algorithm on
each of them. The interesting portion of the code is pictured above.
Details:
The arrays are 283x129.
I
measure execution time by running them and seeing which one finishes
first. They take a very long time to run. A couple minutes generally.
The processor on the single processor computer is a 1.73 GHz Intel Pentium M, it's in my laptop.
The multicore processor is a I.87 GHz Intel Xeon dual core
Both computers are running 32 bit OS. The laptop is XP, the big one is Vista.
Assume the big one has at least as much cache as my laptop, I'm sure it has much more.
Both computers are running LV8.6
Tim Elsey
LabVIEW 2010, 2012
Certified LabVIEW Architect
Attachments:
smoothsub.vi 381 KB
Similar Messages
-
I have written a module to read data from an external source, convert input to IDOCS, and process these IDOCS.
Due to performance of IDOC processing, I decided to use parallel processing to spread the IDOC creation load among several processes using server groups.
My main program sets up the parallel processing environment with a call to function module SPBT_INITIALIZE, then make repeated calls to a function module that processes the IDOCS, using the STARTING NEW TASK and DESTINATION IN GROUP xxx keywords.
What I'm seeing is the main process running as a background task and one dialog process running the parallel function module, even though there are still 8 or 9 other dialog processes available.
What I expected to see was several dialog process running my child function modules, not just the one.
Does anyone know why the other dialog processes are not being used?
Thanks for any input,
Dorian.Thomas:
I'm logging any errors that occur; I'm not seeing any resource failures - in fact no errors at all, other than expected application data errors. It seems that the RFC calls are all being made in a single child process that queues up the parallel jobs and uses just one dialog process to run them all. I expected to see as many dialog tasks being used as were available.
As far as the RFC parameters go - are you referring to the RZ10 values? I looked at all of the parameters containing "rfc" as part of their name, and nothing looked as though it was restricting the parallel task behaviour. Do you have any advice as to suitable settings?
I'm also wondering if what I am seeing is just the way SAP is supposed to work? Although I expected to see lots of child processes running in multiple dialogs if processes are available, maybe by design only one remote process per server is allowed? I checked the documentation I could find on the "starting new task" keyword, and nowhere does it say that multiple processes will be started on each server in the server group; only that a child process will NOT be started if the number of unused processes fall below a defined threshold. -
Question on Parallel Processing in ABAP
Hi Experts,
I am trying to process my records using Parallel Processing concept making calls to Remote Function Module.
So, in simple terms it would look as shown below
loop.
call function <rfc_module> creating new task with <taskname>
endloop.
1. In the above scenario say it created 5 tasks.
2. If one of the tasks have been failed because of timeout error then what happens to that task.
In the below link it says that the dialog work proces can run only for 300 seconds.
http://help.sap.com/saphelp_nw70/helpdata/en/fa/096e92543b11d1898e0000e8322d00/content.htm
3. How do we track the task that has not been finished successfully?
4. Does that throw an error?
Thanks,
Babu KilariHere is an exmple from HELP
TYPES: BEGIN OF task_type,
name TYPE string,
dest TYPE string,
END OF task_type.
DATA: snd_jobs TYPE i,
rcv_jobs TYPE i,
exc_flag TYPE i,
info TYPE rfcsi,
mess TYPE c LENGTH 80,
indx TYPE c LENGTH 4,
name TYPE c LENGTH 8,
task_list TYPE STANDARD TABLE OF task_type,
task_wa TYPE task_type.
DO 10 TIMES.
indx = sy-index.
CONCATENATE 'Task' indx INTO name.
CALL FUNCTION 'RFC_SYSTEM_INFO'
STARTING NEW TASK name
DESTINATION IN GROUP DEFAULT
PERFORMING rfc_info ON END OF TASK
EXCEPTIONS
system_failure = 1 MESSAGE mess
communication_failure = 2 MESSAGE mess
resource_failure = 3.
CASE sy-subrc.
WHEN 0.
snd_jobs = snd_jobs + 1.
WHEN 1 OR 2.
MESSAGE mess TYPE 'I'.
WHEN 3.
IF snd_jobs >= 1 AND
exc_flag = 0.
exc_flag = 1.
WAIT UNTIL rcv_jobs >= snd_jobs
UP TO 5 SECONDS.
ENDIF.
IF sy-subrc = 0.
exc_flag = 0.
ELSE.
MESSAGE 'Resource failure' TYPE 'I'.
ENDIF.
WHEN OTHERS.
MESSAGE 'Other error' TYPE 'I'.
ENDCASE.
ENDDO.
WAIT UNTIL rcv_jobs >= snd_jobs.
LOOP AT task_list INTO task_wa.
WRITE: / task_wa-name, task_wa-dest.
ENDLOOP.
FORM rfc_info USING name.
task_wa-name = name.
rcv_jobs = rcv_jobs + 1.
RECEIVE RESULTS FROM FUNCTION 'RFC_SYSTEM_INFO'
IMPORTING
rfcsi_export = info
EXCEPTIONS
system_failure = 1 MESSAGE mess
communication_failure = 2 MESSAGE mess.
IF sy-subrc = 0.
task_wa-dest = info-rfcdest.
ELSE.
task_wa-dest = mess.
ENDIF.
APPEND task_wa TO task_list.
ENDFORM. -
Parallel processing - some questions
Hi,
I'm about to develop a class for task management.
It should have methods like GET_TASK returning a taskid and task_return importing task_id received and possibly task_fail importing task_id sent with a bad sy-subrc when calling function with starting new task.
The idea behind is: New task is started by system using a dialog process with time limit restriction applying. Thus I have to split the whole task into more small packets than processes available. So I think I have to use the same task again after it returned successfully.
My assumption is I can't use more tasks than processes initially available and I can use the same tsak again after it has successsfully returned results.
I want some ideas and information on that exceeding the SAP documentation.
TIA.
Regards,
Clemens... and here comes the program (no formatting available with the answer given with "solved".
The programs retrieves billing documents with function BAPI_BILLINGDOC_GETLIST - this was the only BAPI I found quickly that has ranges as import parameters. This allows giving packages to the tasks.
*& Report ZZZPARTEST *
REPORT zzzpartest.
PARAMETERS:
p_dbcnt TYPE sydbcnt DEFAULT 1010,
p_pacsz TYPE sydbcnt DEFAULT 95.
CONSTANTS:
gc_function TYPE tfdir-funcname
VALUE 'BAPI_BILLINGDOC_GETLIST'.
DATA:
gt_bapivbrksuccess TYPE TABLE OF
bapivbrksuccess,
gv_activ TYPE i,
gv_rcv TYPE i,
gv_snd TYPE i,
BEGIN OF ls_intval,
task TYPE numc4,
idxfr TYPE i,
idxto TYPE i,
activ TYPE flag,
fails TYPE i,
END OF ls_intval,
gt_intval LIKE TABLE OF ls_intval.
START-OF-SELECTION.
PERFORM paralleltest.
* CLASS task DEFINITION
CLASS task DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
provide
RETURNING
value(name) TYPE numc4,
return
IMPORTING
name TYPE numc4,
initialize
RETURNING
value(group) TYPE rzllitab-classname.
PRIVATE SECTION.
CLASS-DATA:
gv_group TYPE rzllitab-classname,
BEGIN OF ls_task,
name TYPE numc4,
used TYPE flag,
END OF ls_task,
gt_task LIKE TABLE OF ls_task.
ENDCLASS. "itab DEFINITION
*** CLASS itab IMPLEMENTATION ***
CLASS task IMPLEMENTATION.
METHOD initialize.
DATA:
lv_max TYPE i,
lv_inc TYPE numc7,
lv_free TYPE i.
CHECK gt_task IS INITIAL.
SELECT classname
INTO gv_group
FROM rzllitab UP TO 1 ROWS
WHERE grouptype = 'S'.
ENDSELECT.
CALL FUNCTION 'SPBT_INITIALIZE'
EXPORTING
group_name = gv_group
IMPORTING
max_pbt_wps = lv_max
free_pbt_wps = lv_free
EXCEPTIONS
invalid_group_name = 1
internal_error = 2
pbt_env_already_initialized = 3
currently_no_resources_avail = 4
no_pbt_resources_found = 5
cant_init_different_pbt_groups = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
SUBTRACT 2 FROM lv_free.
IF lv_free >= 1.
DO lv_free TIMES.
ls_task-name = sy-index.
APPEND ls_task TO gt_task.
ENDDO.
group = gv_group.
MESSAGE s000(r1)
WITH
'Parallelverarbeitung benutzt'
lv_free
'Prozesse in Gruppe'
gv_group.
ELSE.
MESSAGE e000(r1)
WITH
'Parallelverarbeitung abgebrochen,'
lv_free
'Prozesse in Gruppe'
gv_group.
ENDIF.
ENDMETHOD. "initialize
METHOD provide.
FIELD-SYMBOLS:
<task> LIKE ls_task.
IF gv_group IS INITIAL.
MESSAGE e000(r1)
WITH 'Task group not initialized'.
ENDIF.
LOOP AT gt_task ASSIGNING <task>
WHERE used IS initial.
EXIT.
ENDLOOP.
CHECK sy-subrc = 0.
<task>-used = 'X'.
name = <task>-name.
ENDMETHOD.
METHOD return.
LOOP AT gt_task INTO ls_task
WHERE
name = name
AND used = 'X'.
DELETE gt_task.
ENDLOOP.
IF sy-subrc = 0.
CLEAR ls_task-used.
APPEND ls_task TO gt_task.
ELSE.
* fatal error
ENDIF.
ENDMETHOD.
ENDCLASS. "itab IMPLEMENTATION
*& Form paralleltest
FORM paralleltest.
DATA:
ls_bapi_ref_doc_range TYPE bapi_ref_doc_range,
lv_done TYPE flag,
lv_group TYPE rzllitab-classname,
lv_task TYPE numc4,
lv_msg TYPE text255,
lv_grid_title TYPE lvc_title,
lv_tfill TYPE sytfill,
lv_vbelv TYPE vbelv,
lv_npacs TYPE i,
lt_vbelv TYPE SORTED TABLE OF vbelv
WITH UNIQUE KEY table_line,
lv_mod TYPE i.
FIELD-SYMBOLS:
<intval> LIKE LINE OF gt_intval.
* build intervals
SELECT vbelv INTO lv_vbelv
FROM vbfa.
INSERT lv_vbelv INTO TABLE lt_vbelv.
CHECK sy-subrc = 0.
ADD 1 TO lv_tfill.
CHECK:
p_dbcnt > 0,
lv_tfill >= p_dbcnt.
EXIT.
ENDSELECT.
DESCRIBE TABLE lt_vbelv LINES lv_tfill.
IF (
p_pacsz < p_dbcnt OR
p_dbcnt = 0
) AND
p_pacsz > 0.
* p_dbcnt > 0 ).
lv_npacs = lv_tfill DIV p_pacsz.
lv_mod = lv_tfill MOD p_pacsz.
IF lv_mod <> 0.
ADD 1 TO lv_npacs.
ENDIF.
DO lv_npacs TIMES.
ls_intval-idxfr = ls_intval-idxto + 1.
ls_intval-idxto = ls_intval-idxfr - 1
+ p_pacsz.
IF ls_intval-idxto > lv_tfill.
ls_intval-idxto = lv_tfill.
ENDIF.
APPEND ls_intval TO gt_intval.
ENDDO.
ELSE.
ls_intval-idxfr = 1.
ls_intval-idxto = lv_tfill.
APPEND ls_intval TO gt_intval.
ENDIF.
WHILE lv_done IS INITIAL.
* find an interval to be processed
LOOP AT gt_intval ASSIGNING <intval>
WHERE activ = space
AND fails BETWEEN 0 AND 5.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
* no inactive unprocessed interval. All complete or must wait?
* check for intervals with unsuccesful tries
LOOP AT gt_intval ASSIGNING <intval>
WHERE fails BETWEEN 0 AND 5.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
* wait until all started processes have been received.
* Note: No receive is executed without WAIT
WAIT UNTIL gv_activ IS INITIAL UP TO 600 SECONDS.
ELSE.
* all done
lv_done = 'X'.
ENDIF.
UNASSIGN <intval>.
ENDIF.
* process interval if provided
IF <intval> IS ASSIGNED.
WHILE lv_task IS INITIAL.
IF lv_group IS INITIAL.
* init parallel processing
lv_group = task=>initialize( ).
ENDIF.
* get unused task
lv_task = task=>provide( ).
CHECK lv_task IS INITIAL.
* no unused task? wait for all started task are received
WAIT UNTIL gv_activ IS INITIAL UP TO 600 SECONDS.
ENDWHILE.
* call if task assigned
CHECK NOT lv_task IS INITIAL.
* prepare function parameters
ls_bapi_ref_doc_range = 'IBT'.
READ TABLE lt_vbelv INTO ls_bapi_ref_doc_range-ref_doc_low
INDEX <intval>-idxfr.
READ TABLE lt_vbelv INTO ls_bapi_ref_doc_range-ref_doc_high
INDEX <intval>-idxto.
* mark interval as failed
ADD 1 TO <intval>-fails.
ADD 1 TO gv_snd.
CALL FUNCTION gc_function
STARTING NEW TASK lv_task
DESTINATION IN GROUP lv_group
PERFORMING bapi_receive ON END OF TASK
EXPORTING
refdocrange = ls_bapi_ref_doc_range
EXCEPTIONS
communication_failure = 1 MESSAGE lv_msg
system_failure = 2 MESSAGE lv_msg
RESOURCE_FAILURE = 3.
IF sy-subrc = 0.
<intval>-activ = 'X'.
<intval>-task = lv_task.
ADD 1 TO gv_activ.
ELSE.
CALL METHOD task=>return EXPORTING name = lv_task.
ENDIF.
CLEAR lv_task.
ENDIF.
ENDWHILE.
* wait for pending processes
MESSAGE s000(r1) WITH 'Wait for pending processes'.
WAIT UNTIL gv_activ IS INITIAL.
* report unfinished intervals
LOOP AT gt_intval ASSIGNING <intval>
WHERE fails >= 0.
READ TABLE lt_vbelv INTO ls_bapi_ref_doc_range-ref_doc_low
INDEX <intval>-idxfr.
READ TABLE lt_vbelv INTO ls_bapi_ref_doc_range-ref_doc_high
INDEX <intval>-idxto.
MESSAGE i000(r1)
WITH
'Unverarbeitetes Intervall von'
ls_bapi_ref_doc_range-ref_doc_low
'bis'
ls_bapi_ref_doc_range-ref_doc_high.
ENDLOOP.
MESSAGE s000(r1) WITH 'start ALV'.
* transfer results to standard table
WRITE gv_rcv TO lv_grid_title LEFT-JUSTIFIED.
lv_grid_title+40(1) = '+'.
WRITE gv_snd TO lv_grid_title+50 LEFT-JUSTIFIED.
REPLACE '+' WITH 'RCV/SND' INTO lv_grid_title.
CONDENSE lv_grid_title.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'BAPIVBRKSUCCESS'
i_grid_title = lv_grid_title
TABLES
t_outtab = gt_bapivbrksuccess.
ENDFORM. " paralleltest
*& Form bapi_receive
FORM bapi_receive USING pv_task TYPE any.
DATA:
lv_task TYPE numc4,
lt_bapivbrksuccess TYPE TABLE OF bapivbrksuccess,
lv_msg TYPE text80,
lv_subrc TYPE sy-subrc.
FIELD-SYMBOLS:
<intval> LIKE LINE OF gt_intval.
CLEAR lt_bapivbrksuccess.
RECEIVE RESULTS FROM FUNCTION gc_function
TABLES
success = lt_bapivbrksuccess
EXCEPTIONS
communication_failure = 1 MESSAGE lv_msg
system_failure = 2 MESSAGE lv_msg .
lv_subrc = sy-subrc.
lv_task = pv_task.
CALL METHOD task=>return EXPORTING name = lv_task.
LOOP AT gt_intval ASSIGNING <intval>
WHERE task = lv_task
AND fails <> -1.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
* fatal error
MESSAGE e000(r1)
WITH 'returned task' lv_task 'not in task table'.
ENDIF.
CLEAR <intval>-activ.
CASE lv_subrc.
WHEN 0.
<intval>-fails = -1.
APPEND LINES OF lt_bapivbrksuccess TO gt_bapivbrksuccess.
ADD 1 TO gv_rcv.
WHEN 1.
ADD 1 TO <intval>-fails.
WRITE: 'communication_failure for task', lv_task, lv_msg.
WHEN 2.
WRITE: 'system_failure', lv_task, lv_msg.
ADD 1 TO <intval>-fails.
ENDCASE.
SUBTRACT 1 FROM gv_activ.
ENDFORM. " bapi_receive
Regards,
Clemens -
Parallel processing of mass data : sy-subrc value is not changed
Hi,
I have used the Parallel processing of mass data using the "Start New Task" . In my function module I am handling the exceptions and finally raise the application specific old exception to be handled in my main report program. Somehow the sy-subrc is not getting changed and always returns 0 even if the expection is raised.
Can anyone help me about the same.
Thanks & Regards,
NitinHi Silky,
I've build a block of code to explain this.
DATA: ls_edgar TYPE zedgar,
l_task(40).
DELETE FROM zedgar.
COMMIT WORK.
l_task = 'task1'.
ls_edgar-matnr = '123'.
ls_edgar-text = 'qwe'.
CALL FUNCTION 'Z_EDGAR_COMMIT_ROLLBACK' STARTING NEW TASK l_task PERFORMING f_go ON END OF TASK
EXPORTING
line = ls_edgar.
l_task = 'task2'.
ls_edgar-matnr = 'abc'.
ls_edgar-text = 'def'.
CALL FUNCTION 'Z_EDGAR_COMMIT_ROLLBACK' STARTING NEW TASK l_task PERFORMING f_go ON END OF TASK
EXPORTING
line = ls_edgar.
l_task = 'task3'.
ls_edgar-matnr = '456'.
ls_edgar-text = 'xyz'.
CALL FUNCTION 'Z_EDGAR_COMMIT_ROLLBACK' STARTING NEW TASK l_task PERFORMING f_go ON END OF TASK
EXPORTING
line = ls_edgar.
*& Form f_go
FORM f_go USING p_c TYPE ctype.
RECEIVE RESULTS FROM FUNCTION 'Z_EDGAR_COMMIT_ROLLBACK' EXCEPTIONS err = 2.
IF sy-subrc = 2.
*this won't affect the LUW of the received function
ROLLBACK WORK.
ELSE.
*this won't affect the LUW of the received function
COMMIT WORK.
ENDIF.
ENDFORM. "f_go
and the function is:
FUNCTION z_edgar_commit_rollback.
*"*"Interface local:
*" IMPORTING
*" VALUE(LINE) TYPE ZEDGAR
*" EXCEPTIONS
*" ERR
MODIFY zedgar FROM line.
IF line-matnr CP 'a*'.
*comment raise or rollback/commit to test
* RAISE err.
ROLLBACK WORK.
ELSE.
COMMIT WORK.
ENDIF.
ENDFUNCTION.
ok.
In your main program you have a Logical Unit of Work (LUW), witch consists of an application transaction and is associated with a database transaction. Once you start a new task, your creating an independent LUW, with it's own database transaction.
So if you do a commit or rollback in your function the effect is only on the records your processing in the function.
There is a way to capture the event when this LUW concludes in the main LUW. That is the PERFORMING whatever ON END OF TASK. In there you can get the result of the function but you cannot commit or rollback the LUW from the function since it already have implicitly happened at the conclusion of the funtion. You can test it by correctly comment the code I've supplied.
So, if you want to rollback the LUW of the function you better do it inside it.
I don't think it matches exactly your question, maybe it lead you on the right track. Give me more details if it doesn't.
Hope it helps,
Edgar -
Parallel processing open items (FPO4P)
Hello,
I have a question about transaction FPO4p (parallel processing of open items).
When saving the parameters the following message always appears : "Report cannot be evaluated in parallel". The information details tells that when you use a specific parallel processing object, you also need to use that field to sort on.
I my case I use the object GPART for parallel processing (see tab technical settings). In the tab output control I selected a line layout which is sorted by business partner (GPART). Furthermore no selection options are used.
Does anyone know why the transaction cannot save the parameters and shows the error message specified above. I really don't know what goes wrong.
Thank you in advance.
Regards, Ramon.Ramon
Apply note 1115456.
Maybe that note can help you
Regards
Arcturus -
Parallel processing using ABAP objects
Hello friends,
I had posted in the performance tuning forum , regarding a performance issue problem , I am reposting it as it involves OO concept .
the link for the previous posting
Link: [Independent processing of elements inside internal table;
Here is the scenario,
I have a internal table with 10 records(indepentent) , and i need to process them .The processing of one record doesnt have any influence on the another . When we go for loop , the performance issue is that , the 10 th record has to wait until the 9 records get processed even though there is no dependency on the output.
Could some one tell a way out to improve the performance..
If i am not clear with the question , i would explain it still clearer...
A internal table has 5 numbers , say( 1,3,4,6,7)
we are trying to find square of each number ,,,
If it is a loop the finding of suare of 7 has to wait until 6 is getting completed and it is waste of time ...
This is related to parallel processing , I have refered to parallel processing documents,But I want to do this conceptually ..
I am not using conventional procedural paradigm but Object orientedness...I am having a method which is performing this action .What am I supposed to do in that regard.
Comradely ,
K.SibiHi,
As examplified by Edward, there is no RFC/asynchronous support for Methods of ABAP Objects as such. You would indeed need to "wrap" your method or ABAP Object in a Function Module, that you can then call with the addition "STARTING NEW TASK". Optionally, you can define a Method that will process the results of the Function Module that is executed asynchronously, as demonstrated as well in Edward's program.
You do need some additional code to avoid the situation where your program takes all the available resources on the Application Server. Theoretically, you cannot bring the server or system down, as there is a system profile parameter that determines the maximum number of asynchronous tasks that the system will allow. However, in a productive environment, it would be a good idea to limit the number of asynchronous tasks started from your program so that other programs can use some as well.
Function Group SPBT contains a set of Function Modules to manage parallel processing. In particular, FM SPBT_INITIALIZE will "initialize" a Server Group and return the maximum number of Parallel Tasks, as well as the number of free ones at the time of the initialization. The other FM of interest is SPBT_GET_CURR_RESOURCE_INFO, that can be called after the Server Group has been initialized, whenever you want to "fork" a new asynchronous task. This FM will give you the number of free tasks available for Parallel Processing at the time of calling the Function Module.
Below is a code snippet showing how these Function Modules could be used, so that your program always leaves a minimum of 2 tasks for Parallel Processing, that will be available for other programs in the system.
IF md_parallel IS NOT INITIAL.
IF md_parallel_init IS INITIAL.
*----- Server Group not initialized yet => Initialize it, and get the number of tasks available
CALL FUNCTION 'SPBT_INITIALIZE'
EXPORTING
GROUP_NAME = ' '
IMPORTING
max_pbt_wps = ld_max_tasks
free_pbt_wps = ld_free_tasks
EXCEPTIONS
invalid_group_name = 1
internal_error = 2
pbt_env_already_initialized = 3
currently_no_resources_avail = 4
no_pbt_resources_found = 5
cant_init_different_pbt_groups = 6
OTHERS = 7.
md_parallel_init = 'X'.
ELSE.
*----- Server Group initialized => check how many free tasks are available in the Server Group
for parallel processing
CALL FUNCTION 'SPBT_GET_CURR_RESOURCE_INFO'
IMPORTING
max_pbt_wps = ld_max_tasks
free_pbt_wps = ld_free_tasks
EXCEPTIONS
internal_error = 1
pbt_env_not_initialized_yet = 2
OTHERS = 3.
ENDIF.
IF ld_free_tasks GE 2.
*----- We have at leasr 2 remaining available tasks => reserve one
ld_taskid = ld_taskid + 1.
ENDIF.
ENDIF.
You may also need to program a WAIT statement, to wait until all asynchronous tasks "forked" from your program have completed their processing. Otherwise, you might find yourself in the situation where your main program has finished its processing, but some of the asynchronous tasks that it started are still running. If you do not need to report on the results of these asynchronous tasks, then that is not an issue. But, if you need to report on the success/failure of the processing performed by the asynchronous tasks, you would most likely report incomplete results in your program.
In the example where you have 10 entries to process asynchronously in an internal table, if you do not WAIT until all asynchronous tasks have completed, your program might report success/failure for only 8 of the 10 entries, because your program has completed before the asynchronous tasks for entries 9 and 10 in your internal table.
Given the complexity of Parallel Processing, you would only consider it in a customer program for situations where you have many (ie, thousands, if not tens of thousands) records to process, that the processing for each record tends to take a long time (like creating a Sales Order or Material via BAPI calls), and that you have a limited time window to process all of these records.
Well, whatever your decision is, good luck. -
Parallel processing in a block step.
Hi,
I have parallel processing in a block step. It is working fine. Now there is a request and so the question is, if there are 2 parallel loops created by the process block for user decision step and if one has become obselete, how do I deal with it.I need the process block to complete the 1 loop succesfully and proceed.
Let me know in case of questions.
Thanks.
Sukumar.Hi
I think you are using "ParForEach" in block. Let me know how you are making 1 parallel loop as obsolete.
Is that block is not getting completed after the 2nd parallel loop gets excuted?
Vinoth -
I don't think I ever got this answered..I'm running a functional test (LV2014..Win 7..DAQ6229) In the functional test.vi is a flat seq structure. In each of these seq's is a subvi... subvi1 then subvi2 etc. Each of these subvis I use the DAQ to measure DIO/voltages...etc. to do my UUT testing. Is there a way in ethier the functional test.vi or the subvis to monintor a boolean which stops the functional vi? Just looking for a way to have the DAQ running its thing...running the test ..and monitor a door switch ( the boolean) so that if the user opens the door to the test set it stops the test and turns on a Software LED that I've put on the front panel GUI of functional test. I know how to implement the boolean..I know how to implement the functional tests. I just don't know how to combined them so that they are both running simutaneously.
Thanks..
Solved!
Go to Solution.There are two questions here. One is "How do I get an immediate response to a change, either to a control or to an instrument reading?", and the other is "How do I synchronize the activities of two parallel processes?"
The first can be handled by an Event structure residing inside a While loop. This is something that patiently "waits" for one or more of the Events it is programmed to recognize. These are typically changes in the value of a Front Panel control, or "signalling changes" to a LabVIEW control or indicator (this means that you change the value in LabVIEW, but "signal" that the value changed).
There are numerous ways to get two parallel processes to exchange information. If you want to control the second process (such as to stop it), you need one or more "points of intervention". Unfortunately, if you have your process-to-be-controlled structured as a long, single sequence, figuring out an intuitive way of "interrupting" it can be tricky.
One thing you can do (given your existing architecture) is to look at each of the sub-processes (which I gather reside in sub-VIs). Is there a point within them that, if you had a "Stop" VI that returned a True value, would cause the sub-process to immediately exit, and that if Stop were true when it started, would again cause it to exit? [This is sometimes called a VI Global or a Functional Global Variable].
If this is the case, write yourself a Stop VI that contains a While loop with an uninitialize Shift Register holding a Boolean value (and initially False, by default). Wire the output to a Boolean Indicator called Stop, with a Boolean input called "Set Stop". Inside, put a Case statement such that if Set Stop is ever True, it sets the Shift Register (and thus Stop) to True.
In your Event structure, if a Stop condition appears, call the Stop VI with True wired to Set Stop. In each of your sub-VIs, call Stop in such a way that if it ever becomes True, the sub-VI exits (doing a safe shutdown, if necessary).
Note that you can have multiple Stop VIs sprinkled around your code, and even within a sub-VI -- you need to find the "vulnerable" points that are accessed sufficiently frequently to allow Stop to have an effect.
I'll leave it to others to discuss restructuring the entire top-level program (a single sequence is not a good way to do this, if for no other reason than it is absolutely inflexible ...).
Bob Schor -
Parallel Process Model vs Asynchrono​us Sequence
I've been studying the features of TestStand, and learning how to use it for about a month, so still very new to the environment (although I have been using Labview and Veristand pretty heavily for about a year). I wanted to get a little clarification on the use of the different process models, because I think I may be misunderstanding some of the terminology.
Here is a little background of my project:
I have a Labview VI that I created to interface with a remote target (emulator). I previously used the VI to run tests manually, and would like to use it as a code module in TestStand so that I can run automated tests. I intend to use the same VI repeatedly throughout the test sequence. The functionality of the system is dependent on maintaining constant communication with the emulator, so I can't be opening and closing the code module repeatedly. Once it is open, it has to stay open and continually communicate (I'm hoping I will not have to create "wrapper" code modules to be the go-between with my current VI). Breaking communication would cause most of the test results to become invalid. For these reasons, I had chosen to call the VI as a code module in a sub sequence so that it can be run asynchronously, outside of the main sequence.
Now, as I learn more about the details of TestStand, I am introduced to the concept of "Process Models". I had initially been using the default Sequential Process model, but would like to know if I should switch to the Parallel Process model. From what I can tell, the parallel process model is used when testing multiple UUTs, or running tests in parallel. Is this correct? To clarify my situation, I will only be testing 1 UUT, I will only be using 1 code module, and I will be running several test steps with that 1 code module. I will need to continually pass data back and forth with the code module as it runs in parallel to the main sequence, and there will likely be several sub sequences called during the process, so that I can maintain modularity with my testing.
So the question is, do I switch to the Parallel Process Model, or should I continue with the Sequential Process Model and the asynchronous sequence to run my code module in parallel? Thanks much.
GSinMN
Solved!
Go to Solution.Hey GSinMN,
Are you wanting to run your test steps in parallel with each other, or will that need to be a sequential process? The Parallel model is probably not the right choice for this application. The purpose of the Parallel model is to run the same test program on multiple UUT's at once, as you mentioned. Since you are just testing with a single UUT, the best approach would be to run the emulator communication module asynchronously, as you mentioned. You can easily pass data to this code module using a TestStand queue or a similar synchronization object.
Daniel E.
TestStand Product Support Engineer
National Instruments -
Parallel process with a queue and file?
Hello, first of all sorry for my bad english^^:
I am working for days on my project where I have to show the parallel process while transfering information by different ways and their problems (like timing and so on).
I chose the transmission of information to a parallel process by (1) a queue, and by (2) a file (.txt). (other ways are welcome, do you have 1-2 other ideas?)
To solve this problem I made three while loops, the first one is the original one, where the original information (as a signal) is created and send by queue and file to the other two while loops, where this information is getting evaluted to create the same signal.
so in the end you can compare all signals, if they are the same - so that you can answer the question with the parallelity of process.
but in my vi file i have some problems:
the version with the queue works pretty fine - it's almost parallel
but the version with file doesn't work parallel, and i have no idea how i can solve it - -
i'm a newbie^^
can someone correct my file, so both (file and queue version) run parallel with the original one, or tell me what i can or must do?
Attachments:
Queue_Data_Parallel_FORUM.vi 23 KBLapLapLap wrote:
Hello, first of all sorry for my bad english^^:
I am working for days on my project where I have to show the parallel process while transfering information by different ways and their problems (like timing and so on).
I chose the transmission of information to a parallel process by (1) a queue, and by (2) a file (.txt). (other ways are welcome, do you have 1-2 other ideas?)
To solve this problem I made three while loops, the first one is the original one, where the original information (as a signal) is created and send by queue and file to the other two while loops, where this information is getting evaluted to create the same signal.
so in the end you can compare all signals, if they are the same - so that you can answer the question with the parallelity of process.
but in my vi file i have some problems:
the version with the queue works pretty fine - it's almost parallel
but the version with file doesn't work parallel, and i have no idea how i can solve it - -
i'm a newbie^^
can someone correct my file, so both (file and queue version) run parallel with the original one, or tell me what i can or must do?
A queue is technically never parallell, though you can have several if you really need parallellism. Other methods include Events, Action Engines, Notifiers (and why not webservices) for information transfer between processes.
Due to limitations in the disk system you can only read/write one file at a time from one process, so i wouldn't recommend that. If you use a ramdisk it might work.
/Y
LabVIEW 8.2 - 2014
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
G# - Free award winning reference based OOP for LV -
Is pga is being used in Parallel process
HI
is pga is being used in parallel processing. if yes then increasing the size of pga can increase performance
thankFirstofall we need to clarify the "PGA" in Oracle.
PGA is a type of memory which contains data and control information for a server process. When server process starts, a PGA value is assinged to a single user (if i don't remember wrong, it's default is 5M). The collection of PGA's is defined as total instance PGA. PGA_AGGREGATE_TARGET defines the maximum value which can get.
Regarding to your concept, in my opinion it's basically wrong. Caching happens in buffer_cache which is a component of the SGA. When you first execute your sql text, Oracle caches it to reduce the physical I/O. Afterwards, if you need to execute it again, this will be a logical I/O.
If i got your question wrong, please expend it more for further help. -
Hi
I will have to build process chain to cube 0SD_C03 and the datasources are
2LIS_12_VCITM
2LIS_12_VCHDR
2LIS_12_V_ITM
2LIS_12_VDHDR
2LIS_12_VAITM
2LIS_12_VDITM
2LIS_12_VADHDR
Now the question is after providing the links between " Delete index" process and individual loading process (Infopackages),the message I am getting in the checking view is " Too many parallel processes for chosen server " and furthe,r the suggested procedure by system is " Reduce the number of parallel processes in the chain or include sub-chains :
How can I reduce the processes? Is there any alterante method of building this flow to avoid warning messages..
Though these are warning messages ,what is the correct flow of building process chain for this without getting any warning messages.Hi,
Based on dependency better you can go for 3 parellel process at a time as what we are doing in our project.
check schedule time for each your process chain which fetchs data from source system (Info Package) and re schedule them which should not execute at a time (make it max 3) and try again
Regards
BVR -
Parallel processing in background using Job scheduling...
(Note: Please understand my question completely before redirecting me to parallel processing links in sdn. I hve gone through most of them.)
Hi ABAP Gurus,
I have read a bit till now about parallel processing. But I have a doubt.
I am working on data transfer of around 5 million accounting records from lagacy to R/3 using Batch input recording.
Now if these all records reside in one flat file and if I then process that flat file in my batch input program, I guess it will take days to do it. So my boss suggested
to use parallel processing in SAP.
Now, from the SDN threads, it seems that we have to create a Remote enabled function module for it and stuf....
But I have a different idea. I thought to dividE these 5 million records in 10 flat files instead of just one and then to run the Custom BDC program with 10 instances which will process 10 flat files in background using Job scheduling.
Can this be also called parallel processing ?
Please let me know if this sounds wise to you guys...
Regards,
Tushar.Thanks for your reply...
So what do you suggest how can I use Parallel procesisng for transferring 5 million records which is present in one flat file using custom BDC.?
I am posting my custom BDC code for million record transfer as follows (This code is for creation of material master using BDC.)
report ZMMI_MATERIAL_MASTER_TEST
no standard page heading line-size 255.
include bdcrecx1.
parameters: dataset(132) lower case default
'/tmp/testmatfile.txt'.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record,
data element: MATNR
MATNR_001(018),
data element: MBRSH
MBRSH_002(001),
data element: MTART
MTART_003(004),
data element: XFELD
KZSEL_01_004(001),
data element: MAKTX
MAKTX_005(040),
data element: MEINS
MEINS_006(003),
data element: MATKL
MATKL_007(009),
data element: BISMT
BISMT_008(018),
data element: EXTWG
EXTWG_009(018),
data element: SPART
SPART_010(002),
data element: PRODH_D
PRDHA_011(018),
data element: MTPOS_MARA
MTPOS_MARA_012(004),
end of record.
data: lw_record(200).
End generated data section ***
data: begin of t_data occurs 0,
matnr(18),
mbrsh(1),
mtart(4),
maktx(40),
meins(3),
matkl(9),
bismt(18),
extwg(18),
spart(2),
prdha(18),
MTPOS_MARA(4),
end of t_data.
start-of-selection.
perform open_dataset using dataset.
perform open_group.
do.
*read dataset dataset into record.
read dataset dataset into lw_record.
if sy-subrc eq 0.
clear t_data.
split lw_record
at ','
into t_data-matnr
t_data-mbrsh
t_data-mtart
t_data-maktx
t_data-meins
t_data-matkl
t_data-bismt
t_data-extwg
t_data-spart
t_data-prdha
t_data-MTPOS_MARA.
append t_data.
else.
exit.
endif.
enddo.
loop at t_data.
*if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
t_data-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
t_data-MBRSH.
perform bdc_field using 'RMMG1-MTART'
t_data-MTART.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
t_data-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARA-PRDHA'.
perform bdc_field using 'MARA-MEINS'
t_data-MEINS.
perform bdc_field using 'MARA-MATKL'
t_data-MATKL.
perform bdc_field using 'MARA-BISMT'
t_data-BISMT.
perform bdc_field using 'MARA-EXTWG'
t_data-EXTWG.
perform bdc_field using 'MARA-SPART'
t_data-SPART.
perform bdc_field using 'MARA-PRDHA'
t_data-PRDHA.
perform bdc_field using 'MARA-MTPOS_MARA'
t_data-MTPOS_MARA.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM01'.
endloop.
*enddo.
perform close_group.
perform close_dataset using dataset. -
How to enable an monitor parallel processing in Oracle
Hi All,
I have 2 short questions:
1. When we want parallel processing, we can either use a parallel hint in the query, or alter a table to be parrallel. My question is what is the difference in the following 2 syntax:
a. ALTER TABLE myTable PARALLEL (DEGREE 3);
b. ALTER TABLE myTable PARALLEL 3;
Does the "DEGREE" keywor make any difference? or they both are same statements?
2. When we enable parallel processing, how can we monitor oracle processes, to confirm that a certain table is being actually processed by multiple threads of a singe user process?
An early response would be highly appreciated. Thanks.1)The parallel clause lets you change the default degree of parallelism for queries and DML on the table.
2) PARALLEL DEGREE specifies the number of query server processes that can scan the table in parallel. Either specify a positive integer or DEFAULT which signifies to use the initialization parameter
check further http://mywebsys.com/oracle/syntax/view_syntax.php?id=23
Thanks
Maybe you are looking for
-
Time machine started over after a complete restore, how to get to older?
Yesterday, photoshop and parrallels started crashing and I could not get them working, So I decided to do a complete system restore from install disk time machine from the day before when everything was working fine. so it restored the system to its
-
Help! I've been unable to figure out how to configure an AE to act as a bridge between a Linksys WRTP54G (VOIP) router and a 360 X-Box. The AE bridge is supposed to take the place of an existing/working WEP11 Linksys bridge. The computer linked to th
-
Hey Guys, Can any one tell me how can i Print a SMARTFORM using its Output Type. Should i hav eto do anything with Print Program stuff. Helpful answers will be rewarded. Thanks, Prashanth
-
Finding Webdynpro component in SRM portal page
Hi, I have my SRM 7.0 system setup with users configured with standard roles - Employee, Manager, Operational purchaser, Startegic purchaser. I login to the portal page and do shopping transactions through any of these users. I want to find the webdy
-
Good morning people, Just a quick query. After doing a clean install of Lion, I have it running more or less as I want it to. However, I have (I am assuming) 2 permissons issues with which I was wondering if anyone could help me? My setup is that I h