Moderators: Moderators, OGRE Team




CaseyB wrote:@Chris Jones:
You are using Boost to do the threading. I was just wondering what led to that decision?
It seems that Boost Threads has implemented only the basic needs of multithreaded program.
And OpenMP doens't support functional multi-tasking, is there another library that anyone would suggest looking into?
That is exactly what I want to do! For some reason using the two together never came to me! I'll give that a shot! Thanks!steven wrote:OpenMP is completely different. It "parallelise" a sequential code.
You could use boost::thread AND OpenMP to parallelise different aspect of your engine.
For example, in oge we use boost to put each main manager in a different thread. But we could later use OpenMP to subdivide the task of a manager to profit of cores that a not used - that is > 6 cores/cpus.



Multi-Core technology is new enough that everyone is pretty new to it all.Zeal wrote:Again, im thinking about all this in very basic noob calibur terms.
#include <boost/thread/thread.hpp>
#include <iostream>
int count = 0;
boost::mutex mutex;
void increment_count()
{
boost::mutex::scoped_lock lock(mutex);
std::cout << "count = " << ++count << std::endl;
}
int main(int argc, char* argv[])
{
boost::thread_group threads;
for (int i = 0; i < 10; ++i)
threads.create_thread(&increment_count);
threads.join_all();
}#include <omp.h>
main ()
{
int i, count;
#pragma omp parallel shared(count) private(i)
{
#pragma omp for schedule(dynamic)
for (i=0; i < 10; i++)
{
std::cout << "count = " << ++count << std::endl;
}
} /* end of parallel section */
}
With boost, yes, with OpenMP it's smart enough to only allocate threads that you have the cores to support.Zeal wrote:Although I guess there is nothing stopping me from running tests on a single core.. it would just be slower than running a single thread ill bet :p

CaseyB wrote:Multi-Core technology is new enough that everyone is pretty new to it all.Zeal wrote:Again, im thinking about all this in very basic noob calibur terms.
while (1) fork();I am looking through the OGE code and the mutexes and scope_locks are pretty straight forward, and I see the run methods, but I am having trouble finding where you fork off the new threads
CaseyB wrote:I am looking through the OGE code and the mutexes and scope_locks are pretty straight forward, and I see the run methods, but I am having trouble finding where you fork off the new threads.
Game_Ender wrote:OpenMP does not support task level parallelism, so it is limited in what it can do for you.
#pragma omp parallel sections num_threads(3)
{
#pragma omp section
{
// task 1 code here
}
#pragma omp section
{
// task 2 code here
}
#pragma omp section
{
// task 3 code here
}
}

Users browsing this forum: MSN [Bot] and 0 guests