[petsc-dev] [PATCH] Threadcomm: Add #include <sched.h> for cpu_set_t

Eric Bavier ericbavier at gmail.com
Thu May 1 17:13:57 CDT 2014


Satish Balay <balay at mcs.anl.gov> writes:

> BTW: were you using petsc-3.4? The code code appears to be reworked in
> petsc-dev [and thats recommend for threads usage]

Yes, I was building petsc-3.4.4.  The patched file looks the same in
petsc-dev as in 3.4, though I'm sure there are other threading changes
that could affect things.

>
> Satish
>
> On Thu, 1 May 2014, Satish Balay wrote:
>
>> I believe this include is pulled in from pthreadclasses
>> 
>> openmp.py as:     self.deps = [self.pthreadclasses]
>> 
>> Is this a real dependency?
>> 
>> If so configure should enforce this.. [Its not doing this due to the
>> way configureLibrary() is used here]
>> 
>> The following would be the fix.. [which gives a generic error message
>> for pthreadclasses - this could be misleading..
>> 
>> >>>>>>
>> Did not find package PTHREADCLASSES needed by openmp.
>> Enable the package using --with-pthreadclasses or --download-pthreadclasses
>> <<<<
>> 
>> $ git diff
>> diff --git a/config/PETSc/packages/openmp.py b/config/PETSc/packages/openmp.py
>> index a7c3fd5..b18978b 100644
>> --- a/config/PETSc/packages/openmp.py
>> +++ b/config/PETSc/packages/openmp.py
>> @@ -22,6 +22,7 @@ class Configure(PETSc.package.NewPackage):
>>    def configureLibrary(self):
>>      ''' Checks for -fopenmp compiler flag'''
>>      ''' Needs to check if OpenMP actually exists and works '''
>> +    self.checkDependencies()
>>      self.setCompilers.pushLanguage('C')
>>      #
>>      for flag in ["-fopenmp", # Gnu
>> diff --git a/config/PETSc/packages/pthreadclasses.py b/config/PETSc/packages/pthreadclasses.py
>> index b09e51c..08a8260 100644
>> --- a/config/PETSc/packages/pthreadclasses.py
>> +++ b/config/PETSc/packages/pthreadclasses.py
>> @@ -17,6 +17,7 @@ class Configure(PETSc.package.NewPackage):
>>      return
>>  
>>    def configureLibrary(self):
>> +    self.checkDependencies()
>>      if not self.pthread.found:
>>         raise RuntimeError('Pthreads not found, pthread classes needs pthreads to run')
>>      self.found = 1
>> 
>> >>>>>>>>>>
>> 
>> But then openmp.py has the following indicating pthreadclasses is optional..
>> 
>>     # 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
>>     # routines pthread_get/setspecific() can be used instead.
>>     if not self.checkCompile('#include <omp.h>\nint a;\n#pragma omp threadprivate(a)\n','') and not self.pthreadclasses.found:
>>       raise RuntimeError('OpenMP threadprivate variables not found. Configure additionally with --with-pthreadclasses=1')
>> 
>> Satish
>> 
>> On Thu, 1 May 2014, Eric Bavier wrote:
>> 
>> > I ran into a problem compiling petsc when configured with
>> > "--with-openmp=1" on my system.  This patch seems to fix it.  Comments
>> > welcome.
>> > 
>> > 
>> 
>> 
>

-- 
`~Eric



More information about the petsc-dev mailing list