user1235711
user1235711

Reputation: 19

openmp vs opencl for computer vision

I am creating a computer vision application that detect objects via a web camera. I am currently focusing on the performance of the application

My problem is in a part of the application that generates the XML cascade file using Haartraining file. This is very slow and takes about 6days . To get around this problem I decided to use multiprocessing, to minimize the total time to generate Haartraining XML file.

I found two solutions: opencl and (openMp and openMPI ) .

Now I'm confused about which one to use. I read that opencl is to use multiple cpu and GPU but on the same machine. Is that so? On the other hand OpenMP is for multi-processing and using openmpi we can use multiple CPUs over the network. But OpenMP has no GPU support.

Can you please suggest the pros and cons of using either of the libraries.

Upvotes: 1

Views: 2250

Answers (3)

nikk
nikk

Reputation: 2867

research opencv and see if it might help.

Upvotes: -3

Pietro
Pietro

Reputation: 13140

Could the performance problem be in the XML file itself?

Have you tried to use a different, lighter file format?

I think that an XML file that takes 6 days to be generated must be quite long and complex. If you have control on this data format, try Google's Protocol Buffers.

Before digging into OpenMP, OpenCL or whatever, check how much time is spent accessing the hard disk; if that is the issue, the parallel libraries won't improve things.

Upvotes: 0

Andrew Tomazos
Andrew Tomazos

Reputation: 68588

OpenCL is for using the GPU stream processors. http://en.wikipedia.org/wiki/Opencl

OpenMP is for using the CPU cores. http://en.wikipedia.org/wiki/Openmp

OpenMPI is for using a distributed network cluster. http://en.wikipedia.org/wiki/Openmpi

Which is best to use depends on your problem specification, but I would try using OpenMP first because it is the easiest to port a single threaded program onto it. Sometimes you can just put a pragma telling it to parellelize a main loop, and you can get speedups in the order of the number of CPU cores.

If your problem is very data parallel and floating pointish - than you can get better performance out of GPU - but you have to write a kernel in a C-like language and map or read/write memory buffers between the host and GPU. Its a hassle, but performance gains in some cases can be on the order of 100 as GPUs are specifically designed for data parallel work.

OpenMPI will get you the most performance but you need a cluster (a bunch of servers on the same network), and they are expensive.

Upvotes: 7

Related Questions