Commit acd733cb authored by Oriol Tintó-Prims's avatar Oriol Tintó-Prims
Browse files

Several Bug-fixes

parent 970efbe2
......@@ -13,7 +13,7 @@ if __name__ == "__main__":
(options, args) = parser.parse_args()
vault_path = options.vault
wp = options.working_precision
wp = int(options.working_precision)
output_vault = options.output_vault
path_to_input_sources = options.input_source
export_graph = options.export_graph
......@@ -44,8 +44,8 @@ if __name__ == "__main__":
if vault_path is None:
# Paths to source folders
# Path_to_input_sources
path_to_preprocessed_sources = "./tmp_processedsources/"
path_to_output_sources = "./tmp_outputsources/"
path_to_preprocessed_sources = "tmp_processedsources/"
path_to_output_sources = "tmp_outputsources/"
if not isdir(path_to_preprocessed_sources):
mkdir(path_to_preprocessed_sources)
if not isdir(path_to_output_sources):
......
......@@ -901,8 +901,10 @@ def is_call_to_function_vault(contents, routine, vault):
function_name = re.match(pattern, contents).group(1)
# Check if the name matches with the name of a variable in the actual routine
if any([v for v in routine.variables if v.name == function_name]):
return False
# TODO: ideally routine should never be None. In some cases it happens
if routine is not None:
if any([v for v in routine.variables if v.name == function_name]):
return False
# Search for a procedure with the same name
try:
......
......@@ -52,6 +52,9 @@ def create_type_combinations(case_types):
:param case_types: list of variable types
:return: list of all the possible variations of variable types
"""
# TODO: In some cases a big number of arguments can make this approach crash. Here we add a security check.
if len(case_types) > 10:
raise AssertionError("Too much arguments to use a combinatorial approach.")
import itertools
real_types = ["single", "double"]
syn_types = ["real" if x in real_types else x for x in case_types]
......@@ -107,7 +110,7 @@ def retrieve_real_in_line(line, vault, current_block, check=False):
# Search for calls to subroutines
routine_calls = calls_to_routines(line)
function_calls = calls_to_functions(line, vault)
function_calls = calls_to_functions(line, vault, current_routine=current_block.routine)
if check:
null_return_val = [None, None, None, None, None]
......@@ -196,7 +199,11 @@ def retrieve_real_in_line(line, vault, current_block, check=False):
except AssertionError:
if check and not alternative_procedures:
# In case there wasn't a match with the interface, check if through a variable cast it can work
types_to_test = create_type_combinations(argument_types)
# TODO: Workaround added to deal with the issue of lbc_lnk_multi in bdyice which has tons of parameters and brakes the combinatorial approach.
if called_procedure == "lbc_lnk_multi":
types_to_test = []
else:
types_to_test = create_type_combinations(argument_types)
matches = []
for t in types_to_test:
try:
......
......@@ -81,7 +81,10 @@ def obtain_result(remote_rundir, communicator, accuracy_file=True):
else:
try:
import pickle as pkl
with communicator.sftp.open("%s/simulation_RMSE.pkl" % remote_rundir, "rb") as f:
remote_filename = "%s/simulation_RMSE.pkl" % remote_rundir
# Setting the buffer size to deal with outputs bigger than few kB
buffer_size = 3 * 1024 * 1024
with communicator.sftp.open(remote_filename, "rb", bufsize=buffer_size) as f:
return pkl.load(f)
except FileNotFoundError as err:
......@@ -554,6 +557,14 @@ class BinarySearchJob(Job):
def spawn_children(self, queue):
# In case the set has not been divided already
if self.child is None:
# Trying new thing, set the minimum unit to explore to modules
# Check if all variables are from the same module
variables = [self.vault.get_variable_by_id(_id) for _id in self.analysis_set]
routines = set([v.routine for v in variables])
modules = set([r.module for r in routines])
if len(modules) == 1:
return False
if len(self.analysis_set) >= 2:
if self.thresholds is not None:
child_thresholds = dict(self.thresholds)
......@@ -619,6 +630,9 @@ class BinarySearchJob(Job):
else:
raise AssertionError("SLURM job failed!")
# self.fail(queue)
elif remote_status == 'CANCELLED+':
self.submit(force=True)
self.retrials = 0
elif remote_status == "RUNNING":
pass
elif remote_status == "PENDING":
......
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