Python h5py.get_config() Examples
The following are 2
code examples of h5py.get_config().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
h5py
, or try the search function
.
Example #1
Source File: asdf_data_set.py From pyasdf with BSD 3-Clause "New" or "Revised" License | 4 votes |
def mpi(self): """ Returns a named tuple with ``comm``, ``rank``, ``size``, and ``MPI`` if run with MPI and ``False`` otherwise. """ # Simple cache as this is potentially accessed a lot. if hasattr(self, "__is_mpi"): return self.__is_mpi if self.__force_mpi is True: self.__is_mpi = True elif self.__force_mpi is False: self.__is_mpi = False else: self.__is_mpi = is_mpi_env() # If it actually is an mpi environment, set the communicator and the # rank. if self.__is_mpi: # Check if HDF5 has been complied with parallel I/O. c = h5py.get_config() if not hasattr(c, "mpi") or not c.mpi: is_parallel = False else: is_parallel = True if not is_parallel: msg = ( "Running under MPI requires HDF5/h5py to be complied " "with support for parallel I/O." ) raise RuntimeError(msg) import mpi4py # This is not needed on most mpi4py installations. if not mpi4py.MPI.Is_initialized(): mpi4py.MPI.Init() # Set mpi tuple to easy class wide access. mpi_ns = collections.namedtuple( "mpi_ns", ["comm", "rank", "size", "MPI"] ) comm = mpi4py.MPI.COMM_WORLD self.__is_mpi = mpi_ns( comm=comm, rank=comm.rank, size=comm.size, MPI=mpi4py.MPI ) return self.__is_mpi
Example #2
Source File: watermark.py From pyasdf with BSD 3-Clause "New" or "Revised" License | 4 votes |
def get_watermark(): """ Return information about the current system relevant for pyasdf. """ vendor = MPI.get_vendor() if MPI else None c = h5py.get_config() if not hasattr(c, "mpi") or not c.mpi: is_parallel = False else: is_parallel = True watermark = { "python_implementation": platform.python_implementation(), "python_version": platform.python_version(), "python_compiler": platform.python_compiler(), "platform_system": platform.system(), "platform_release": platform.release(), "platform_version": platform.version(), "platform_machine": platform.machine(), "platform_processor": platform.processor(), "platform_processor_count": cpu_count(), "platform_architecture": platform.architecture()[0], "platform_hostname": gethostname(), "date": strftime("%d/%m/%Y"), "time": strftime("%H:%M:%S"), "timezone": strftime("%Z"), "hdf5_version": h5py.version.hdf5_version, "parallel_h5py": is_parallel, "mpi_vendor": vendor[0] if vendor else None, "mpi_vendor_version": ".".join(map(str, vendor[1])) if vendor else None, "problematic_multiprocessing": is_multiprocessing_problematic(), } watermark["module_versions"] = { module: get_distribution(module).version for module in modules } if MPI is None: watermark["module_versions"]["mpi4py"] = None return watermark