c++ - What to take into account for selecting a parallelization scheme? -
i'm developing code using c++ research in computational dynamics. code solves sparse , dense matrices, generates meshes, , similar operations in trivial sense. needed parallelize code reduce computational time , used openmp purpose.
but after closer @ commercially available codes, ansys cfx, encountered parallelization scheme used in software mpich2, implementation of mpi.
so have lot of parallelization tools/api's :
- openmp
- mpi
- intel threading building blocks
- pthreads
- microsoft ppl
i used of these tools , managed 100% cpu usage in local computer using each.
i don't know criteria should pay attention while choosing proper parallelization tool. kind of applications require tool? of above ok research purposes? of them used in commerical softwares?
as many question of type there not true definitive answer. can't what's better because answer "it depends". on you're doing, on how code written, portability requirements , on.
following list:
- openmp: pretty standard , found it's really easy use. if original code has not been written parallelization in mind library makes step step approach easy. think it's entry point parallel computing because may make easy it's hard debug, limited in performance , makes code parallel (it lacks of parallel algorithms, structures, primitives , can't span work across network).
- message passing interface: point of view library based on standard best suited span large computation across cluster. if have few computers , want make computation in parallel choice, known , stable. it's not (again in point of view) solution local parallelization. if you're looking well-known, large used standard grid computing mpi you.
- intel threading building blocks: c++ library unify interface multithreading across different environment (pthreads or threading model of windows). if use library maybe need portable across compilers , environments. use library doesn't limit can integrated else (for example mpi). should take library see if like it, it's choice design, documented , used.
- microsoft parallel patterns library: big library. it's quite new not feel secure suggest use without test , it's microsoft specific you're tied compiler. said see it's great library. abstracts lot of details, it's designed , provides high level view of concept of "parallel task". again use library doesn't stop use, example, mpi clusters (but concurrency runtime has own library this).
what use? not have answer, try , pick feel more comfortable (take boost threads too). please note somehow can mix them, example openmp+mpi, mpi+tbb or mpi+pll). preference ppl if you're developing real world application may need long test decide what's better. concurrency runtime (the base of ppl) because it's "horizontal", provides basic framework (with structures , algorithms) parallel computing , lot of "vertical" packages (agents, ppl, tpl).
that said when made computation parallel may need improve performance of cpu intensive routine. may consider use gpu task, think it'll offer best short massive parallel computations (of course prefer opencl on proprietary cuda if cuda performance may higher). may take openhmpp if you're interested on topic.
Comments
Post a Comment