GithubHelp home page GithubHelp logo

grid's Introduction

GRID

Install

pip install git+https://github.com/mariogeiger/grid

or in local

python setup.py install

Usage

Save results

The file example.py is a minimal script that can be used with grid.

python -m grid results "python example.py" --a 1 2 3 --b 5 6 7

All the combination of (1, 2, 3) and (5, 6, 7) are executed in simultaneously

[results/504721.pk a=1 b=5] python example.py --output results/504721.pk --a 1 --b 5
[results/956440.pk a=1 b=6] python example.py --output results/956440.pk --a 1 --b 6
[results/352305.pk a=1 b=7] python example.py --output results/352305.pk --a 1 --b 7
[results/839715.pk a=2 b=5] python example.py --output results/839715.pk --a 2 --b 5
[results/484878.pk a=2 b=6] python example.py --output results/484878.pk --a 2 --b 6
[results/598464.pk a=2 b=7] python example.py --output results/598464.pk --a 2 --b 7
[results/547794.pk a=3 b=5] python example.py --output results/547794.pk --a 3 --b 5
[results/451796.pk a=3 b=6] python example.py --output results/451796.pk --a 3 --b 6
[results/208445.pk a=3 b=7] python example.py --output results/208445.pk --a 3 --b 7
[results/504721.pk a=1 b=5] computation 1 / 3
[results/352305.pk a=1 b=7] computation 1 / 3
[results/956440.pk a=1 b=6] computation 1 / 3
[results/839715.pk a=2 b=5] computation 1 / 3
[results/484878.pk a=2 b=6] computation 1 / 3
[results/598464.pk a=2 b=7] computation 1 / 3
[results/547794.pk a=3 b=5] computation 1 / 3
[results/451796.pk a=3 b=6] computation 1 / 3
[results/208445.pk a=3 b=7] computation 1 / 3
[results/504721.pk a=1 b=5] computation 2 / 3
[results/352305.pk a=1 b=7] computation 2 / 3
[results/956440.pk a=1 b=6] computation 2 / 3
[results/839715.pk a=2 b=5] computation 2 / 3
[results/484878.pk a=2 b=6] computation 2 / 3
[results/598464.pk a=2 b=7] computation 2 / 3
[results/547794.pk a=3 b=5] computation 2 / 3
[results/451796.pk a=3 b=6] computation 2 / 3
[results/208445.pk a=3 b=7] computation 2 / 3
[results/504721.pk a=1 b=5] computation 3 / 3
[results/352305.pk a=1 b=7] computation 3 / 3
[results/956440.pk a=1 b=6] computation 3 / 3
[results/839715.pk a=2 b=5] computation 3 / 3
[results/504721.pk a=1 b=5] terminated
[results/352305.pk a=1 b=7] terminated
[results/956440.pk a=1 b=6] terminated
[results/839715.pk a=2 b=5] terminated
[results/484878.pk a=2 b=6] computation 3 / 3
[results/484878.pk a=2 b=6] terminated
[results/598464.pk a=2 b=7] computation 3 / 3
[results/598464.pk a=2 b=7] terminated
[results/547794.pk a=3 b=5] computation 3 / 3
[results/451796.pk a=3 b=6] computation 3 / 3
[results/208445.pk a=3 b=7] computation 3 / 3
[results/547794.pk a=3 b=5] terminated
[results/451796.pk a=3 b=6] terminated
[results/208445.pk a=3 b=7] terminated
python -m grid results "python example.py" --a 1 2 3 --b 5 6 7 8

The results already done are not executed again

[a=1 b=5] results/504721.pk
[a=1 b=6] results/956440.pk
[a=1 b=7] results/352305.pk
[results/984090.pk a=1 b=8] python example.py --output results/984090.pk --a 1 --b 8
[a=2 b=5] results/839715.pk
[a=2 b=6] results/484878.pk
[a=2 b=7] results/598464.pk
[results/462733.pk a=2 b=8] python example.py --output results/462733.pk --a 2 --b 8
[a=3 b=5] results/547794.pk
[a=3 b=6] results/451796.pk
[a=3 b=7] results/208445.pk
[results/176846.pk a=3 b=8] python example.py --output results/176846.pk --a 3 --b 8
[results/984090.pk a=1 b=8] computation 1 / 3
[results/462733.pk a=2 b=8] computation 1 / 3
[results/176846.pk a=3 b=8] computation 1 / 3
[results/984090.pk a=1 b=8] computation 2 / 3
[results/462733.pk a=2 b=8] computation 2 / 3
[results/176846.pk a=3 b=8] computation 2 / 3
[results/984090.pk a=1 b=8] computation 3 / 3
[results/462733.pk a=2 b=8] computation 3 / 3
[results/176846.pk a=3 b=8] computation 3 / 3
[results/462733.pk a=2 b=8] terminated
[results/984090.pk a=1 b=8] terminated
[results/176846.pk a=3 b=8] terminated

Example: using slurm and only varying parameter b

python -m grid results "srun --partition gpu --qos gpu --gres gpu:1 --time 3-00:00:00 --mem 12G --pty python example.py --a 4" --b:int 5 6 7

Load results

from grid import load

runs = load('./results/')
print('{} results loaded'.format(len(runs)))

Load in groups

from grid import load_grouped
import matplotlib.pyplot as plt

args, groups = load_grouped('./results/', ['b'])

for param, rs in groups:
    rs = sorted(rs, key=lambda r: r['args'].b)
    label = "a={0[a]}".format(param)
    plt.plot([r['args'].b for r in rs], [r['division'] for r in rs], label=label)

Optional arguments

--n N maximum number of job running in the same time

--sleep S time to sleep in seconds between two job launch

Subcommands

  • pyhton -m grid.clean log_dir remove files with no content (typically resultant of interrupted runs)
  • pyhton -m grid.merge log_dir_src log_dir_dst
  • pyhton -m grid.info log_dir

grid's People

Contributors

mariogeiger avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

leventsagun

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.