qns.utils package
Submodules
qns.utils.log module
- qns.utils.log.install(s)[source]
Install the logger to the simulator
- Parameters
s (Simulator) – the simulator
- qns.utils.log.logger = <Logger qns (INFO)>
The default
logger
used by SimQN
qns.utils.multiprocess module
- class qns.utils.multiprocess.MPSimulations(settings: Dict = {}, iter_count: int = 1, aggregate: bool = True, cores: int = - 1, name: Optional[str] = None)[source]
Bases:
object
MultiProcessSimulations will help users to perfrom multiple simulations with different experiment settings and leverage multiple processes.
- get_raw_data()[source]
Get the original raw results, no matter aggregate is
True
or not.- Returns
a result data in pd.DataFrame
- run(setting: Dict = {}) Dict [source]
This function should be overwited by users to provide codes that run a single simulation.
- Parameters
setting (Dict) – the simulation setting, e.g. {‘node_num’: 10, ‘req_num’: 10, ‘memory_size’: 50}
- Returns
100, ‘fidelity’: 0.88}
- Return type
a dictionary that contains all results, e.g. {‘throughput’
qns.utils.rnd module
- qns.utils.rnd.get_choice(a)[source]
return an random element from a list
- Parameters
a – a iterable object
- qns.utils.rnd.get_rand(low: float = 0, high: float = 1) float [source]
Get a random number from [low, high)
- Parameters
low (int) – the low bound
high (int) – the high bound
Module contents
- qns.utils.get_choice(a)[source]
return an random element from a list
- Parameters
a – a iterable object
- qns.utils.get_rand(low: float = 0, high: float = 1) float [source]
Get a random number from [low, high)
- Parameters
low (int) – the low bound
high (int) – the high bound
- qns.utils.get_randint(low: int, high: int) float [source]
Get a random integer from [low, high]
- Parameters
low (int) – the low bound
high (int) – the high bound
- qns.utils.install(s)[source]
Install the logger to the simulator
- Parameters
s (Simulator) – the simulator