Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How can I use parallel_for to pass two dimensional arrays

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 06-10-2010
Member
 
Join Date: Apr 2010
Posts: 184
How can I use parallel_for to pass two dimensional arrays
  

I tried to utilize parallel_for to velocity up our c++ program. It seems extremely simple to utilize. On the other hand, in the purpose which is to be parallelized, a small number of 2D arrays calculated in the function necessitate be passed to the most important function. In the illustration (sub_string_finder.cpp), one dimensional array is customized in the Sub String Finder by using the addresses of these arrays. Give pleasure to observe the code beneath. I am wondering if I be able to utilize similar trick, additional than not certain how to utilize it on 2D arrays. I originate a method to get around the tribulations. Immediately pass one dimensional arrays and renovate them to two dimensional arrays later.

Reply With Quote
  #2  
Old 06-10-2010
Member
 
Join Date: Apr 2009
Posts: 562
Re: How can I use parallel_for to pass two dimensional arrays

Might anybody demonstrate me how to put into practice two-dimensional matrix multiplication by means of changeable size 2D arrays. The illustration demonstrates in Intel TBB book uses fixed size arrays. Demonstrations of 2D variable-size matrices extremely widely in C++. If you sketch your favorite approach for serial duplication of variable-size matrices, then perhaps an important person be able to position the TBBified version or description.
Reply With Quote
  #3  
Old 06-10-2010
Member
 
Join Date: May 2009
Posts: 517
Re: How can I use parallel_for to pass two dimensional arrays

At this point is the regulations from Intel TBB book that I have comprised and modified to utilize Numerical Recipe C++ matrix class, Mat_SP (matrix solitary precision). The regulations compiles and executes, additional than calculations from serial and parallel section of the code do not match. I imagine the code utilizing NR pass in matrix data ok additional than having tribulations returning matrix data back to the most important program. Your assist is to a great extent appreciated! I imagine the tribulations happens within operator () code (i.e, Mat_SP c = my_c, this generates an innovative copy of matrix c as an alternative of the original matrix c; I encompass no idea how to pass this innovative copy of the matrix c back to the most important program).
Reply With Quote
  #4  
Old 06-10-2010
Member
 
Join Date: May 2009
Posts: 602
Re: How can I use parallel_for to pass two dimensional arrays

I had tested this morning at work, the innovative version or description of my submission utilizing tbbmalloc.dll run twice as fast as my duo core laptop. I accumulated the application utilizing ms visual studio 2005 professional (I deduction their memory distribution routine is not optimal for parallel processing.) By means of auto portioned grain size. Btw even on solitary processor apparatus, TBB essentially speeds up the application.
Reply With Quote
  #5  
Old 06-10-2010
Member
 
Join Date: May 2009
Posts: 523
Re: How can I use parallel_for to pass two dimensional arrays

The 2D matrix multiplication submission was immediately my testing to get acquainted by means of TBB library. The authentic submission I am running on is essentially a 2D SAR (synthetic aperture radar) polar reformat submission that computes 2D interpolations for data matrices as large as 2048x2048, for a moment larger. It has two for loops by means of 2d interpolations completed within inner loop. I am experimenting by means of dissimilar grain size to observe if it would further speed up the processing.
Reply With Quote
  #6  
Old 06-10-2010
vincomgo
 
Posts: n/a
Re: How can I use parallel_for to pass two dimensional arrays

I agree w u Steyn .I dont think that it's good enough.How about the larger size=.=
Reply With Quote
  #7  
Old 07-10-2010
Member
 
Join Date: Apr 2010
Posts: 218
Re: How can I use parallel_for to pass two dimensional arrays

The entire workers accomplish a parfor-loop must have encompassed the similar MATLAB path arrangement as the client, so that they be able to implement several functions called in the body of the loop. Consequently, whenever you utilize cd, addpath, or rmpath on the client, it in addition executes on the entire the workers, if probable. For additional information in sequence, observe the matlabpool reference page. When the workers are working with on a dissimilar platform than the client, utilize the function pctRunOnAll to appropriately set the MATLAB path on the entire workers.
Reply With Quote
  #8  
Old 08-10-2010
Member
 
Join Date: Mar 2010
Posts: 576
Re: How can I use parallel_for to pass two dimensional arrays

If you utilize a name that MATLAB not be able to unmistakably distinguish as a changeable inside a parfor-loop, at parse time MATLAB take for granted you are referencing a function. Then at run-time, if the function not be able to be originate, MATLAB generates an error. (Observe Naming Variables in the MATLAB certification.) For illustration, in the subsequent code f (5) might refer moreover to the fifth component of an array named f, or to a function named f by means of an argument of 5. If f is not obviously defined as a changeable in the code, MATLAB give the impression of being for the function f on the path when the code runs.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How can I use parallel_for to pass two dimensional arrays"
Thread Thread Starter Forum Replies Last Post
Dynamic memory allocation for two-dimensional arrays Ucchal Technology & Internet 1 23-09-2010 06:23 PM
Network Diagram - Configure to show Forward Pass/Backward Pass m3lyssa Microsoft Project 9 30-08-2010 04:57 PM
How to pass scalars and arrays to dialog boxes? Rob Dizzle Software Development 4 16-02-2010 01:00 AM
Two Dimensional Arrays in JavaScript Bettina Software Development 5 15-12-2009 01:01 PM
Sorting Two Dimensional Arrays Diwakar_12 Software Development 2 20-03-2009 01:53 PM


All times are GMT +5.5. The time now is 02:43 AM.