[petsc-dev] Cache detection

Barry Smith bsmith at mcs.anl.gov
Tue Feb 2 13:41:15 CST 2010


   Jed,

     You used "with" in the code, sorry but this is not allowed for  
maximum portability of the python. I have "fixed" this and push.

     There is a bug in the code when --with-batch is used and the  
tests fail can you please take a look at it and fix it.

    Thanks

    Barry


[barry-smiths-macbook-pro:~/Src/petsc-dev] barrysmith% arch-gnu/conf/ 
reconfigure-arch-gnu.py -with-batch --known-mpi-shared=0
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================
              Configuring PETSc to compile on your system
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================
TESTING: checkSharedLibrary from PETSc.packages.sowing(config/ 
BuildSystem/config/package.py:423)
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================
     Since your compute nodes require use of a batch system or mpiexec  
you must:
  1) Submit ./conftest to 1 processor of your batch system or system  
you are
     cross-compiling for; this will generate the file reconfigure.py
  2) Run ./reconfigure.py (to complete the configure process).
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================
[barry-smiths-macbook-pro:~/Src/petsc-dev] barrysmith% ./reconfigure.py
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================
              Configuring PETSc to compile on your system
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================
     Since your compute nodes require use of a batch system or mpiexec  
you must:
  1) Submit ./conftest to 1 processor of your batch system or system  
you are
     cross-compiling for; this will generate the file reconfigure.py
  2) Run ./reconfigure.py (to complete the configure process).
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================

[barry-smiths-macbook-pro:~/Src/petsc-dev] barrysmith% ./conftest
getconf: no such configuration parameter `LEVEL1_DCACHE_SIZE'
getconf: no such configuration parameter `LEVEL1_DCACHE_LINESIZE'
getconf: no such configuration parameter `LEVEL1_DCACHE_ASSOC'
[
[barry-smiths-macbook-pro:~/Src/petsc-dev] barrysmith% more  
reconfigure.py
#!/Library/Frameworks/Python.framework/Versions/2.5/Resources/ 
Python.app/Contents/MacOS/Python

configure_options = [
   '--known-level1-dcache-size=-1',
   '--known-level1-dcache-linesize=-1',
   '--known-level1-dcache-assoc=-1',
   '--configModules=PETSc.Configure', '-- 
optionsModule=PETSc.compilerOptions', '--known-memcmp-ok=1', '--known- 
sizeof-char=1', '--kno
wn-sizeof-void-p=4', '--known-sizeof-short=2', '--known-sizeof-int=4',  
'--known-sizeof-long=4', '--known-sizeof-long-long=8', '--kno
wn-sizeof-float=4', '--known-sizeof-double=8', '--known-sizeof- 
size_t=4', '--known-bits-per-byte=8', '--configModules=PETSc.Configur
e', '--optionsModule=PETSc.compilerOptions', '--with-mpi=0', '--with- 
fc=0', '--with-batch', '--with-shared=0'
]
if __name__ == '__main__':
   import os
   import sys
   sys.path.insert(0, os.path.abspath(os.path.join('config')))
   import configure
   configure.petsc_configure(configure_options)
[barry-smiths-macbook-pro:~/Src/petsc-dev] barrysmith% ./reconfigure.py
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================
              Configuring PETSc to compile on your system
= 
= 
= 
= 
= 
= 
= 
= 
= 
========================================================================
*********************************************************************************
                 ERROR in COMMAND LINE ARGUMENT to config/configure.py
---------------------------------------------------------------------------------------
Number out of range: -1 not in [16,2147483647) for key known-level1- 
dcache-size
*********************************************************************************


   File "/Users/barrysmith/Src/petsc-dev/config/configure.py", line  
226, in petsc_configure
     framework = config.framework.Framework(['-- 
configModules=PETSc.Configure','--optionsModule=PETSc.compilerOptions'] 
+sys.argv[1:], loadArgDB = 0)
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/config/ 
framework.py", line 103, in __init__
     self.createChildren()
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/config/ 
framework.py", line 329, in createChildren
     self.getChild(moduleName)
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/config/ 
framework.py", line 314, in getChild
     config.setupDependencies(self)
   File "/Users/barrysmith/Src/petsc-dev/config/PETSc/Configure.py",  
line 45, in setupDependencies
     utilityObj                    = self.framework.require('PETSc.'+d 
+'.'+utilityName, self)
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/config/ 
framework.py", line 334, in require
     config = self.getChild(moduleName, keywordArgs)
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/config/ 
framework.py", line 312, in getChild
     config.setup()
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/ 
script.py", line 76, in setup
     logger.Logger.setup(self)
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/ 
logger.py", line 83, in setup
     args.ArgumentProcessor.setup(self)
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/args.py",  
line 74, in setup
     self.setupArguments(self.argDB)
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/ 
script.py", line 61, in setupArguments
     self.setupHelp(self.help)
   File "/Users/barrysmith/Src/petsc-dev/config/PETSc/utilities/ 
cacheDetails.py", line 40, in setupHelp
     help.addArgument('PETSc', '-known-'+a.name+'=<'+a.keyword+'>',  
nargs.ArgInt(None, None, a.help, min=a.min, max=a.max))
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/help.py",  
line 103, in addArgument
     self.argDB.setType(self.getArgName(name), type, forceLocal = 1)
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/RDict.py",  
line 209, in setType
     value.setValue(v.getValue())
   File "/Users/barrysmith/Src/petsc-dev/config/BuildSystem/nargs.py",  
line 257, in setValue
     raise ValueError('Number out of range: '+str(value)+' not in  
['+str(self.min)+','+str(self.max)+')'+' for key '+str(self.key))


On Feb 2, 2010, at 10:48 AM, Jed Brown wrote:

> I just pushed cache line detection and prefetching, so you'll have to
> rerun configure.
>
> The cache detection probably only works correctly on Linux or with  
> glibc
> (it tries to use sysconf with _SC_LEVEL1_DCACHE_*, then falls back on
> running getconf(1P) with these arguments.  I know how to do it
> generically on x86/x64, but that requires inline assembly (you have to
> be able to call CPUID) which I don't know how to do portably.  The
> defaults are fairly conservative: 32KiB L1D, 32-byte cache lines, 2- 
> way
> associativity (though currently only the line length is being used).
> For comparison, Core 2 has (32KiB, 64, 8-way) and AMD K10 has (64KiB,
> 64, 2-way).
>
> If the script is getting these wrong, you can set them manually with
>
>  --known-level1-dcache-size
>  --known-level1-dcache-linesize
>  --known-level1-dcache-assoc
>
> but also let me know so we can figure out how to autodetect it.
>
> And of course, yell at me if I've broken your build.
>
> Jed




More information about the petsc-dev mailing list