I'm trying to parallelize my application using OpenMP (and C) and wanted to start with the I/O part. Initially the reading and the computational part are sequentials and take around 3 seconds each.
int *mask, width, height
Picture *pic;
pic = readFile("some big file"); // 3 secs
mask = computeMask(width, height); // 3 secs
With OpenMP:
#pragma parallel default(none) shared(pic, mask, width, height)
{
#pragma sections
{
#pragma section
{
pic = readFile("some big file");
}
#pragma section
{
mask = computeMask(width, height);
}
}
}
But now the overall time is around 10 seconds (and is really spent in the I/O task).
Before I'm starting blaming the concurrent access on the RAM to create that bottleneck. I'd love to know if there is something I got wrong here.