Skip to content
Snippets Groups Projects
Commit 1c62596d authored by Joachim Reif's avatar Joachim Reif
Browse files

Implement shell commands.

parent 405048ae
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -30,10 +30,14 @@ from django.core.exceptions import ValidationError
FOLDER_PATH = Path.cwd().parents[0] / "textfiles"
SETTINGS_FILE = "config.yaml"
SOURCE_PATH = str(Path.cwd().parents[1])
OUTPUT_PATH = str(Path.cwd().parents[1] / "output")
BOARDS_LIST = []
number_of_time_steps = 0
@login_required
def base_view(request):
......@@ -83,6 +87,8 @@ def write_data_to_configfile(data):
configuration["Scheduler"].update({"Syncs per Timestep": int(data["syncsPerTimeStep"])})
configuration["Scheduler"].update({"Timestep Limit": int(data["timestepLimit"])})
number_of_time_steps = int(data["timestepLimit"])
neuron_dict = configuration["Neuron"]
#Set Params
......@@ -176,11 +182,13 @@ def get_surounding_boards(board_list):
ret.extend([r[cur_pos+1] for r in BOARDS_LIST[top_left_corner[0]: bottom_right_corner[0]+1]])
print(ret)
#print(ret)
return ret
def initCluster(boardList):
print("Boards: {}".format(boardList))
#print(f"{Path.cwd().parents[1]=}")
#print("Boards: {}".format(boardList))
#source_path = str(Path.cwd().parents[1])
row = None
for l in BOARDS_LIST:
......@@ -196,11 +204,18 @@ def initCluster(boardList):
surrounding_boards = get_surounding_boards(boardList)
boards = " ".join(boardList) + " ".join(surrounding_boards)
command = "./fpga.sh --targets "+boards+" --program develop"
boards = "{} {}".format(" ".join(boardList), " ".join(surrounding_boards))
command = " ".join(["cd", SOURCE_PATH, "&&" , "./fpga.sh --targets", boards, "--program develop"])
print(command)
#os.popen(command)
command = " ".join(["cd", SOURCE_PATH, "&&", "./fpga.sh --targets", " ".join(boardList), "--upload embedded"])
print(command)
command = "./fpga.sh --targets "+" ".join(boardList)+" --upload embedded"
#os.popen(command)
command = " ".join(["cd", SOURCE_PATH, "&&", "export TARGET="+main_node])
print(command)
#os.popen(command)
# command = " ".join(["cd", SOURCE_PATH, "&&", "./fpga.sh --targets", boards, "--program develop", "&&", "./fpga.sh --targets", " ".join(boardList), "--upload embedded", "&&" , "export TARGET="+main_node, "&&"])
......@@ -212,7 +227,12 @@ def start_simulation(request):
validate_start_message(message)
except ValidationError:
return HttpResponse("incorrect startmessage", status=400)
calculate_metrics()
command = " ".join(["cd", SOURCE_PATH, "&&", "./sim", str(number_of_time_steps), "src/sw/examples/n_rand_neurons.py --neurons 32 --init"])
print(command)
#os.popen(command)
#calculate_metrics()
#return HttpResponse(True, status=200)
url = "http://{0}{1}".format(get_current_site(request), reverse("output:output"));
return HttpResponse(url, status=200)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment