def CreateDistribution(config, rank=None): logger = GetFunctionLogger() #Instance Distribution class which is templated over rank if rank == None: rank = config.Representation.rank distrib = CreateInstanceRank("core.DistributedModel", rank) #hack in initial distribution into configuration #TODO: Get initial distribution from propagator class sec: pass if hasattr(config, "Distribution"): distrSection = config.Distribution else: distrSection = sec() if not hasattr(distrSection, "proc_array_rank"): distrSection.proc_array_rank = 1 #DO NOT CHANGE THIS UNLESS YOU ARE ABSOLUTELY SURE. IF THE LAST RANK IS USED #SaveWavefunctionHDF WILL HAVE ABSOLUTELY HORRIBLE PERFORMANCE!!! if not hasattr(distrSection, "initial_distribution"): distrSection.initial_distribution = array([0], dtype=int) if distrSection.initial_distribution[0] != 0: logger.warning( "Not distributing first rank of wavefunction. Consider removing [Distribution] from the config file" ) #apply configuration distrib.ApplyConfigSection(distrSection) return distrib
def CreateDistribution(config, rank=None): logger = GetFunctionLogger() #Instance Distribution class which is templated over rank if rank == None: rank = config.Representation.rank distrib = CreateInstanceRank("core.DistributedModel", rank) #hack in initial distribution into configuration #TODO: Get initial distribution from propagator class sec: pass if hasattr(config, "Distribution"): distrSection = config.Distribution else: distrSection = sec() if not hasattr(distrSection, "proc_array_rank"): distrSection.proc_array_rank = 1 #DO NOT CHANGE THIS UNLESS YOU ARE ABSOLUTELY SURE. IF THE LAST RANK IS USED #SaveWavefunctionHDF WILL HAVE ABSOLUTELY HORRIBLE PERFORMANCE!!! if not hasattr(distrSection, "initial_distribution"): distrSection.initial_distribution = array([0], dtype=int) if distrSection.initial_distribution[0] != 0: logger.warning("Not distributing first rank of wavefunction. Consider removing [Distribution] from the config file") #apply configuration distrib.ApplyConfigSection(distrSection) return distrib