[PATCH] config: test functions and headers only once
Many functions and headers are mentioned in both BuildSystem and PETSc, thus being tested more than once. Removing this redundancy speeds up my configure from 125 seconds to 110 seconds. --- The full list of redundant configure tests is shown below. HAVE_LIBLAPACK is anomalous because it is actually testing for different functions. $ grep 'Defined .HAVE_' mpich-basic/conf/configure.log | sed 's,^ \+,,' | sort | uniq -cd 2 Defined "HAVE_ACCESS" to "1" 2 Defined "HAVE_BZERO" to "1" 2 Defined "HAVE_CLOCK" to "1" 2 Defined "HAVE_DLCLOSE" to "1" 2 Defined "HAVE_DLERROR" to "1" 2 Defined "HAVE_DLOPEN" to "1" 2 Defined "HAVE_DLSYM" to "1" 2 Defined "HAVE_DRAND48" to "1" 2 Defined "HAVE_ENDIAN_H" to "1" 2 Defined "HAVE_FCNTL_H" to "1" 2 Defined "HAVE_FENV_H" to "1" 4 Defined "HAVE_FLOAT_H" to "1" 2 Defined "HAVE_FORK" to "1" 2 Defined "HAVE_GETCWD" to "1" 2 Defined "HAVE_GETDOMAINNAME" to "1" 2 Defined "HAVE_GETHOSTBYNAME" to "1" 2 Defined "HAVE_GETHOSTNAME" to "1" 2 Defined "HAVE_GET_NPROCS" to "1" 4 Defined "HAVE_GETPAGESIZE" to "1" 2 Defined "HAVE_GETPWUID" to "1" 2 Defined "HAVE_GETRUSAGE" to "1" 2 Defined "HAVE_GETTIMEOFDAY" to "1" 2 Defined "HAVE_GETWD" to "1" 2 Defined "HAVE_LIBBLAS" to "1" 3 Defined "HAVE_LIBDL" to "1" 27 Defined "HAVE_LIBLAPACK" to "1" 5 Defined "HAVE_LIBM" to "1" 2 Defined "HAVE_LIBZ" to "1" 2 Defined "HAVE_LIMITS_H" to "1" 2 Defined "HAVE_LSEEK" to "1" 2 Defined "HAVE_MALLOC_H" to "1" 2 Defined "HAVE_MEMALIGN" to "1" 2 Defined "HAVE_MEMMOVE" to "1" 2 Defined "HAVE_MEMORY_H" to "1" 2 Defined "HAVE_MKSTEMP" to "1" 2 Defined "HAVE_MPI_FINALIZED" to "1" 2 Defined "HAVE_NETDB_H" to "1" 2 Defined "HAVE_NETINET_IN_H" to "1" 2 Defined "HAVE_POPEN" to "1" 2 Defined "HAVE_PTHREAD_H" to "1" 2 Defined "HAVE_PWD_H" to "1" 2 Defined "HAVE_RAND" to "1" 2 Defined "HAVE_READLINK" to "1" 2 Defined "HAVE_REALPATH" to "1" 2 Defined "HAVE_SCHED_H" to "1" 2 Defined "HAVE_SEARCH_H" to "1" 2 Defined "HAVE_SETJMP_H" to "1" 2 Defined "HAVE_SIGACTION" to "1" 2 Defined "HAVE_SIGNAL" to "1" 2 Defined "HAVE_SIGSET" to "1" 2 Defined "HAVE_SLEEP" to "1" 2 Defined "HAVE_SNPRINTF" to "1" 2 Defined "HAVE_SOCKET" to "1" 2 Defined "HAVE_STDINT_H" to "1" 2 Defined "HAVE_STDLIB_H" to "1" 2 Defined "HAVE_STRCASECMP" to "1" 2 Defined "HAVE_STRING_H" to "1" 2 Defined "HAVE_STRINGS_H" to "1" 2 Defined "HAVE_SYS_PARAM_H" to "1" 2 Defined "HAVE_SYS_PROCFS_H" to "1" 2 Defined "HAVE_SYS_RESOURCE_H" to "1" 2 Defined "HAVE_SYS_SOCKET_H" to "1" 3 Defined "HAVE_SYS_SYSINFO_H" to "1" 2 Defined "HAVE_SYS_TIMES_H" to "1" 2 Defined "HAVE_SYS_TYPES_H" to "1" 2 Defined "HAVE_SYS_UTSNAME_H" to "1" 3 Defined "HAVE_SYS_WAIT_H" to "1" 3 Defined "HAVE_TIME_H" to "1" 2 Defined "HAVE_TIMES" to "1" 2 Defined "HAVE_TIME" to "1" 2 Defined "HAVE_UNAME" to "1" 2 Defined "HAVE_UNISTD_H" to "1" 2 Defined "HAVE_USLEEP" to "1" After this patch, we have a few "redundant" tests left. 2 Defined "HAVE_LIBBLAS" to "1" 3 Defined "HAVE_LIBDL" to "1" 27 Defined "HAVE_LIBLAPACK" to "1" 5 Defined "HAVE_LIBM" to "1" 2 Defined "HAVE_LIBZ" to "1" 2 Defined "HAVE_MPI_FINALIZED" to "1" 2 Defined "HAVE_SYS_SYSINFO_H" to "1" 2 Defined "HAVE_SYS_WAIT_H" to "1" 2 Defined "HAVE_TIME_H" to "1" I have not de-duplicated libraries.py yet because it passes in more structured arguments. It only runs a few tests multiple times: [(['socket', 'nsl'], 'socket'), (['fpe'], 'handle_sigfpes'), (['socket', 'nsl'], 'socket'), (['fpe'], 'handle_sigfpes')] These are actually all defined in one place, but it is visited multiple times: /home/jed/petsc/mpich-basic/conf/reconfigure-mpich-basic.py(12)<module>() -> configure.petsc_configure(configure_options) /home/jed/petsc/config/configure.py(290)petsc_configure() -> framework = config.framework.Framework(['--configModules=PETSc.Configure','--optionsModule=PETSc.compilerOptions']+sys.argv[1:], loadArgDB = 0) /home/jed/petsc/config/BuildSystem/config/framework.py(110)__init__() -> self.createChildren() /home/jed/petsc/config/BuildSystem/config/framework.py(319)createChildren() -> self.getChild(moduleName) /home/jed/petsc/config/BuildSystem/config/framework.py(304)getChild() -> config.setupDependencies(self)
/home/jed/petsc/config/PETSc/Configure.py(105)setupDependencies() -> self.libraries.libraries.extend(libraries1)
/home/jed/petsc/mpich-basic/conf/reconfigure-mpich-basic.py(12)<module>() -> configure.petsc_configure(configure_options) /home/jed/petsc/config/configure.py(293)petsc_configure() -> framework.configure(out = sys.stdout) /home/jed/petsc/config/BuildSystem/config/framework.py(929)configure() -> self.updateDependencies() /home/jed/petsc/config/BuildSystem/config/framework.py(385)updateDependencies() -> child.setupDependencies(self)
/home/jed/petsc/config/PETSc/Configure.py(105)setupDependencies() -> self.libraries.libraries.extend(libraries1)
config/BuildSystem/config/functions.py | 4 ++++ config/BuildSystem/config/headers.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/config/BuildSystem/config/functions.py b/config/BuildSystem/config/functions.py index 30da45e..7b700cb 100644 --- a/config/BuildSystem/config/functions.py +++ b/config/BuildSystem/config/functions.py @@ -197,5 +197,9 @@ choke me self.executeTest(self.checkSignalHandlerType) self.executeTest(self.checkFreeReturnType) self.executeTest(self.checkVariableArgumentLists) + try: + self.functions = list(set(self.functions)) + except: + pass map(lambda function: self.executeTest(self.check, function), self.functions) return diff --git a/config/BuildSystem/config/headers.py b/config/BuildSystem/config/headers.py index e180eaa..f3da45c 100644 --- a/config/BuildSystem/config/headers.py +++ b/config/BuildSystem/config/headers.py @@ -230,6 +230,10 @@ class Configure(config.base.Configure): self.executeTest(self.checkSysWait) self.executeTest(self.checkTime) self.executeTest(self.checkMath) + try: + self.headers = list(set(self.headers)) + except: + pass map(lambda header: self.executeTest(self.check, header), self.headers) self.executeTest(self.checkRecursiveMacros) return -- 1.8.2.1
participants (1)
-
Jed Brown