Boost logo

Boost :

Subject: Re: [boost] boost thread slow with only one thread
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-05-20 10:49:05


----- Original Message -----
From: "Natacha Fort" <natachafrt_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, May 20, 2010 12:36 PM
Subject: [boost] boost thread slow with only one thread

>
> hi!
> here is my problem
> i am multithreading my program with boost but i don't get what i expect, and
> i can't understand why!
> i just run one thread and wait for it, and the fps are divide by 3.
> basically with no thread i have 30fps, and with 1 thread i have 10fps. here
> is the code:
>
> Code:
>
> boost::thread_group forces_threads;
> forces_threads.create_thread(boost::bind(&ElasticRods::computeBendingForces,this,edges,kb,edges_initial));
> forces_threads.join_all();
>
> i use thread_group because i want to run 7 thread but it is already too
> slow!
> do you have an idea of why this is so slow?
> thank you for your help!

I suppose that the time spend by your computation not significant to need the creation of a thread on a group and join it.

How much time takes your function computeBendingForces? Can you try without thread_group, directly with thread? Can you try with as many threads as cores do you have on independent calls (free of race conditions) to computeBendingForces?
Can you find a configuration for which computeBendingForces takes much more time?

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk