Results 1 to 8 of 8

Thread: How can I use parallel_for to pass two dimensional arrays

  1. #1
    Join Date
    Apr 2010
    Posts
    182

    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.

  2. #2
    Join Date
    Apr 2009
    Posts
    569

    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.

  3. #3
    Join Date
    May 2009
    Posts
    529

    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).

  4. #4
    Join Date
    May 2009
    Posts
    637

    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.

  5. #5
    Join Date
    May 2009
    Posts
    543

    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.

  6. #6
    vincomgo Guest

    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=.=

  7. #7
    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.

  8. #8
    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.

Similar Threads

  1. Dynamic memory allocation for two-dimensional arrays
    By Ucchal in forum Technology & Internet
    Replies: 1
    Last Post: 23-09-2010, 06:23 PM
  2. Replies: 9
    Last Post: 30-08-2010, 04:57 PM
  3. How to pass scalars and arrays to dialog boxes?
    By Rob Dizzle in forum Software Development
    Replies: 4
    Last Post: 16-02-2010, 02:00 AM
  4. Two Dimensional Arrays in JavaScript
    By Bettina in forum Software Development
    Replies: 5
    Last Post: 15-12-2009, 02:01 PM
  5. Sorting Two Dimensional Arrays
    By Diwakar_12 in forum Software Development
    Replies: 2
    Last Post: 20-03-2009, 01:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,462,366.94854 seconds with 17 queries