Lisandro Dalcin | 9 Mar 2012 14:22
Picon
Gravatar

[Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

I'm basically experiencing the issues here:
http://www.cocoabuilder.com/archive/xcode/310299-error-calling-builtin-expect-inside-omp-parallel-for.html

Can you imagine any way to workaround it?

PS: This is the only serious failure I get on OS X Lion. The embed
test is not working, but it is a Makefile issue.

--

-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
Lisandro Dalcin | 9 Mar 2012 14:40
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 9 March 2012 16:22, Lisandro Dalcin <dalcinl@...> wrote:
>
> PS: This is the only serious failure I get on OS X Lion. The embed
> test is not working, but it is a Makefile issue.
>

UPDATE: The embed test do work with system Python 2.7. The failure is
with EPD Python 7.2, it is caused by a bad definition of LINKFORSHARED
in its installed config/Makefile.

--

-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
mark florisson | 10 Mar 2012 01:41
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 9 March 2012 14:22, Lisandro Dalcin <dalcinl@...> wrote:
> I'm basically experiencing the issues here:
> http://www.cocoabuilder.com/archive/xcode/310299-error-calling-builtin-expect-inside-omp-parallel-for.html
>
> Can you imagine any way to workaround it?

What a lovely C compiler bug... Did you file a bug report with gcc or
xcode? What version of gcc does Lion ship with?

I suppose the macro would have to be disabled for OS X Lion inside
parallel sections (there seems to be __APPLE__ and __OSX__, I don't
know about detecting the OS X version), that's easy to do (undef and
redefine to no-ops before parallel section and redefine it again after
the section). I'll try fixing it during the sprints next week.

> PS: This is the only serious failure I get on OS X Lion. The embed
> test is not working, but it is a Makefile issue.
>
> --
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> 3000 Santa Fe, Argentina
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169
> _______________________________________________
> cython-devel mailing list
> cython-devel@...
(Continue reading)

Lisandro Dalcin | 10 Mar 2012 10:51
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 10 March 2012 03:41, mark florisson <markflorisson88@...> wrote:
> On 9 March 2012 14:22, Lisandro Dalcin <dalcinl@...> wrote:
>> I'm basically experiencing the issues here:
>> http://www.cocoabuilder.com/archive/xcode/310299-error-calling-builtin-expect-inside-omp-parallel-for.html
>>
>> Can you imagine any way to workaround it?
>
> What a lovely C compiler bug... Did you file a bug report with gcc or
> xcode? What version of gcc does Lion ship with?
>

I'm using a Mac just by accident, no idea (nor motivation) to report
bugs to Apple.

$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc.
build 5658) (LLVM build 2336.9.00)

Could that be the the bug is actually in the LLVM backend?

> I suppose the macro would have to be disabled for OS X Lion inside
> parallel sections (there seems to be __APPLE__ and __OSX__, I don't
> know about detecting the OS X version), that's easy to do (undef and
> redefine to no-ops before parallel section and redefine it again after
> the section). I'll try fixing it during the sprints next week.
>

Perhaps switching to use a "omp_likely"/"omp_unlikely" macros inside
OpenMP blocks would be nicer than defining/undefining?

(Continue reading)

Stefan Behnel | 10 Mar 2012 14:00
Picon
Favicon

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

Lisandro Dalcin, 10.03.2012 10:51:
> On 10 March 2012 03:41, mark florisson wrote:
>> On 9 March 2012 14:22, Lisandro Dalcin wrote:
>>> I'm basically experiencing the issues here:
>>> http://www.cocoabuilder.com/archive/xcode/310299-error-calling-builtin-expect-inside-omp-parallel-for.html
>>>
>>> Can you imagine any way to workaround it?
>>
>> What a lovely C compiler bug... Did you file a bug report with gcc or
>> xcode? What version of gcc does Lion ship with?
>>
> 
> I'm using a Mac just by accident, no idea (nor motivation) to report
> bugs to Apple.
> 
> $ gcc --version
> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc.
> build 5658) (LLVM build 2336.9.00)
> 
> Could that be the the bug is actually in the LLVM backend?
> 
>> I suppose the macro would have to be disabled for OS X Lion inside
>> parallel sections (there seems to be __APPLE__ and __OSX__, I don't
>> know about detecting the OS X version), that's easy to do (undef and
>> redefine to no-ops before parallel section and redefine it again after
>> the section). I'll try fixing it during the sprints next week.
> 
> Perhaps switching to use a "omp_likely"/"omp_unlikely" macros inside
> OpenMP blocks would be nicer than defining/undefining?

