1 |
Am 26.09.2012 21:46, schrieb Michael Mol: |
2 |
> On Wed, Sep 26, 2012 at 2:25 PM, Florian Philipp <lists@×××××××××××.net> wrote: |
3 |
>> Am 25.09.2012 17:01, schrieb Michael Mol: |
4 |
>>> On Tue, Sep 25, 2012 at 10:42 AM, James <wireless@×××××××××××.com> wrote: |
5 |
>>>> Hello, |
6 |
>>>> |
7 |
>>>> background: |
8 |
>>>> It seems there is a major push now to put openmp: |
9 |
>>>> [1,2] into embedded systems [3]. |
10 |
>>>> |
11 |
>>>> So I looked at these [4] packages to find something |
12 |
>>>> interesting to look deeper into related to openMP. |
13 |
>>>> |
14 |
>>>> Blender immediately jumped out at me as a good example, |
15 |
>>>> cause an old friend Ken Hughes is, imho, one of the |
16 |
>>>> world's most amazing C programmers, and a stalwart at |
17 |
>>>> the blender project. |
18 |
>>>> |
19 |
>>>> |
20 |
>>>> OK, here's the question, I went to emerge blender |
21 |
>>>> and found that the openmp flag is already set. {?} |
22 |
>>>> Yet I looked everywhere and did not see the openmp flag |
23 |
>>>> set (/etc/make.conf, /etc/portage/package.use) |
24 |
>>>> so where is it getting set on my AMD workstation? |
25 |
>>>> |
26 |
>>>> [ebuild N ] media-gfx/blender-2.49b-r2 USE="ffmpeg |
27 |
>>>> nls ogg openmp -blender-game -openal -verse" |
28 |
>>>> |
29 |
>>>> I feel like I should know (profiles etc) but, I'm a little |
30 |
>>>> bit brain_dead this am, so any help is appreciated. |
31 |
>>> |
32 |
>>> Packages can choose to have USE flags enabled or disabled for them by |
33 |
>>> default. So blender likely has openmp enabled by default, without that |
34 |
>>> affecting any other packages. |
35 |
>>> |
36 |
>>>> |
37 |
>>>> OH, anyone is encouraged to "chime in" about openmp |
38 |
>>>> and your thoughts as to it's viability and usefulness. |
39 |
>>>> Do you believe it will become a core technology, |
40 |
>>>> embedded into GCC? Used widely? |
41 |
>>> |
42 |
>>> If you can use it, use it. OpenMP is little more than a set of |
43 |
>>> extensions to C (and C++) which allows the normally-scalar language to |
44 |
>>> do some things in a parallel fashion without resorting to the costs of |
45 |
>>> multithreading. This is good, because vector instructions have been |
46 |
>>> available in x86 since MMX came out, and improvements to the vector |
47 |
>>> instructions available to x86 still goes on. |
48 |
>>> |
49 |
>> |
50 |
>> I guess this is just poorly phrased but to clarify: OpenMP *does* use |
51 |
>> multithreading and nothing else. It does not, in any way, make more use |
52 |
>> of vector instructions than GCC without -fopenmp. I guess what you mean |
53 |
>> is avoiding the costs of *manual* multithreading using POSIX threads and |
54 |
>> the like. |
55 |
> |
56 |
> Fair point. |
57 |
> |
58 |
>> |
59 |
>> If you want to use vector instructions for your own code, you should |
60 |
>> look into compiler intrinsics (i.e. vector instructions as built-in C |
61 |
>> functions). |
62 |
>> http://ds9a.nl/gcc-simd/ |
63 |
> |
64 |
> Personally, I don't like compiler intrinsics; they're specific to |
65 |
> given compilers. I've tended to write code which is supposed to |
66 |
> compile on multiple compilers. (There's a world outside GCC...) |
67 |
> |
68 |
|
69 |
Yes. I haven't used it, either. I guess you could autoconf it and |
70 |
replace it with vanilla C macros in most cases. Or as an easier |
71 |
solution: #ifdef a vanilla C implementation together with the vector |
72 |
code. Bonus points for added readability. |
73 |
|
74 |
Kind of makes you wonder how well GCC can vectorize programs on its own |
75 |
when you lay out your code in a way suitable for its own intrinsics |
76 |
without actually using them. |
77 |
|
78 |
>> And, just to nit-pick: OpenMP also works for Fortran. |
79 |
> |
80 |
> True; this slipped my mind. :) |
81 |
> |
82 |
>> |
83 |
>>> Related are CUDA and OpenCL, which are two other systems for |
84 |
>>> parallelizing code. CUDA assumes you have access to an nVidia GPU (and |
85 |
>>> have a CUDA-enabled driver installed). OpenCL is a big more generic, |
86 |
>>> and supports dispatching to CUDA, CPU vector instructions or even |
87 |
>>> thread pools. |
88 |
>>> |
89 |
>>> Personally, my recommendation is to enable everything you can get |
90 |
>>> working (be it, OpenMP, CUDA or OpenCL); vector processing is going to |
91 |
>>> be generally more efficient than scalar processing. You don't need to |
92 |
>>> worry about which is better unless you're a software developer. (And |
93 |
>>> if you're a software developer, go study up on their differences; |
94 |
>>> tradeoffs happen.) |
95 |
>>> |
96 |
>> |
97 |
>> +1 |
98 |
>> |
99 |
>> By the way: Did anyone get good results out of dev-util/intel-ocl-sdk |
100 |
>> for OpenCL? Some time ago I tested it with a package that supported both |
101 |
>> OpenMP and OpenCL (not sure which) and OpenCL didn't really make an |
102 |
>> impact on my Core i5. |
103 |
> |
104 |
> Haven't tried it, no. I've got a Radeon 6870, and I can only have one |
105 |
> OpenCL driver loaded at a time. (IBM has a middleman driver which |
106 |
> supports dispatching to multiple backends, but I believe its a for-pay |
107 |
> package.) |
108 |
> |
109 |
|
110 |
Isn't that what app-admin/eselect-opencl is for? I mean simple |
111 |
switching, not dual application (which would be awesome, too). |
112 |
|
113 |
Regards, |
114 |
Florian Philipp |