easybuild.tools.systemtools module

Module with useful functions for getting system information

author:Jens Timmerman (Ghent University)

@auther: Ward Poelmans (Ghent University)

exception easybuild.tools.systemtools.SystemToolsException

Bases: Exception

raised when systemtools fails

easybuild.tools.systemtools.check_linked_shared_libs(path, required_patterns=None, banned_patterns=None)

Check for (lack of) patterns in linked shared libraries for binary/library at specified path. Uses ‘ldd’ on Linux and ‘otool -L’ on macOS to determine linked shared libraries.

Returns True or False for dynamically linked binaries and shared libraries to indicate whether all patterns match and antipatterns don’t match.

Returns None if given path is not a dynamically linked binary or library.

easybuild.tools.systemtools.check_os_dependency(dep)

Check if dependency is available from OS.

easybuild.tools.systemtools.check_python_version()

Check currently used Python version.

easybuild.tools.systemtools.det_parallelism(par=None, maxpar=None)

Determine level of parallelism that should be used. Default: educated guess based on # cores and ‘ulimit -u’ setting: min(# cores, ((ulimit -u) - 15) // 6)

easybuild.tools.systemtools.det_terminal_size()

Determine the current size of the terminal window. :return: tuple with terminal width and height

easybuild.tools.systemtools.find_library_path(lib_filename)

Search library by file name in the system Return absolute path to existing libraries

Params lib_filename:
 name of library file
easybuild.tools.systemtools.get_avail_core_count()

Returns the number of available CPUs, according to cgroups and taskssets limits

easybuild.tools.systemtools.get_core_count()

NO LONGER SUPPORTED: use get_avail_core_count() instead

easybuild.tools.systemtools.get_cpu_arch_name()

Determine CPU architecture name via archspec (if available).

easybuild.tools.systemtools.get_cpu_architecture()

Try to detect the CPU architecture

Returns:a value from the CPU_ARCHITECTURES list
easybuild.tools.systemtools.get_cpu_family()

Determine CPU family. :return: a value from the CPU_FAMILIES list

easybuild.tools.systemtools.get_cpu_features()

Get list of CPU features

easybuild.tools.systemtools.get_cpu_model()

Determine CPU model, e.g., Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz

easybuild.tools.systemtools.get_cpu_speed()

Returns the (maximum) cpu speed in MHz, as a float value. In case of throttling, the highest cpu speed is returns.

easybuild.tools.systemtools.get_cpu_vendor()

Try to detect the CPU vendor

Returns:a value from the CPU_VENDORS list
easybuild.tools.systemtools.get_gcc_version()

Process gcc –version and return the GCC version.

easybuild.tools.systemtools.get_glibc_version()

Find the version of glibc used on this system

easybuild.tools.systemtools.get_kernel_name()

NO LONGER SUPPORTED: use get_os_type() instead

easybuild.tools.systemtools.get_os_name()

Determine system name, e.g., ‘redhat’ (generic), ‘centos’, ‘debian’, ‘fedora’, ‘suse’, ‘ubuntu’, ‘red hat enterprise linux server’, ‘SL’ (Scientific Linux), ‘opensuse’, …

easybuild.tools.systemtools.get_os_type()

Determine system type, e.g., ‘Linux’, ‘Darwin’, ‘Java’.

easybuild.tools.systemtools.get_os_version()

Determine system version.

easybuild.tools.systemtools.get_platform_name(withversion=False)

Try and determine platform name e.g., x86_64-unknown-linux, x86_64-apple-darwin

easybuild.tools.systemtools.get_shared_lib_ext()

Determine extention for shared libraries

Linux: ‘so’, Darwin: ‘dylib’

easybuild.tools.systemtools.get_system_info()

Return a dictionary with system information.

easybuild.tools.systemtools.get_tool_version(tool, version_option='--version')

Get output of running version option for specific command line tool. Output is returned as a single-line string (newlines are replaced by ‘; ‘).

easybuild.tools.systemtools.get_total_memory()

Try to ascertain this node’s total memory

Returns:total memory as an integer, specifically a number of megabytes
easybuild.tools.systemtools.locate_solib(libobj)

Return absolute path to loaded library using dlinfo Based on https://stackoverflow.com/a/35683698

Params libobj:ctypes CDLL object
easybuild.tools.systemtools.pick_dep_version(dep_version)

Pick the correct dependency version to use for this system. Input can either be: * a string value (or None) * a dict with options to choose from

Return value is the version to use.

easybuild.tools.systemtools.sched_getaffinity()

Determine list of available cores for current process.

easybuild.tools.systemtools.use_group(group_name)

Use group with specified name.