parallel for_each not parallel?
Germán Diago
germandiago@gmail.com
Mon Nov 3 19:49:00 GMT 2008
I tried to compile this code in parallel mode:
#include <parallel/algorithm>
#include <gtkmm.h>
#include <vector>
#include <tr1/functional>
void computeThumbnails(Glib::RefPtr<Gdk::Pixbuf> image, float ratio)
{
image->scale_simple(image->get_width() * ratio,
image->get_height() * ratio, Gdk::INTERP_BILINEAR);
}
int main(int argc, char * argv[])
{
using namespace std::tr1;
Gtk::Main m(argc, argv);
Glib::Dir directory(argv[1]);
std::vector<Glib::RefPtr<Gdk::Pixbuf> > v;
std::string filename = directory.read_name();
while (filename != "")
{
v.push_back(Gdk::Pixbuf::create_from_file(argv[1] + filename));
filename = directory.read_name();
}
std::for_each(v.begin(), v.end(),
std::tr1::bind(&computeThumbnails,placeholders::_1, 0.3));
return 0;
}
With this command:
g++ `pkg-config gtkmm-2.4 --libs --cflags` -fopenmp -march=i686
-D_GLIBCXX_PARALLEL computafotos.cpp -o computafotos
with no luck. Am I doing anything wrong? Because I looked at the
system monitor and timed it and it's exactly the same as the
sequential version.
More information about the Libstdc++
mailing list