[petsc-dev] adding -fopenmp three times
Barry Smith
bsmith at mcs.anl.gov
Tue Nov 12 19:21:03 CST 2013
Test it and if it works on Apple it is probably ok. I don’t remember why I needed to add it but presumably otherwise it didn’t work :-)
On Nov 12, 2013, at 7:16 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> Matthew Knepley <knepley at gmail.com> writes:
>
>> I am a little worried. I think Satish put this in there because something
>> failed. This is a big
>> problem with configure. We really need to reference a certain test (even if
>> we cannot
>> replicate it) when these changes go in.
>>
>> The central problem is that there is no internal logic to this. It is just
>> a set of jumbled facts
>> and scenarios. And we cannot fix it, we just deal. This is also the web
>> browser problem.
>
> This is why configure is difficult, though I think a lot of the kludgy
> code that goes into BuildSystem comes from not understanding the precise
> semantics of the framework.
>
> Barry, do you know what was the rationale for adding the addLinkerFlag
> here?
>
> https://bitbucket.org/petsc/petsc/commits/504565928e62d2a531f1584c908a5465d42e9a14
>
> As Matt says (but is easily forgotten), compiler flags are passed to the
> linker unless they are excluded.
>
>
> The issue here is that with the code in the repository now, -fopenmp
> gets passed three times on the command line. It would be less cluttered
> to pass it just once, which the diff below achieves.
>
>>
>> Matt
>>
>>
>> On Tue, Nov 12, 2013 at 6:31 PM, Jed Brown <jed at jedbrown.org> wrote:
>>
>>> Matthew Knepley <knepley at gmail.com> writes:
>>>
>>>> On Tue, Nov 12, 2013 at 5:36 PM, Jed Brown <jed at jedbrown.org> wrote:
>>>>
>>>>> How do we make fopenmp only appear once?
>>>>>
>>>>
>>>> I can already explain two of these I think. The compiler gets -openmp,
>>> but
>>>> so does the linker,
>>>> and so the link gets both (by our convention that the linker gets any
>>>> compiler flag no explicitly
>>>> excluded)
>>>
>>> Okay to make the change below? (With this patch, the flag appears only
>>> once.)
>>>
>>> diff --git i/config/PETSc/packages/openmp.py
>>> w/config/PETSc/packages/openmp.py
>>> index c788d8a..e93217f 100644
>>> --- i/config/PETSc/packages/openmp.py
>>> +++ w/config/PETSc/packages/openmp.py
>>> @@ -39,8 +39,6 @@ class Configure(PETSc.package.NewPackage):
>>> ompflag = flag
>>> break
>>> self.setCompilers.addCompilerFlag(ompflag)
>>> - if self.setCompilers.checkLinkerFlag(ompflag):
>>> - self.setCompilers.addLinkerFlag(ompflag)
>>> self.setCompilers.popLanguage()
>>> if hasattr(self.compilers, 'FC'):
>>> self.setCompilers.pushLanguage('FC')
>>> @@ -49,8 +47,6 @@ class Configure(PETSc.package.NewPackage):
>>> if hasattr(self.compilers, 'CXX'):
>>> self.setCompilers.pushLanguage('Cxx')
>>> self.setCompilers.addCompilerFlag(ompflag)
>>> - if self.setCompilers.checkLinkerFlag(ompflag):
>>> - self.setCompilers.addLinkerFlag(ompflag)
>>> self.setCompilers.popLanguage()
>>> # OpenMP threadprivate variables are not supported on all platforms
>>> (for e.g on MacOS).
>>> # Hence forcing to configure additionally with --with-pthreadclasses
>>> so that pthread
>>>
>>>
>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
More information about the petsc-dev
mailing list