(Continue reading)

mark florisson | 11 Mar 2012 07:46
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 10 March 2012 14:00, Stefan Behnel <stefan_ml@...> wrote:
> Lisandro Dalcin, 10.03.2012 10:51:
>> On 10 March 2012 03:41, mark florisson wrote:
>>> On 9 March 2012 14:22, Lisandro Dalcin wrote:
>>>> I'm basically experiencing the issues here:
>>>> http://www.cocoabuilder.com/archive/xcode/310299-error-calling-builtin-expect-inside-omp-parallel-for.html
>>>>
>>>> Can you imagine any way to workaround it?
>>>
>>> What a lovely C compiler bug... Did you file a bug report with gcc or
>>> xcode? What version of gcc does Lion ship with?
>>>
>>
>> I'm using a Mac just by accident, no idea (nor motivation) to report
>> bugs to Apple.
>>
>> $ gcc --version
>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc.
>> build 5658) (LLVM build 2336.9.00)
>>
>> Could that be the the bug is actually in the LLVM backend?
>>
>>> I suppose the macro would have to be disabled for OS X Lion inside
>>> parallel sections (there seems to be __APPLE__ and __OSX__, I don't
>>> know about detecting the OS X version), that's easy to do (undef and
>>> redefine to no-ops before parallel section and redefine it again after
>>> the section). I'll try fixing it during the sprints next week.
>>
>> Perhaps switching to use a "omp_likely"/"omp_unlikely" macros inside
>> OpenMP blocks would be nicer than defining/undefining?
(Continue reading)

Lisandro Dalcin | 11 Mar 2012 09:26
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 11 March 2012 09:46, mark florisson <markflorisson88@...> wrote:
> On 10 March 2012 14:00, Stefan Behnel <stefan_ml@...> wrote:
>> Lisandro Dalcin, 10.03.2012 10:51:
>>> On 10 March 2012 03:41, mark florisson wrote:
>>>> On 9 March 2012 14:22, Lisandro Dalcin wrote:
>>>>> I'm basically experiencing the issues here:
>>>>> http://www.cocoabuilder.com/archive/xcode/310299-error-calling-builtin-expect-inside-omp-parallel-for.html
>>>>>
>>>>> Can you imagine any way to workaround it?
>>>>
>>>> What a lovely C compiler bug... Did you file a bug report with gcc or
>>>> xcode? What version of gcc does Lion ship with?
>>>>
>>>
>>> I'm using a Mac just by accident, no idea (nor motivation) to report
>>> bugs to Apple.
>>>
>>> $ gcc --version
>>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc.
>>> build 5658) (LLVM build 2336.9.00)
>>>
>>> Could that be the the bug is actually in the LLVM backend?
>>>
>>>> I suppose the macro would have to be disabled for OS X Lion inside
>>>> parallel sections (there seems to be __APPLE__ and __OSX__, I don't
>>>> know about detecting the OS X version), that's easy to do (undef and
>>>> redefine to no-ops before parallel section and redefine it again after
>>>> the section). I'll try fixing it during the sprints next week.
>>>
>>> Perhaps switching to use a "omp_likely"/"omp_unlikely" macros inside
(Continue reading)

Stefan Behnel | 11 Mar 2012 09:35
Picon
Favicon

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

Lisandro Dalcin, 11.03.2012 09:26:
> On 11 March 2012 09:46, mark florisson wrote:
>> On 10 March 2012 14:00, Stefan Behnel wrote:
>>> Lisandro Dalcin, 10.03.2012 10:51:
>>>> Perhaps switching to use a "omp_likely"/"omp_unlikely" macros inside
>>>> OpenMP blocks would be nicer than defining/undefining?
>>>
>>> Could that be coded into the macro or would it require to change the
>>> generated code? But at least it sounds like it would not impact code in
>>> functions that are being called from within the OpenMP blocks, would it?
>>> Just the code straight inside the block. A work-around could still have a
>>> substantial impact if it requires changes to the generated code.
>>
>> Yeah, that's why I suggested the undef/re-def approach around OpenMP
>> blocks. It's some code bloat, but only for the C preprocessor, so it
>> should be fine.
> 
> I still feel bad about this. What about just disabling branch
> prediction if OpenMP is ever used? Or perhaps just protect the
> definitions of likely/unlikely with some guard, such as users can
> disable them using a -D definition?

