Skip to content

Commit

Permalink
add remote handling code eventhough it seems to be missing something
Browse files Browse the repository at this point in the history
  • Loading branch information
gadfort committed Jul 10, 2023
1 parent 68fd93c commit 0615ff9
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions scgallery/gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import shutil
import argparse
import sys
import threading
import time

import siliconcompiler
from siliconcompiler.targets import asap7_demo, freepdk45_demo, skywater130_demo
Expand Down Expand Up @@ -228,12 +230,69 @@ def run(self):

self.__errors.clear()

regular_jobs = []
runner_jobs = []

for design in self.__run_config['designs']:
if design not in self.__designs:
print(' Error: design is not available in gallery')
continue

if self.__design_has_runner(design):
runner_jobs.append({'print': f'Running "{design}"',
"module": design})
else:
for target in self.__run_config['targets']:
chip, valid = self.__setup_design(design, target)
if not valid:
continue
regular_jobs.append({'print': f'Running "{design}" with "{target}"',
"module": design,
"chip": chip})

if self.__remote:
def _run_remote(chip, design):
chip = self.__run_design(chip)
self.__finalize(design, chip)

jobs = [threading.Thread(
target=_run_remote,
args=(job['chip'], job['module']))
for job in regular_jobs]

# Submit jobs in parallel
for job in jobs:
job.start()
time.sleep(30)

# Wait
for job in jobs:
job.join()
else:
for job in regular_jobs:
chip = job['chip']
design = job['module']

print(job['print'])
chip = self.__run_design(chip)
self.__finalize(design, chip)

for job in runner_jobs:
print(job['print'])
run = getattr(job['module'], 'run')
try:
chip = run()
self.__finalize(design, chip)
except Exception:
pass

for design in self.__run_config['designs']:
if design not in self.__designs:
print(' Error: design is not available in gallery')
continue

if self.__design_has_runner(design):
runner_jobs.append({"name": design})
print(f'Running "{design}"')
run = getattr(design, 'run')
try:
Expand Down

0 comments on commit 0615ff9

Please sign in to comment.