Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4_formats_and_performance energy monitoring #61

Open
jzvolensky opened this issue Nov 21, 2024 · 0 comments
Open

2.4_formats_and_performance energy monitoring #61

jzvolensky opened this issue Nov 21, 2024 · 0 comments

Comments

@jzvolensky
Copy link
Collaborator

jzvolensky commented Nov 21, 2024

Looking into codecarbon as a tool to collect data about the energy use of functions/processes in the exercises.

Codecarbon collects metrics into a csv like so

@track_emissions(offline=True, log_level="error", country_iso_code="ITA")
def whatever(size: int, iterations: int) -> np.ndarray:
    """
    Multiply two random matrices of size x size

    Args:
    size (int): size of the matrices
    """
    for _ in range(iterations):
        matrix1 = np.random.rand(size, size)
        matrix2 = np.random.rand(size, size)
        result = np.dot(matrix1, matrix2)
    return result

Now we can have a util to read this csv and output HTML in the notebook. Something like this but with Images or icons.
image

This requires an extra function run to read and generate the emission output.

Discussion point 1: I think that to make this seamless we could fork codecarbon and add a parameter to print this html directly:

https://github.com/mlco2/codecarbon/blob/master/codecarbon/emissions_tracker.py#L1023

This would mean that the only change from the user perspective is the decorator on top of a function

Point 1 has been dropped as it is not an issue

Discussion point 2: I think we could also make the comparisons fun using unusual items or such. Coffee cups is a fine baseline but I think we can make this more entertaining. Suggestions welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant