Skip to content

Commit 993dae9

Browse files
committed
not working
1 parent 3680c53 commit 993dae9

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

autosubmit/job/job_list.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ def generate(self, as_conf, date_list, member_list, num_chunks, chunk_ini, param
247247
self._dic_jobs._job_list = {job["job"].name: job["job"] for _, job in self.graph.nodes.data() if
248248
job.get("job", None)}
249249
else:
250+
Log.debug("Graph is empty")
250251
if not create:
251252
raise AutosubmitCritical("Autosubmit couldn't load the workflow graph. Please run autosubmit create first. If the pkl file exists and was generated with Autosubmit v4.1+, try again.",7013)
252253
# Remove the previous pkl, if it exists.

autosubmit/platforms/wrappers/wrapper_builder.py

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
from typing import List
2525

26+
from log.log import Log
27+
2628

2729
class WrapperDirector:
2830
"""
@@ -720,7 +722,7 @@ def build_job_thread(self):
720722
return textwrap.dedent(""" """)
721723
# horizontal and hybrids
722724
def build_nodes_list(self):
723-
return self.get_nodes() + self.build_cores_list()
725+
return self.build_cores_list()
724726

725727
def get_nodes(self):
726728
return textwrap.dedent(f"""
@@ -907,9 +909,9 @@ def build_srun_launcher(self, jobs_list, footer=True):
907909
return srun_launcher
908910

909911
def build_main(self):
910-
nodelist = self.build_nodes_list()
912+
#nodelist = self.build_nodes_list()
911913
srun_launcher = self.build_srun_launcher("scripts")
912-
return nodelist + srun_launcher
914+
return srun_launcher
913915

914916
class SrunVerticalHorizontalWrapperBuilder(SrunWrapperBuilder):
915917
def build_imports(self):
@@ -953,21 +955,42 @@ def build_imports(self):
953955
job_mask = job_mask + thr_mask
954956
srun_mask_values.append(str(hex(job_mask)))
955957
if job_id > 0:
956-
core[0]=core[0] << int(n_threads)
958+
core[0]=core[0] << int(n_threads)
957959
else:
958-
core[0]=job_mask+0x1
960+
core[0]=job_mask+0x1
959961

960962
mask_array = "( "
961963
for mask in srun_mask_values:
962964
mask_array += str("\"" + mask + "\"") + " "
963965
mask_array += ")"
964966
scripts_bash += textwrap.dedent("""
967+
# Enable debugging and exit on error
968+
set -xe
965969
declare -a job_mask_array={0}
966970
""").format(mask_array, '\n'.ljust(13))
967-
971+
# masks = self.mask_cpu()
972+
# Log.info(f"Mask values: {masks}")
973+
# print(masks)
968974
return scripts_bash
969975

970-
976+
# def mask_cpu(self):
977+
#
978+
# def mask(total_cores, processes, rank):
979+
# process_mask = 2 ** (int(total_cores / processes)) - 1
980+
# shifter = total_cores - (len(bin(process_mask)) - 2) * (rank + 1)
981+
# return hex(process_mask << shifter)
982+
#
983+
# cores = int(self.threads_number)
984+
# processes = int(self.num_procs_value)
985+
# ranks = list(range(processes))
986+
# masks = []
987+
#
988+
# while (len(ranks) > 0):
989+
# i = 0
990+
# print(mask(cores, processes, ranks[i]), end="")
991+
# masks.append(mask(cores, processes, ranks[i]))
992+
# del ranks[i]
993+
# return masks
971994

972995
def build_srun_launcher(self, jobs_list, footer=True):
973996
srun_launcher = textwrap.dedent("""
@@ -1008,7 +1031,7 @@ def build_srun_launcher(self, jobs_list, footer=True):
10081031
break
10091032
fi
10101033
if [ $job_index -eq 0 ] || [ -f "$completed_path" ]; then # If first horizontal wrapper or last wrapper is completed
1011-
srun -N1 --ntasks=1 --cpus-per-task={1} --cpu-bind=verbose,mask_cpu:job_mask_array[$job_index] --distribution=block:block $template > $out 2> $err &
1034+
srun -N1 --ntasks=1 --cpus-per-task={1} --cpu-bind=verbose,mask_cpu:${{job_mask_array[$job_index]}} --distribution=block:block $template > $out 2> $err &
10121035
job_index=$(($job_index+1))
10131036
else
10141037
break
@@ -1041,6 +1064,6 @@ def build_srun_launcher(self, jobs_list, footer=True):
10411064
return srun_launcher
10421065

10431066
def build_main(self):
1044-
nodelist = self.build_nodes_list()
1067+
#nodelist = self.build_nodes_list()
10451068
srun_launcher = self.build_srun_launcher("scripts_list")
1046-
return nodelist + srun_launcher
1069+
return srun_launcher

0 commit comments

Comments
 (0)