There's a Cython compiler switch for it already. The problem is that it's
not used everywhere where branch prediction hints are being generated.

Would be worth fixing IMHO. There's already an unlikely() method in the
code generator, a likely() method should be added and both should be used
appropriately. That would allow us to a) switch the hints on and off
properly in the compiler and b) generate different code for the hints based
on the code environment.
(Continue reading)

mark florisson | 11 Mar 2012 17:09
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 11 March 2012 09:26, Lisandro Dalcin <dalcinl@...> wrote:
> On 11 March 2012 09:46, mark florisson <markflorisson88@...> wrote:
>> On 10 March 2012 14:00, Stefan Behnel <stefan_ml@...> wrote:
>>> Lisandro Dalcin, 10.03.2012 10:51:
>>>> On 10 March 2012 03:41, mark florisson wrote:
>>>>> On 9 March 2012 14:22, Lisandro Dalcin wrote:
>>>>>> I'm basically experiencing the issues here:
>>>>>> http://www.cocoabuilder.com/archive/xcode/310299-error-calling-builtin-expect-inside-omp-parallel-for.html
>>>>>>
>>>>>> Can you imagine any way to workaround it?
>>>>>
>>>>> What a lovely C compiler bug... Did you file a bug report with gcc or
>>>>> xcode? What version of gcc does Lion ship with?
>>>>>
>>>>
>>>> I'm using a Mac just by accident, no idea (nor motivation) to report
>>>> bugs to Apple.
>>>>
>>>> $ gcc --version
>>>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc.
>>>> build 5658) (LLVM build 2336.9.00)
>>>>
>>>> Could that be the the bug is actually in the LLVM backend?
>>>>
>>>>> I suppose the macro would have to be disabled for OS X Lion inside
>>>>> parallel sections (there seems to be __APPLE__ and __OSX__, I don't
>>>>> know about detecting the OS X version), that's easy to do (undef and
>>>>> redefine to no-ops before parallel section and redefine it again after
>>>>> the section). I'll try fixing it during the sprints next week.
>>>>
(Continue reading)

Robert Bradshaw | 21 Mar 2012 02:30
Picon

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On Sun, Mar 11, 2012 at 9:09 AM, mark florisson
<markflorisson88@...> wrote:
> On 11 March 2012 09:26, Lisandro Dalcin <dalcinl@...> wrote:
>> On 11 March 2012 09:46, mark florisson
<markflorisson88@...> wrote:
>>> On 10 March 2012 14:00, Stefan Behnel <stefan_ml@...> wrote:
>>>> Lisandro Dalcin, 10.03.2012 10:51:
>>>>> On 10 March 2012 03:41, mark florisson wrote:
>>>>>> On 9 March 2012 14:22, Lisandro Dalcin wrote:
>>>>>>> I'm basically experiencing the issues here:
>>>>>>> http://www.cocoabuilder.com/archive/xcode/310299-error-calling-builtin-expect-inside-omp-parallel-for.html
>>>>>>>
>>>>>>> Can you imagine any way to workaround it?
>>>>>>
>>>>>> What a lovely C compiler bug... Did you file a bug report with gcc or
>>>>>> xcode? What version of gcc does Lion ship with?
>>>>>>
>>>>>
>>>>> I'm using a Mac just by accident, no idea (nor motivation) to report
>>>>> bugs to Apple.
>>>>>
>>>>> $ gcc --version
>>>>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc.
>>>>> build 5658) (LLVM build 2336.9.00)
>>>>>
>>>>> Could that be the the bug is actually in the LLVM backend?
>>>>>
>>>>>> I suppose the macro would have to be disabled for OS X Lion inside
>>>>>> parallel sections (there seems to be __APPLE__ and __OSX__, I don't
>>>>>> know about detecting the OS X version), that's easy to do (undef and
(Continue reading)

mark florisson | 14 Mar 2012 06:58
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 9 March 2012 14:22, Lisandro Dalcin <dalcinl@...> wrote:
> I'm basically experiencing the issues here:
> http://www.cocoabuilder.com/archive/xcode/310299-error-calling-builtin-expect-inside-omp-parallel-for.html
>
> Can you imagine any way to workaround it?
>
> PS: This is the only serious failure I get on OS X Lion. The embed
> test is not working, but it is a Makefile issue.

