Gentoo Archives: gentoo-user

From: Florian Philipp <lists@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] openmp flag
Date: Wed, 26 Sep 2012 18:27:50
Message-Id: 5063488C.4060904@binarywings.net
In Reply to: Re: [gentoo-user] openmp flag by Michael Mol
1 Am 25.09.2012 17:01, schrieb Michael Mol:
2 > On Tue, Sep 25, 2012 at 10:42 AM, James <wireless@×××××××××××.com> wrote:
3 >> Hello,
4 >>
5 >> background:
6 >> It seems there is a major push now to put openmp:
7 >> [1,2] into embedded systems [3].
8 >>
9 >> So I looked at these [4] packages to find something
10 >> interesting to look deeper into related to openMP.
11 >>
12 >> Blender immediately jumped out at me as a good example,
13 >> cause an old friend Ken Hughes is, imho, one of the
14 >> world's most amazing C programmers, and a stalwart at
15 >> the blender project.
16 >>
17 >>
18 >> OK, here's the question, I went to emerge blender
19 >> and found that the openmp flag is already set. {?}
20 >> Yet I looked everywhere and did not see the openmp flag
21 >> set (/etc/make.conf, /etc/portage/package.use)
22 >> so where is it getting set on my AMD workstation?
23 >>
24 >> [ebuild N ] media-gfx/blender-2.49b-r2 USE="ffmpeg
25 >> nls ogg openmp -blender-game -openal -verse"
26 >>
27 >> I feel like I should know (profiles etc) but, I'm a little
28 >> bit brain_dead this am, so any help is appreciated.
29 >
30 > Packages can choose to have USE flags enabled or disabled for them by
31 > default. So blender likely has openmp enabled by default, without that
32 > affecting any other packages.
33 >
34 >>
35 >> OH, anyone is encouraged to "chime in" about openmp
36 >> and your thoughts as to it's viability and usefulness.
37 >> Do you believe it will become a core technology,
38 >> embedded into GCC? Used widely?
39 >
40 > If you can use it, use it. OpenMP is little more than a set of
41 > extensions to C (and C++) which allows the normally-scalar language to
42 > do some things in a parallel fashion without resorting to the costs of
43 > multithreading. This is good, because vector instructions have been
44 > available in x86 since MMX came out, and improvements to the vector
45 > instructions available to x86 still goes on.
46 >
47
48 I guess this is just poorly phrased but to clarify: OpenMP *does* use
49 multithreading and nothing else. It does not, in any way, make more use
50 of vector instructions than GCC without -fopenmp. I guess what you mean
51 is avoiding the costs of *manual* multithreading using POSIX threads and
52 the like.
53
54 If you want to use vector instructions for your own code, you should
55 look into compiler intrinsics (i.e. vector instructions as built-in C
56 functions).
57 http://ds9a.nl/gcc-simd/
58
59 And, just to nit-pick: OpenMP also works for Fortran.
60
61 > Related are CUDA and OpenCL, which are two other systems for
62 > parallelizing code. CUDA assumes you have access to an nVidia GPU (and
63 > have a CUDA-enabled driver installed). OpenCL is a big more generic,
64 > and supports dispatching to CUDA, CPU vector instructions or even
65 > thread pools.
66 >
67 > Personally, my recommendation is to enable everything you can get
68 > working (be it, OpenMP, CUDA or OpenCL); vector processing is going to
69 > be generally more efficient than scalar processing. You don't need to
70 > worry about which is better unless you're a software developer. (And
71 > if you're a software developer, go study up on their differences;
72 > tradeoffs happen.)
73 >
74
75 +1
76
77 By the way: Did anyone get good results out of dev-util/intel-ocl-sdk
78 for OpenCL? Some time ago I tested it with a package that supported both
79 OpenMP and OpenCL (not sure which) and OpenCL didn't really make an
80 impact on my Core i5.
81
82 Regards,
83 Florian Philipp

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] openmp flag Michael Mol <mikemol@×××××.com>
Re: [gentoo-user] openmp flag Peter Weilbacher <newsspam@××××××××××.org>