Commit 7549fa9e authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

pre-commit run -a

parent aac98df8
...@@ -23,15 +23,16 @@ ...@@ -23,15 +23,16 @@
# Allow own class to be used as type for a method's argument # Allow own class to be used as type for a method's argument
from __future__ import annotations from __future__ import annotations
from abc import ABCMeta, abstractmethod
import shutil
import pathlib import pathlib
import shutil
import typing as tp import typing as tp
from abc import ABCMeta, abstractmethod
import simbricks.exectools as exectools
from simbricks.experiment.experiment_environment import ExpEnv from simbricks.experiment.experiment_environment import ExpEnv
from simbricks.experiment.experiment_output import ExpOutput from simbricks.experiment.experiment_output import ExpOutput
from simbricks.experiments import Experiment from simbricks.experiments import Experiment
import simbricks.exectools as exectools
class Run(object): class Run(object):
......
...@@ -23,12 +23,15 @@ ...@@ -23,12 +23,15 @@
import asyncio import asyncio
import pathlib import pathlib
import simbricks.proxy as proxy
from simbricks.exectools import Executor from simbricks.exectools import Executor
from simbricks.runtime.common import * from simbricks.runtime.common import *
import simbricks.experiments as exp import simbricks.experiments as exp
import simbricks.proxy as proxy
class DistributedSimpleRuntime(Runtime): class DistributedSimpleRuntime(Runtime):
def __init__(self, execs, verbose=False): def __init__(self, execs, verbose=False):
self.runnable = [] self.runnable = []
self.complete = [] self.complete = []
...@@ -42,8 +45,9 @@ class DistributedSimpleRuntime(Runtime): ...@@ -42,8 +45,9 @@ class DistributedSimpleRuntime(Runtime):
self.runnable.append(run) self.runnable.append(run)
async def do_run(self, run: Run): async def do_run(self, run: Run):
runner = exp.ExperimentDistributedRunner(self.execs, run.experiment, runner = exp.ExperimentDistributedRunner(
run.env, self.verbose) self.execs, run.experiment, run.env, self.verbose
)
for exec in self.execs: for exec in self.execs:
await run.prep_dirs(exec) await run.prep_dirs(exec)
await runner.prepare() await runner.prepare()
...@@ -62,9 +66,11 @@ class DistributedSimpleRuntime(Runtime): ...@@ -62,9 +66,11 @@ class DistributedSimpleRuntime(Runtime):
def auto_dist( def auto_dist(
e: Experiment, execs: tp.List[Executor], proxy_type: str = 'sockets' e: Experiment, execs: tp.List[Executor], proxy_type: str = 'sockets'
): ):
""" Converts an Experiment into a DistributedExperiment. Assigns network to """
executor zero, and then round-robin assignment of hosts to executors, Converts an Experiment into a DistributedExperiment.
while also assigning all nics for a host to the same executor.
Assigns network to executor zero, and then round-robin assignment of hosts
to executors, while also assigning all nics for a host to the same executor.
""" """
if len(execs) < 2: if len(execs) < 2:
......
...@@ -24,9 +24,10 @@ import asyncio ...@@ -24,9 +24,10 @@ import asyncio
import pathlib import pathlib
from typing import Optional from typing import Optional
import simbricks.exectools as exectools
from simbricks.runtime.common import * from simbricks.runtime.common import *
import simbricks.experiments as exp import simbricks.experiments as exp
import simbricks.exectools as exectools
class LocalSimpleRuntime(Runtime): class LocalSimpleRuntime(Runtime):
......
...@@ -20,14 +20,16 @@ ...@@ -20,14 +20,16 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import pickle
import os import os
import pathlib import pathlib
import pickle
import re import re
from simbricks.runtime.common import * from simbricks.runtime.common import *
class SlurmRuntime(Runtime): class SlurmRuntime(Runtime):
def __init__(self, slurmdir, args, verbose=False, cleanup=True): def __init__(self, slurmdir, args, verbose=False, cleanup=True):
self.runnable = [] self.runnable = []
self.slurmdir = slurmdir self.slurmdir = slurmdir
......
...@@ -23,9 +23,10 @@ ...@@ -23,9 +23,10 @@
import typing as tp import typing as tp
from simbricks.nodeconfig import AppConfig, NodeConfig
from simbricks.simulators import HostSim, I40eMultiNIC, NetSim, NICSim
from simbricks.experiments import Experiment from simbricks.experiments import Experiment
from simbricks.nodeconfig import NodeConfig, AppConfig
from simbricks.simulators import NetSim, NICSim, HostSim, I40eMultiNIC
def create_basic_hosts( def create_basic_hosts(
...@@ -40,7 +41,9 @@ def create_basic_hosts( ...@@ -40,7 +41,9 @@ def create_basic_hosts(
ip_start: int = 1, ip_start: int = 1,
ip_prefix: int = 24 ip_prefix: int = 24
): ):
"""Creates and configures multiple hosts to be simulated using the given parameters. """
Creates and configures multiple hosts to be simulated using the given
parameters.
Args: Args:
`num`: number of hosts to create `num`: number of hosts to create
...@@ -82,7 +85,9 @@ def create_multinic_hosts( ...@@ -82,7 +85,9 @@ def create_multinic_hosts(
ip_start: int = 1, ip_start: int = 1,
ip_prefix: int = 24 ip_prefix: int = 24
): ):
"""Creates and configures multiple hosts to be simulated using the given parameters. These hosts use multiple NICs. """
Creates and configures multiple hosts to be simulated using the given
parameters. These hosts use multiple NICs.
Args: Args:
num: number of hosts to create num: number of hosts to create
...@@ -130,7 +135,9 @@ def create_dctcp_hosts( ...@@ -130,7 +135,9 @@ def create_dctcp_hosts(
mtu: int, mtu: int,
ip_start: int = 1 ip_start: int = 1
): ):
"""Creates and configures multiple hosts to be simulated in a DCTCP experiment using the given parameters. """
Creates and configures multiple hosts to be simulated in a DCTCP experiment
using the given parameters.
Args: Args:
num: number of hosts to create num: number of hosts to create
......
This diff is collapsed.
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import sys import json
import os import os
import pathlib import pathlib
import shutil import shutil
import json import sys
if len(sys.argv) != 2: if len(sys.argv) != 2:
print('Usage: udp_scale.py OUTDIR') print('Usage: udp_scale.py OUTDIR')
...@@ -43,12 +43,10 @@ for cl in types_of_client: ...@@ -43,12 +43,10 @@ for cl in types_of_client:
diff_time = '' diff_time = ''
else: else:
exp_log = json.load(log) exp_log = json.load(log)
start_time = exp_log["start_time"] start_time = exp_log['start_time']
end_time = exp_log["end_time"] end_time = exp_log['end_time']
diff_time = (end_time - start_time)/60 #min diff_time = (end_time - start_time) / 60 #min
diff_time = str(diff_time) diff_time = str(diff_time)
log.close() log.close()
print('%d\t%s' % (cl, diff_time)) print('%d\t%s' % (cl, diff_time))
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import sys import json
import math
import os import os
import pathlib import pathlib
import shutil import shutil
import json import sys
import math
num_runs = 3 num_runs = 3
if len(sys.argv) != 2: if len(sys.argv) != 2:
...@@ -42,14 +42,14 @@ for bw in types_of_bw: ...@@ -42,14 +42,14 @@ for bw in types_of_bw:
avg_time = 0 avg_time = 0
std = 0 std = 0
all_time = [] all_time = []
for i in range(1, num_runs+1): for i in range(1, num_runs + 1):
log_path = '%sgt-ib-sw-Load-%dm-%d.json' % (basedir, bw, i) log_path = '%sgt-ib-sw-Load-%dm-%d.json' % (basedir, bw, i)
if os.path.exists(log_path): if os.path.exists(log_path):
log = open(log_path, 'r') log = open(log_path, 'r')
exp_log = json.load(log) exp_log = json.load(log)
start_time = exp_log["start_time"] start_time = exp_log['start_time']
end_time = exp_log["end_time"] end_time = exp_log['end_time']
diff_time = (end_time - start_time)/60 #min diff_time = (end_time - start_time) / 60 #min
total_time += diff_time total_time += diff_time
all_time.append(diff_time) all_time.append(diff_time)
diff_time = str(diff_time) diff_time = str(diff_time)
...@@ -60,16 +60,13 @@ for bw in types_of_bw: ...@@ -60,16 +60,13 @@ for bw in types_of_bw:
#print('%d\t%s' % (bw, diff_time)) #print('%d\t%s' % (bw, diff_time))
avg_time = total_time/num_runs avg_time = total_time / num_runs
#print('avg_time: ' + str(avg_time)) #print('avg_time: ' + str(avg_time))
for i in range(0, num_runs): for i in range(0, num_runs):
std += (all_time[i] - avg_time) * (all_time[i] - avg_time) std += (all_time[i] - avg_time) * (all_time[i] - avg_time)
std = std/num_runs std = std / num_runs
std = math.sqrt(std) std = math.sqrt(std)
#print(str(std)) #print(str(std))
print('%d %s %f' % (bw, avg_time, std)) print('%d %s %f' % (bw, avg_time, std))
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment