def header(self): self() nodename, machine = os.uname()[1::3] self('User: '******'USER', '???') + '@' + nodename) self('Date: ', time.asctime()) self('Arch: ', machine) self('Pid: ', os.getpid()) self('Python: {0}.{1}.{2}'.format(*sys.version_info[:3])) # Espresso line = os.path.dirname(xespresso.__file__) githash = search_current_git_hash(xespresso) if githash is not None: line += ' ({:.10})'.format(githash) self('xespresso: ', line) # ASE line = '%s (version %s' % (os.path.dirname(ase.__file__), ase_version) githash = search_current_git_hash(ase) if githash is not None: line += '-{:.10}'.format(githash) line += ')' self('ase: ', line) self('\n'*2)
def format_dependency(modname: str) -> Tuple[str, str]: """Return (name, path) for given module.""" try: module = importlib.import_module(modname) except ImportError: return modname, 'not installed' version = getattr(module, '__version__', '?') name = f'{modname}-{version}' if modname == 'ase': githash = search_current_git_hash(module) if githash: name += '-{:.10}'.format(githash) # (only packages have __path__, but we are importing packages.) return name, str(module.__path__[0]) # type: ignore
def info(): """Show versions of GPAW and its dependencies.""" results = [('python-' + sys.version.split()[0], sys.executable)] for name in ['gpaw', 'ase', 'numpy', 'scipy']: try: module = import_module(name) except ImportError: results.append((name, False)) else: # Search for git hash githash = search_current_git_hash(module) if githash is None: githash = '' else: githash = '-{:.10}'.format(githash) results.append((name + '-' + module.__version__ + githash, module.__file__.rsplit('/', 1)[0] + '/')) results.append(('libxc-' + _gpaw.libxc_version, '')) module = import_module('_gpaw') if hasattr(module, 'githash'): githash = '-{:.10}'.format(module.githash()) results.append( ('_gpaw' + githash, op.normpath(getattr(module, '__file__', 'built-in')))) p = subprocess.Popen(['which', 'gpaw-python'], stdout=subprocess.PIPE) results.append(('parallel', p.communicate()[0].strip().decode() or False)) results.append(('MPI enabled', have_mpi)) if have_mpi: have_sl = compiled_with_sl() have_elpa = LibElpa.have_elpa() else: have_sl = have_elpa = 'no (MPI unavailable)' results.append(('scalapack', have_sl)) results.append(('Elpa', have_elpa)) results.append(('FFTW', fftw.FFTPlan is fftw.FFTWPlan)) results.append(('libvdwxc', compiled_with_libvdwxc())) paths = [ '{0}: {1}'.format(i + 1, path) for i, path in enumerate(gpaw.setup_paths) ] results.append(('PAW-datasets', '\n{:25}'.format('').join(paths))) if rank == 0: for a, b in results: if isinstance(b, bool): b = ['no', 'yes'][b] print('{0:25}{1}'.format(a, b))
def print_info(): versions = [('platform', platform.platform()), ('python-' + sys.version.split()[0], sys.executable)] for name in ['ase', 'numpy', 'scipy']: try: module = import_module(name) except ImportError: versions.append((name, 'no')) else: # Search for git hash githash = search_current_git_hash(module) if githash is None: githash = '' else: githash = '-{:.10}'.format(githash) versions.append((name + '-' + module.__version__ + githash, module.__file__.rsplit(os.sep, 1)[0] + os.sep)) for a, b in versions: print('{:25}{}'.format(a, b))
extra_compile_args = [] runtime_library_dirs = [] extra_objects = [] define_macros = [('NPY_NO_DEPRECATED_API', 7)] undef_macros = [] mpi_libraries = [] mpi_library_dirs = [] mpi_include_dirs = [] mpi_runtime_library_dirs = [] mpi_define_macros = [] # Search and store current git hash if possible try: from ase.utils import search_current_git_hash githash = search_current_git_hash('gpaw') if githash is not None: define_macros += [('GPAW_GITHASH', githash)] else: print('.git directory not found. GPAW git hash not written.') except ImportError: print('ASE not found. GPAW git hash not written.') platform_id = '' packages = [] for dirname, dirnames, filenames in os.walk('gpaw'): if '__init__.py' in filenames: packages.append(dirname.replace('/', '.')) import_numpy = True
def header(self): self() self(' ___ ___ ___ _ _ _ ') self(' | | |_ | | | | ') self(' | | | | | . | | | | ') self(' |__ | _|___|_____| ', gpaw.__version__) self(' |___|_| ') self() # We use os.uname() here bacause platform.uname() starts a subprocess, # which MPI may not like! # This might not work on Windows. We will see ... nodename, machine = os.uname()[1::3] self('User: '******'USER', '???') + '@' + nodename) self('Date: ', time.asctime()) self('Arch: ', machine) self('Pid: ', os.getpid()) self('Python: {0}.{1}.{2}'.format(*sys.version_info[:3])) # GPAW line = os.path.dirname(gpaw.__file__) githash = search_current_git_hash(gpaw, self.world) if githash is not None: line += ' ({:.10})'.format(githash) self('gpaw: ', line) # Find C-code: c = getattr(_gpaw, '__file__', None) if not c: c = sys.executable line = os.path.normpath(c) if hasattr(_gpaw, 'githash'): line += ' ({:.10})'.format(_gpaw.githash()) self('_gpaw: ', cut(line)) # ASE line = '%s (version %s' % (os.path.dirname(ase.__file__), ase_version) githash = search_current_git_hash(ase, self.world) if githash is not None: line += '-{:.10}'.format(githash) line += ')' self('ase: ', line) self('numpy: %s (version %s)' % (os.path.dirname(np.__file__), np.version.version)) import scipy as sp self('scipy: %s (version %s)' % (os.path.dirname(sp.__file__), sp.version.version)) # Explicitly deleting SciPy seems to remove garbage collection # problem of unknown cause del sp self('libxc: ', _gpaw.libxc_version) self('units: Angstrom and eV') self('cores: %d' % world.size) if gpaw.debug: self('DEBUG MODE') if extra_parameters: self('Extra parameters:', extra_parameters) self()