Skip to content

Commit

Permalink
Merge pull request #82 from mole99/fix-tbgen
Browse files Browse the repository at this point in the history
Do not generate testbench netlists in parallel
  • Loading branch information
mole99 authored Jun 16, 2024
2 parents de52a29 + 1c1267c commit 5cfaa49
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.3.6

## Common

- Do not generate testbench netlists in parallel, this leads to race conditions

# 2.3.5

## Common
Expand Down
2 changes: 1 addition & 1 deletion cace/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = '2.3.5'
__version__ = '2.3.6'

if __name__ == '__main__':
print(__version__, end='')
20 changes: 6 additions & 14 deletions cace/parameter/electrical_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from multiprocessing import cpu_count
from multiprocessing.pool import ThreadPool

from ..common.cace_regenerate import regenerate_testbenches
from ..common.cace_gensim import *
from ..common.cace_collate import *
from ..common.cace_makeplot import *
Expand Down Expand Up @@ -174,18 +173,9 @@ def add_simulation_job(self, job):
# this is a problem when a testbench is canceled
def preprocess(self):

# Get the set of paths from the characterization file
paths = self.datasheet['paths']
dbg(f'Parameter {self.param["name"]}: Generating simulation files')

# Generate testbench netlists if needed
result = regenerate_testbenches(self.datasheet, self.param['name'])
if result == 1:
err(
f'Parameter {self.param["name"]}: Failed to regenerate testbench netlists'
)
return 1

dbg(f'Parameter {self.param["name"]}: Evaluating electrical parameter')
# Generate the spice netlists for simulation from the template
cace_gensim(self.datasheet, self.param, self.param_dir)

# Diagnostic: find and print the number of files to be simulated
Expand Down Expand Up @@ -219,6 +209,9 @@ def preprocess(self):

alltestbenches = []
results = []

# Create an empty testbench list to hold
# the testbenches that are returned
self.new_testbenches = []

for i in range(0, len(testbenches), group_size):
Expand All @@ -238,8 +231,7 @@ def preprocess(self):
)
self.add_simulation_job(new_sim_job)

# Create an empty testbench list to hold
# the testbenches that are returned
# Append an empty testbench
self.new_testbenches.append([None])

idx += 1
Expand Down
16 changes: 15 additions & 1 deletion cace/parameter/parameter_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
markdown_summary,
cace_generate_html,
)
from ..common.cace_regenerate import regenerate_netlists
from ..common.cace_regenerate import (
regenerate_netlists,
regenerate_testbenches,
)
from .physical_parameter import PhysicalParameter
from .electrical_parameter import ElectricalParameter

Expand Down Expand Up @@ -808,6 +811,17 @@ def run_parameters_async(self):
self.cancel_parameters(True)
return

# Next, for each parameter generate testbench netlists if needed
for thread in self.queued_threads:
result = regenerate_testbenches(
self.datasheet, thread.param['name']
)
if result == 1:
err(
f'Parameter {self.param["name"]}: Failed to regenerate testbench netlists'
)
return 1

# Only start a new worker thread, if
# the previous one hasn't completed yet
if not self.worker_thread or not self.worker_thread.is_alive():
Expand Down

0 comments on commit 5cfaa49

Please sign in to comment.