Could you give this fix a try?
https://github.com/markflorisson88/cython/commit/2bffde15edc66c7416716051959e3b0cf1d6b41b

> --
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> 3000 Santa Fe, Argentina
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169
> _______________________________________________
> cython-devel mailing list
> cython-devel@...
> http://mail.python.org/mailman/listinfo/cython-devel
Lisandro Dalcin | 15 Mar 2012 13:21
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 14 March 2012 08:58, mark florisson <markflorisson88@...> wrote:
> On 9 March 2012 14:22, Lisandro Dalcin <dalcinl@...> wrote:
>
> Could you give this fix a try?
> https://github.com/markflorisson88/cython/commit/2bffde15edc66c7416716051959e3b0cf1d6b41b
>

I'm still getting the linking error. Your fix does not resolve the issue :-(

--

-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
mark florisson | 16 Mar 2012 04:00
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 15 March 2012 13:21, Lisandro Dalcin <dalcinl@...> wrote:
> On 14 March 2012 08:58, mark florisson <markflorisson88@...> wrote:
>> On 9 March 2012 14:22, Lisandro Dalcin <dalcinl@...> wrote:
>>
>> Could you give this fix a try?
>> https://github.com/markflorisson88/cython/commit/2bffde15edc66c7416716051959e3b0cf1d6b41b
>>
>
> I'm still getting the linking error. Your fix does not resolve the issue :-(
>

Hm, what does this give you?

$ cpp
#if defined(__APPLE__) || defined(__OSX__)
    FOO
#endif
^D

> --
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> 3000 Santa Fe, Argentina
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169
> _______________________________________________
> cython-devel mailing list
(Continue reading)

mark florisson | 16 Mar 2012 04:02
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

On 16 March 2012 04:00, mark florisson <markflorisson88 <at> gmail.com> wrote:
> On 15 March 2012 13:21, Lisandro Dalcin <dalcinl <at> gmail.com> wrote:
>> On 14 March 2012 08:58, mark florisson <markflorisson88 <at> gmail.com> wrote:
>>> On 9 March 2012 14:22, Lisandro Dalcin <dalcinl <at> gmail.com> wrote:
>>>
>>> Could you give this fix a try?
>>> https://github.com/markflorisson88/cython/commit/2bffde15edc66c7416716051959e3b0cf1d6b41b
>>>
>>
>> I'm still getting the linking error. Your fix does not resolve the issue :-(
>>
>
> Hm, what does this give you?
>
> $ cpp
> #if defined(__APPLE__) || defined(__OSX__)
>    FOO
> #endif
> ^D

Ah, maybe I should pull it out of nested prange constructs.

>> --
>> Lisandro Dalcin
>> ---------------
>> CIMEC (INTEC/CONICET-UNL)
>> Predio CONICET-Santa Fe
>> Colectora RN 168 Km 472, Paraje El Pozo
>> 3000 Santa Fe, Argentina
>> Tel: +54-342-4511594 (ext 1011)
(Continue reading)

Stefan Behnel | 21 Mar 2012 08:16
Picon
Favicon

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

mark florisson, 16.03.2012 04:00:
> $ cpp
> #if defined(__APPLE__) || defined(__OSX__)
>     FOO
> #endif
> ^D

Ah, hackers. Isn't that just lovely?

Stefan
mark florisson | 21 Mar 2012 14:31
Picon
Gravatar

Re: [Cython] OS X 10.7 Lion: GCC __builtin_expect unrecognized inside OpenMP blocks

Could you try the new fix from my branch? If it doesn't do the trick
then I will need to know whether the macros are passing the
preprocessor.

On 15 March 2012 13:21, Lisandro Dalcin <dalcinl@...> wrote:
> On 14 March 2012 08:58, mark florisson <markflorisson88@...> wrote:
>> On 9 March 2012 14:22, Lisandro Dalcin <dalcinl@...> wrote:
>>
>> Could you give this fix a try?
>> https://github.com/markflorisson88/cython/commit/2bffde15edc66c7416716051959e3b0cf1d6b41b
>>
>
> I'm still getting the linking error. Your fix does not resolve the issue :-(
>
>
> --
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> 3000 Santa Fe, Argentina
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169
> _______________________________________________
> cython-devel mailing list
> cython-devel@...
> http://mail.python.org/mailman/listinfo/cython-devel

Gmane