Skip to content

Commit

Permalink
Merge pull request #92 from joglekara/paper
Browse files Browse the repository at this point in the history
JOSS paper updates
  • Loading branch information
joglekara authored Sep 13, 2020
2 parents 1c24c96 + 758c63c commit c12eb0d
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions paper/paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
81 changes: 79 additions & 2 deletions paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,92 @@ 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)

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/<test_filename>.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"]["solver"] = "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 [@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.

Expand Down
10 changes: 1 addition & 9 deletions run_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,8 @@
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"

all_params_dict["fokker-planck"]["solver"] = "batched_tridiagonal"

pulse_dictionary = {
"first pulse": {
Expand All @@ -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,
Expand Down
13 changes: 0 additions & 13 deletions run_nlepw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -87,4 +75,3 @@
uris=uris,
name=mlflow_exp_name,
)

12 changes: 2 additions & 10 deletions run_vlapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand All @@ -42,12 +42,8 @@
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"

all_params_dict["fokker-planck"]["solver"] = "batched_tridiagonal"

pulse_dictionary = {
"first pulse": {
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

setup(
name="vlapy",
version="1.0",
version="0.1",
packages=find_packages(),
url="",
license="MIT",
Expand Down
4 changes: 0 additions & 4 deletions tests/test_landau_damping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions vlapy/infrastructure/print_to_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 3 additions & 1 deletion vlapy/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand All @@ -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, uris)
if "local" not in uris["tracking"].casefold():
mlflow.set_tracking_uri(uris["tracking"])

Expand Down

0 comments on commit c12eb0d

Please sign in to comment.