Skip to main content

LEAF PyPI version Supported versions License

LEAF is a simulator for analytical modeling of energy consumption in cloud, fog, or edge computing environments. It enables the modeling of simple tasks running on a single node as well as complex application graphs in distributed, heterogeneous, and resource-constrained infrastructures. LEAF is based on SimPy for discrete-event simulation and NetworkX for modeling infrastructure or application graphs.

Please have a look at out examples and visit the official documentation for more information on this project.

This Python implementation was ported from the original Java protoype. All future development will take place in this repository.

⚙️ Installation

You can install the latest release of LEAF via pip:

$ pip install leafsim

Alternatively, you can also clone the repository (including all examples) and set up your environment via:

$ pip install -e .

🚀 Getting started

LEAF uses SimPy for process-based discrete-event simulation and adheres to their API. To understand how to develop scenarios in LEAF, it makes sense to familiarize yourself with SimPy first.

import simpy
from leaf.application import Task
from leaf.infrastructure import Node
from leaf.power import PowerModelNode, PowerMeter

# Processes modify the model during the simulation
def place_task_after_2_seconds(env, node, task):
    """Waits for 2 seconds and places a task on a node."""
    yield env.timeout(2)
    task.allocate(node)

node = Node("node1", cu=100, power_model=PowerModelNode(max_power=30, static_power=10))
task = Task(cu=100)
power_meter = PowerMeter(node, callback=lambda m: print(f"{env.now}: Node consumes {int(m)}W"))

env = simpy.Environment()  
# register our task placement process
env.process(place_task_after_2_seconds(env, node, task))
# register power metering process (provided by LEAF)
env.process(power_meter.run(env))
env.run(until=5)

Which will result in the output:

0: Node consumes 10W
1: Node consumes 10W
2: Node consumes 30W
3: Node consumes 30W
4: Node consumes 30W

For other examples, please refer to the examples folder.

🍃 What can I do with LEAF?

LEAF enables high-level simulation of computing scenarios, where experiments are easy to create and easy to analyze. Besides allowing research on scheduling and placement algorithms on resource-constrained environments, LEAF puts a special focus on:

  • Dynamic networks: Simulate mobile nodes which can join or leave the network during the simulation.
  • Power consumption modeling: Model the power usage of individual compute nodes, network traffic, and applications.
  • Energy-aware algorithms: Implement dynamically adapting task placement strategies, routing policies, and other energy-saving mechanisms.
  • Scalability: Model the execution of thousands of compute nodes and applications in magnitudes faster than real time.

Please visit the official documentation for more information and examples on this project.

📖 Publications

If you use LEAF in your research, please cite our paper:

Philipp Wiesner and Lauritz Thamsen. "LEAF: Simulating Large Energy-Aware Fog Computing Environments" In the Proceedings of the 2021 5th IEEE International Conference on Fog and Edge Computing (ICFEC). IEEE. 2021 [arXiv preprint] [video]

Bibtex:

@inproceedings{WiesnerThamsen_LEAF_2021,
  author={Wiesner, Philipp and Thamsen, Lauritz},
  booktitle={2021 IEEE 5th International Conference on Fog and Edge Computing (ICFEC)}, 
  title={{LEAF}: Simulating Large Energy-Aware Fog Computing Environments}, 
  year={2021},
  pages={29-36},
  doi={10.1109/ICFEC51620.2021.00012}
}

💚 Projects using LEAF

Metadata

Release files for leafsim 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for leafsim 0.4.2
File Size Uploaded
leafsim-0.4.2.tar.gz 1.0 MB Details

Release files / leafsim-0.4.2.tar.gz

Download URL leafsim-0.4.2.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
4ba8684e8f1d51e518029fc01cdee35b9e9a7f3e9c214bbdf9f3973c0c1a7389
BLAKE2b-256 checksum
How to use checksums
3b7ade7d825b54583a56678ecbb8c4a68290dbeb48b7cd0634c18c9c7bdce60e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.7.12

Release history Release notifications | RSS feed

This release

0.4.2 This release

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

2 release files

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page