def main(xls_file, start_cmd, end_cmd, cleanmr): if start_cmd: assert end_cmd is not None, "Wrong input" if end_cmd: assert start_cmd is not None, "Wrong input" if cleanmr: os.system("cleanmr") if start_cmd: os.system(start_cmd) srtml.init() df = pd.read_excel(xls_file, sheet_name="Model Raw Profile") for index, row in df.iterrows(): pgraph = create_pgraph(df.loc[index, "Model Name"]) profile_dict = convert_profiles_to_regression_models( json.loads(df.loc[index, "raw profile"])) dinfo = DATASET_INFORMATION( **json.loads(df.loc[index, "Dataset Information"])) pgraph.submit( df.loc[index, "Accuracy"], dinfo, df.loc[index, "feature"], profile_dict, ) shutdown() if end_cmd: os.system(end_cmd)
def main(xls_file, start_cmd, end_cmd): if start_cmd: os.system(start_cmd) srtml.init() df = pd.read_excel(xls_file, sheet_name="Arrival Information") columns = [ "mu (qps)", "cv", "# requests", "Latency Constraint (ms)", "Planner", "configuration", "Estimated Latency (ms)", "Cost", "Accuracy", ] new_df = pd.DataFrame(columns=columns) for index, row in df.iterrows(): row_df = {columns[i]: df.loc[index, columns[i]] for i in range(5)} with VGraph(name="classifier") as graph: classifier = Classifier( feature=IMAGE_CLASSIFICATION_FEATURE, dataset_information=dinfo, name="VClassifier", ) arrival_curve = generate_fixed_arrival_process( mean_qps=df.loc[index, columns[0]], cv=df.loc[index, columns[1]], num_requests=df.loc[index, columns[2]], ).tolist() config = graph.configure( throughput_qps_constraint=df.loc[index, columns[0]], latency_ms_constraint=df.loc[index, columns[3]], planner_kwargs={"inter_arrival_process": arrival_curve}, planner_cls=PLANNER_CLS.get(df.loc[index, columns[4]], None), print_state=True, materialize=False, ) estimated_values = graph.state.get_estimate_values()._asdict() row_df["configuration"] = json.dumps(config) row_df["Estimated Latency (ms)"] = estimated_values["latency"] row_df["Cost"] = estimated_values["cost"] row_df["Accuracy"] = estimated_values["accuracy"] new_df = new_df.append(row_df, ignore_index=True) shutdown() if end_cmd: os.system(end_cmd) with pd.ExcelWriter(xls_file, mode="a") as writer: new_df.to_excel(writer, sheet_name="Planner Configuration")
def main(xls_file, start_cmd, end_cmd): if start_cmd: assert end_cmd is not None, "Wrong input" if end_cmd: assert start_cmd is not None, "Wrong input" df = pd.read_excel(xls_file, sheet_name="Model Information") clean_profile_df = pd.DataFrame() raw_profile_df = pd.DataFrame(columns=[ "pgraph", "raw profile", "Dataset Information", "feature", "Model Name", "Accuracy", "sysinfo", ]) for index, row in df.iterrows(): if start_cmd: os.system(start_cmd) srtml.init() # profile_df = pd.DataFrame( # columns=[ # "pgraph" # ] # ) pgraph = create_pgraph(df.loc[index, "Model Name"]) profile_dict = profile_pgraph( pgraph, **json.loads(df.loc[index, "profile configuration"])) pprint(profile_dict) clean_profile_df = pd.concat([ clean_profile_df, get_dataframe_from_profile(pgraph.ppu_identifier, profile_dict), ]) raw_profile_df = raw_profile_df.append( { "pgraph": pgraph.ppu_identifier, "raw profile": json.dumps(profile_dict), "Dataset Information": df.loc[index, "Dataset Information"], "feature": df.loc[index, "feature"], "Model Name": df.loc[index, "Model Name"], "Accuracy": df.loc[index, "Accuracy"], "sysinfo": get_sysinfo(), }, ignore_index=True, ) shutdown() if end_cmd: os.system(end_cmd) with pd.ExcelWriter(xls_file, mode="a") as writer: clean_profile_df.to_excel(writer, sheet_name="Model Profile") raw_profile_df.to_excel(writer, sheet_name="Model Raw Profile")
def main(xls_file, start_cmd, end_cmd, cleanmr): if start_cmd: assert end_cmd is not None, "Wrong input" if end_cmd: assert start_cmd is not None, "Wrong input" if cleanmr: os.system("cleanmr") if start_cmd: os.system(start_cmd) ray_serve_kwargs = { "ray_init_kwargs": { "object_store_memory": int(5e10), "num_cpus": 24, "_internal_config": json.dumps({ "max_direct_call_object_size": 1000 * 1024 * 1024, # 10Mb "max_grpc_message_size": 10000 * 1024 * 1024, # 100Mb }), # "resources": resources, }, "start_server": False, } srtml.init() df = pd.read_excel(xls_file, sheet_name="Model Raw Profile") for index, row in df.iterrows(): pgraph = create_pgraph(df.loc[index, "Model Name"]) profile_dict = convert_profiles_to_regression_models( json.loads(df.loc[index, "raw profile"])) dinfo = DATASET_INFORMATION( **json.loads(df.loc[index, "Dataset Information"])) pgraph.submit( df.loc[index, "Accuracy"], dinfo, df.loc[index, "feature"], profile_dict, ) shutdown() if end_cmd: os.system(end_cmd)
is_cuda=True, ) # connection # prepoc >> model_2 return graph ray_serve_kwargs = { "ray_init_kwargs": { "object_store_memory": int(5e10), "num_cpus": 24, "_internal_config": json.dumps({ "max_direct_call_object_size": 10000 * 1024 * 1024, # 10Mb "max_grpc_message_size": 100000 * 1024 * 1024, # 100Mb }), # "resources": resources, }, "start_server": False, } srtml.init(ray_serve_kwargs=ray_serve_kwargs) graph = create_pgraph() graph.configure(SERVE_MODE) graph.provision(SERVE_MODE) s = {"warmup": 2, "num_requests": 5, "percentile": 99} pprint(profile_pgraph(graph, **s))