- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am new to TBB and I am trying to build a monte carlo program that will run N simulations independent of each other and use the results of that N simulations in order to carry on working.
I am not sure whether to use parallel_for, parallel_reduce or parallel_do or some other function. Can anyone please advise?
Thanks in advance,
Julien Martin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, learning C++ by writing a parallel program will certainly give you a challenge. Threading Building Blocks uses C++ very deeply.
Can you describe the inputs for your N simulations in the form of an indexed array? You might start looking at the TBB parallel for to divide that list of simulations among the available threads, letting each take on as much work as they can accomplish. Since the simulations are completely independent of each other, there should be no interference between the threads. If some of the simulations take longer than others, the natural load balancing provided by task stealing within TBB should allow the workers to help each other finish the set.
You might try focusing on these ideas and let them guide your reading of the documentation.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I already had a look at the documentation. What I need to start with is basic guidance as to what to look for in the documentation bearing in mind the need I have.
I am completely new to TBB and rather novice in C++...
Thanks,
J.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, learning C++ by writing a parallel program will certainly give you a challenge. Threading Building Blocks uses C++ very deeply.
Can you describe the inputs for your N simulations in the form of an indexed array? You might start looking at the TBB parallel for to divide that list of simulations among the available threads, letting each take on as much work as they can accomplish. Since the simulations are completely independent of each other, there should be no interference between the threads. If some of the simulations take longer than others, the natural load balancing provided by task stealing within TBB should allow the workers to help each other finish the set.
You might try focusing on these ideas and let them guide your reading of the documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This API/library looks new and exciting to me.
Can anyone please tell me what these mean in c++ (see //HERE and //HERE below).
I cannot seem to be able to figure out what the ":my_a(a){}" mean and it gives me a compilation error...
Any help?
Julien.
#include "tbb/tbb.h"
using namespace tbb;
class ApplyFoo {
float *const my_a;
public:
void operator()( const blocked_range
float *a = my_a;
for( size_t i=r.begin(); i!=r.end(); ++i )
Foo(a);
}
ApplyFoo( float a[] ) : //HERE
my_a(a) //HERE
{}
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
J.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page