Anyone try MS VS2010 C++ parallel pattern libray to do SMP ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

edwardyu
Posts: 34
Joined: Mon Nov 17, 2008 6:58 am

Anyone try MS VS2010 C++ parallel pattern libray to do SMP ?

Post by edwardyu »

I found that the MS VS2010 C++ parallel pattern library is supported in 2010 C++ Express also. However, the overhead is very big, making SMP program run slower than single serial one. I try parallel_for for those nodes in Search_nonpv. Anyone try?
User avatar
Onno Garms
Posts: 224
Joined: Mon Mar 12, 2007 7:31 pm
Location: Bonn, Germany

Re: Anyone try MS VS2010 C++ parallel pattern libray to do S

Post by Onno Garms »

edwardyu wrote:Anyone try?
No. But before I started to parallelize Onno, I evaluated different frameworks (also because I need to know different techniques for my job). I considered OpenMP, Intel TBB, MPI, pthreads on Linux + Windows native, pthreads on Linux + pthreads for Windows.

I think the parallel pattern library is meant as a competetor to Intel TBB?

After all I found that pthreads on Linux + Windows native is probably the best solution. OpenMP and Intel TBB are designed to take the effort to control the parallelization away from the user, but for chess we want as much control as possible.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Anyone try MS VS2010 C++ parallel pattern libray to do S

Post by sje »

Any generalized thread package will be slower than a low level approach like Posix pthreads. This includes Apple's Grand Central which is essentially a package of wrappers and some OS/X specific support.

What is gained in portability is lost in speed. No surprise there.

I use a subset of pthreads which is supported in both Mac OS/X and Ubuntu Linux. This works for me as I don't care about ever running my code under Windows. For those who do code for Windows, I'd suggest using conditional compilation that selects either pthreads or Windows thread routines.

All of my code using C++ has the class header files be entirely platform independent with any platform specific code placed in the implementation sources. The idea is to prevent uncontrolled creeping dependencies.
User avatar
Onno Garms
Posts: 224
Joined: Mon Mar 12, 2007 7:31 pm
Location: Bonn, Germany

Re: Anyone try MS VS2010 C++ parallel pattern libray to do S

Post by Onno Garms »

sje wrote:Any generalized thread package will be slower than a low level approach like Posix pthreads. This includes Apple's Grand Central which is essentially a package of wrappers and some OS/X specific support.

What is gained in portability is lost in speed. No surprise there.
ACK
I use a subset of pthreads which is supported in both Mac OS/X and Ubuntu Linux.
Same with me. I use a subset of pthreads and a subset of Windows native.

Implementing pthreads on Windows native is possible but this would been a huge overkill, make me depend on the pthreads for Windows package by a third party. Determining sufficiently large equivalent subsets of pthreads and Windows native was not a big deal.
All of my code using C++ has the class header files be entirely platform independent with any platform specific code placed in the implementation sources. The idea is to prevent uncontrolled creeping dependencies.
Same with my code.