From 202c009c5e6fcb662a5cefcba4201002aa616e07 Mon Sep 17 00:00:00 2001 From: Archis Joglekar Date: Sat, 12 Sep 2020 10:12:38 -0700 Subject: [PATCH 1/8] New mlflow citation --- paper/paper.bib | 21 +++++++++++++-------- paper/paper.md | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/paper/paper.bib b/paper/paper.bib index 51e1093..4d885e3 100644 --- a/paper/paper.bib +++ b/paper/paper.bib @@ -197,16 +197,21 @@ @article{Hoyer2017 year = {2017} } -@article{Zaharia2018, - title={Accelerating the Machine Learning Lifecycle with MLflow.}, - author={Zaharia, Matei and Chen, Andrew and Davidson, Aaron and Ghodsi, Ali and Hong, Sue Ann and Konwinski, Andy and Murching, Siddharth and Nykodym, Tomas and Ogilvie, Paul and Parkhe, Mani and others}, - journal={IEEE Data Eng. Bull.}, - volume={41}, - number={4}, - pages={39--45}, - year={2018} +@inproceedings{Chen2020, +abstract = {MLflow is a popular open source platform for managing ML development, including experiment tracking, reproducibility, and deployment. In this paper, we discuss user feedback collected since MLflow was launched in 2018, as well as three major features we have introduced in response to this feedback: a Model Registry for collaborative model management and review, tools for simplifying ML code instrumentation, and experiment analytics functions for extracting insights from millions of ML experiments.}, +address = {New York, NY, USA}, +author = {Chen, Andrew and Chow, Andy and Davidson, Aaron and DCunha, Arjun and Ghodsi, Ali and Hong, Sue Ann and Konwinski, Andy and Mewald, Clemens and Murching, Siddharth and Nykodym, Tomas and Ogilvie, Paul and Parkhe, Mani and Singh, Avesh and Xie, Fen and Zaharia, Matei and Zang, Richard and Zheng, Juntai and Zumar, Corey}, +booktitle = {Proceedings of the Fourth International Workshop on Data Management for End-to-End Machine Learning}, +doi = {10.1145/3399579.3399867}, +isbn = {9781450380232}, +publisher = {Association for Computing Machinery}, +series = {DEEM'20}, +title = {{Developments in MLflow: A System to Accelerate the Machine Learning Lifecycle}}, +url = {https://doi.org/10.1145/3399579.3399867}, +year = {2020} } + @article{Fahlen2009, author = {Fahlen, J. E. and Winjum, B. J. and Grismayer, T. and Mori, W. B.}, doi = {10.1103/PhysRevLett.102.245002}, diff --git a/paper/paper.md b/paper/paper.md index 66fa9c1..3d5fe3d 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -183,7 +183,7 @@ Below, we also illustrate a manual validation of this phenomenon through the ful To run the entire testing suite, make sure `pytest` is installed, and call `pytest` from the root folder for the repository. Individual files can also be run by calling `pytest tests/.py`. # Acknowledgements -We use xarray [@Hoyer2017] for file storage and MLFlow [@Zaharia2018] for experiment management. +We use xarray [@Hoyer2017] for file storage and MLFlow [@Chen2020] for experiment management. We acknowledge valuable discussions with Pierre Navarro on the implementation of the Vlasov equation. From e03c93cfe0c99ef5510f16d5ec5edfa8ffe4baf8 Mon Sep 17 00:00:00 2001 From: Archis Joglekar Date: Sat, 12 Sep 2020 10:18:04 -0700 Subject: [PATCH 2/8] fully integrated workflow elaboration --- paper/paper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper/paper.md b/paper/paper.md index 18c9fd7..07a28b2 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -175,7 +175,7 @@ In the ``VlaPy`` simulation code, we have verified that the known damping rates We include validation against this phenomenon as an automated integrated test. The tests can be found in `tests/test_landau_damping.py` -Below, we also illustrate a manual validation of this phenomenon through the fully integrated workflow. After running a properly initialized simulation, we show that the damping rate of an electron plasma wave with $k=0.3$ is reproduced accurately through the UI. This can also be computed manually (please see the testing code for details). +Below, we also illustrate a manual validation of this phenomenon through the fully integrated workflow of running a simulation on a local machine and sending the results to the MLFlow-driven logging mechanism. After running a properly initialized simulation, we show that the damping rate of an electron plasma wave with $k=0.3$ is reproduced accurately through the UI. This can also be computed manually (please see the testing code for details). ![](../notebooks/screenshots_for_example/ui.png) ![](../notebooks/screenshots_for_example/damping.png) From aa33aee1a2fa3887544af76c77cf339c4156b55c Mon Sep 17 00:00:00 2001 From: Archis Joglekar Date: Sat, 12 Sep 2020 16:47:12 -0700 Subject: [PATCH 3/8] added code to the paper also snuck in a refactor for the startup messages --- paper/paper.md | 77 +++++++++++++++++++++++++ run_debug.py | 8 --- run_nlepw.py | 13 ----- run_vlapy.py | 10 +--- vlapy/infrastructure/print_to_screen.py | 5 +- vlapy/manager.py | 4 +- 6 files changed, 84 insertions(+), 33 deletions(-) diff --git a/paper/paper.md b/paper/paper.md index 07a28b2..9f0d986 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -182,6 +182,83 @@ Below, we also illustrate a manual validation of this phenomenon through the ful To run the entire testing suite, make sure `pytest` is installed, and call `pytest` from the root folder for the repository. Individual files can also be run by calling `pytest tests/.py`. +# Example Run Script For Landau Damping + import numpy as np + from vlapy import manager, initializers + from vlapy.infrastructure import mlflow_helpers, print_to_screen + from vlapy.diagnostics import landau_damping + + if __name__ == "__main__": + # Pick a random wavenumber + k0 = np.random.uniform(0.3, 0.4, 1)[0] + + # This is a collisionless simulation. Provide float value if collisions should be simulated + log_nu_over_nu_ld = None + + # This initializes the default parameters + all_params_dict = initializers.make_default_params_dictionary() + + # This calculates the roots to the EPW dispersion relation given the wavenumber + all_params_dict = initializers.specify_epw_params_to_dict( + k0=k0, all_params_dict=all_params_dict + ) + + # This specifies the collision frequency given nu_ld + all_params_dict = initializers.specify_collisions_to_dict( + log_nu_over_nu_ld=log_nu_over_nu_ld, all_params_dict=all_params_dict + ) + + # The solvers can be chosen here + all_params_dict["vlasov-poisson"]["time"] = "leapfrog" + all_params_dict["vlasov-poisson"]["edfdv"] = "exponential" + all_params_dict["vlasov-poisson"]["vdfdx"] = "exponential" + + all_params_dict["fokker-planck"]["type"] = "lb" + all_params_dict["fokker-planck"]["type"] = "batched_tridiagonal" + + # The pulse shape can be chosen here + pulse_dictionary = { + "first pulse": { + "start_time": 0, + "t_L": 6, + "t_wL": 2.5, + "t_R": 20, + "t_wR": 2.5, + "w0": all_params_dict["w_epw"], + "a0": 1e-7, + "k0": k0, + } + } + + # Mlflow experiment name and location + mlflow_exp_name = "landau-damping" + + # Either an IP address for your MLflow server or "local" if no server specified + uris = { + "tracking": "local", + } + + + # Start! + that_run = manager.start_run( + all_params=all_params_dict, + pulse_dictionary=pulse_dictionary, + diagnostics=landau_damping.LandauDamping( + vph=all_params_dict["v_ph"], + wepw=all_params_dict["w_epw"], + ), + uris=uris, + name=mlflow_exp_name, + ) + + # Assess if the simulation results match the actual damping rate + print( + mlflow_helpers.get_this_metric_of_this_run("damping_rate", that_run), + all_params_dict["nu_ld"], + ) + + + # Acknowledgements We use xarray [@Hoyer2017] for file storage and MLFlow [@Chen2020] for experiment management. diff --git a/run_debug.py b/run_debug.py index d4738fa..f4f1295 100644 --- a/run_debug.py +++ b/run_debug.py @@ -42,13 +42,9 @@ all_params_dict["vlasov-poisson"]["edfdv"] = "exponential" all_params_dict["vlasov-poisson"]["vdfdx"] = "exponential" - all_params_dict["backend"]["core"] = "numpy" - all_params_dict["backend"]["max_GB_for_device"] = 1 - all_params_dict["fokker-planck"]["type"] = "lb" all_params_dict["fokker-planck"]["type"] = "batched_tridiagonal" - pulse_dictionary = { "first pulse": { "start_time": 0, @@ -68,10 +64,6 @@ "tracking": "local", } - print_to_screen.print_startup_message( - mlflow_exp_name, all_params_dict, pulse_dictionary - ) - that_run = manager.start_run( all_params=all_params_dict, pulse_dictionary=pulse_dictionary, diff --git a/run_nlepw.py b/run_nlepw.py index a78aa3d..571c649 100644 --- a/run_nlepw.py +++ b/run_nlepw.py @@ -23,7 +23,6 @@ import numpy as np from vlapy import manager, initializers -from vlapy.infrastructure import mlflow_helpers, print_to_screen from vlapy.diagnostics import nlepw if __name__ == "__main__": @@ -47,13 +46,6 @@ all_params_dict["vlasov-poisson"]["edfdv"] = "exponential" all_params_dict["vlasov-poisson"]["vdfdx"] = "exponential" - all_params_dict["backend"]["core"] = "numpy" - all_params_dict["backend"]["max_GB_for_device"] = 0.25 - - all_params_dict["fokker-planck"]["type"] = "lb" - all_params_dict["fokker-planck"]["solver"] = "batched_tridiagonal" - - pulse_dictionary = { "first pulse": { "start_time": 0, @@ -73,10 +65,6 @@ "tracking": "local", } - print_to_screen.print_startup_message( - mlflow_exp_name, all_params_dict, pulse_dictionary - ) - that_run = manager.start_run( all_params=all_params_dict, pulse_dictionary=pulse_dictionary, @@ -87,4 +75,3 @@ uris=uris, name=mlflow_exp_name, ) - diff --git a/run_vlapy.py b/run_vlapy.py index d4738fa..fea5836 100644 --- a/run_vlapy.py +++ b/run_vlapy.py @@ -23,7 +23,7 @@ import numpy as np from vlapy import manager, initializers -from vlapy.infrastructure import mlflow_helpers, print_to_screen +from vlapy.infrastructure import mlflow_helpers from vlapy.diagnostics import landau_damping if __name__ == "__main__": @@ -42,13 +42,9 @@ all_params_dict["vlasov-poisson"]["edfdv"] = "exponential" all_params_dict["vlasov-poisson"]["vdfdx"] = "exponential" - all_params_dict["backend"]["core"] = "numpy" - all_params_dict["backend"]["max_GB_for_device"] = 1 - all_params_dict["fokker-planck"]["type"] = "lb" all_params_dict["fokker-planck"]["type"] = "batched_tridiagonal" - pulse_dictionary = { "first pulse": { "start_time": 0, @@ -68,10 +64,6 @@ "tracking": "local", } - print_to_screen.print_startup_message( - mlflow_exp_name, all_params_dict, pulse_dictionary - ) - that_run = manager.start_run( all_params=all_params_dict, pulse_dictionary=pulse_dictionary, diff --git a/vlapy/infrastructure/print_to_screen.py b/vlapy/infrastructure/print_to_screen.py index 6a06282..40705af 100644 --- a/vlapy/infrastructure/print_to_screen.py +++ b/vlapy/infrastructure/print_to_screen.py @@ -24,11 +24,12 @@ from datetime import datetime -def print_startup_message(exp_name, all_params_dict, pulse_dictionary): +def print_startup_message(exp_name, all_params_dict, pulse_dictionary, uri): print("Starting VlaPy at " + datetime.now().strftime("%m/%d/%Y %H:%M:%S")) print("MLFlow experiment name: " + exp_name) print("Run parameters: ") pprint.pprint(all_params_dict) print("Driver parameters: ") pprint.pprint(pulse_dictionary) - print() + print("MLFlow server?") + pprint.pprint(uri) diff --git a/vlapy/manager.py b/vlapy/manager.py index 62550ae..3df95b7 100644 --- a/vlapy/manager.py +++ b/vlapy/manager.py @@ -29,6 +29,7 @@ import numpy as np from vlapy import storage, outer_loop +from vlapy.infrastructure import print_to_screen def start_run(all_params, pulse_dictionary, diagnostics, uris, name="test"): @@ -46,8 +47,9 @@ def start_run(all_params, pulse_dictionary, diagnostics, uris, name="test"): :param name: (string) the name of the MLFlow experiment :return: (Mlflow.Run) returns the completed Run object """ - t0 = time() + t0 = time() + print_to_screen.print_startup_message(name, all_params, pulse_dictionary) if "local" not in uris["tracking"].casefold(): mlflow.set_tracking_uri(uris["tracking"]) From 998ff9664c6849d7b8bf50ab77d9ed5dde4def53 Mon Sep 17 00:00:00 2001 From: Archis Joglekar Date: Sat, 12 Sep 2020 16:49:20 -0700 Subject: [PATCH 4/8] type -> solver --- paper/paper.md | 2 +- run_debug.py | 2 +- run_vlapy.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/paper/paper.md b/paper/paper.md index 9f0d986..7cef7bd 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -214,7 +214,7 @@ To run the entire testing suite, make sure `pytest` is installed, and call `pyte all_params_dict["vlasov-poisson"]["vdfdx"] = "exponential" all_params_dict["fokker-planck"]["type"] = "lb" - all_params_dict["fokker-planck"]["type"] = "batched_tridiagonal" + all_params_dict["fokker-planck"]["solver"] = "batched_tridiagonal" # The pulse shape can be chosen here pulse_dictionary = { diff --git a/run_debug.py b/run_debug.py index f4f1295..3f04351 100644 --- a/run_debug.py +++ b/run_debug.py @@ -43,7 +43,7 @@ all_params_dict["vlasov-poisson"]["vdfdx"] = "exponential" all_params_dict["fokker-planck"]["type"] = "lb" - all_params_dict["fokker-planck"]["type"] = "batched_tridiagonal" + all_params_dict["fokker-planck"]["solver"] = "batched_tridiagonal" pulse_dictionary = { "first pulse": { diff --git a/run_vlapy.py b/run_vlapy.py index fea5836..e9b99af 100644 --- a/run_vlapy.py +++ b/run_vlapy.py @@ -43,7 +43,7 @@ all_params_dict["vlasov-poisson"]["vdfdx"] = "exponential" all_params_dict["fokker-planck"]["type"] = "lb" - all_params_dict["fokker-planck"]["type"] = "batched_tridiagonal" + all_params_dict["fokker-planck"]["solver"] = "batched_tridiagonal" pulse_dictionary = { "first pulse": { From b717cb409fdb97430ac8ca6bd7772b11630862bf Mon Sep 17 00:00:00 2001 From: Archis Joglekar Date: Sat, 12 Sep 2020 16:53:12 -0700 Subject: [PATCH 5/8] uri --- vlapy/infrastructure/print_to_screen.py | 2 +- vlapy/manager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vlapy/infrastructure/print_to_screen.py b/vlapy/infrastructure/print_to_screen.py index 40705af..4ef7b30 100644 --- a/vlapy/infrastructure/print_to_screen.py +++ b/vlapy/infrastructure/print_to_screen.py @@ -31,5 +31,5 @@ def print_startup_message(exp_name, all_params_dict, pulse_dictionary, uri): pprint.pprint(all_params_dict) print("Driver parameters: ") pprint.pprint(pulse_dictionary) - print("MLFlow server?") + print("MLFlow server: ") pprint.pprint(uri) diff --git a/vlapy/manager.py b/vlapy/manager.py index 3df95b7..5d1d625 100644 --- a/vlapy/manager.py +++ b/vlapy/manager.py @@ -49,7 +49,7 @@ def start_run(all_params, pulse_dictionary, diagnostics, uris, name="test"): """ t0 = time() - print_to_screen.print_startup_message(name, all_params, pulse_dictionary) + print_to_screen.print_startup_message(name, all_params, pulse_dictionary, uris) if "local" not in uris["tracking"].casefold(): mlflow.set_tracking_uri(uris["tracking"]) From 3c942cda1b0bdef41656339b56aa2bfae7799681 Mon Sep 17 00:00:00 2001 From: Archis Joglekar Date: Sat, 12 Sep 2020 16:57:05 -0700 Subject: [PATCH 6/8] uri --- tests/test_landau_damping.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/test_landau_damping.py b/tests/test_landau_damping.py index 480f0d9..9ac7ebb 100644 --- a/tests/test_landau_damping.py +++ b/tests/test_landau_damping.py @@ -84,10 +84,6 @@ def __run_integrated_landau_damping_test_and_return_damping_rate__( "tracking": "local", } - print_to_screen.print_startup_message( - mlflow_exp_name, all_params_dict, pulse_dictionary - ) - that_run = manager.start_run( all_params=all_params_dict, pulse_dictionary=pulse_dictionary, From b5ebaf6dc70baaf5afe13009f5cc62d6c30de925 Mon Sep 17 00:00:00 2001 From: Archis Joglekar Date: Sat, 12 Sep 2020 16:57:41 -0700 Subject: [PATCH 7/8] circle ci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cc2d2a2..8da653d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: build: # Run the steps with Docker docker: - - image: cimg/python:3.7 + - image: cimg/python:3.8 # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images From 758c63ced4c4c542d26f1e88792ff64aad99fd5b Mon Sep 17 00:00:00 2001 From: Archis Joglekar Date: Sat, 12 Sep 2020 17:10:20 -0700 Subject: [PATCH 8/8] version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 560ef05..f00c9d9 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ setup( name="vlapy", - version="1.0", + version="0.1", packages=find_packages(), url="", license="MIT",