Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MPI-BugBench
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
High Performance Computing - Public
MPI-BugBench
Commits
cfc7d277
Commit
cfc7d277
authored
1 year ago
by
Jammer, Tim
Browse files
Options
Downloads
Patches
Plain Diff
Replace instructions by giving instructions
parent
2236f39c
No related branches found
No related tags found
1 merge request
!14
Infrastructure: Remove Instructionblock
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/Infrastructure/Template.py
+9
-6
9 additions, 6 deletions
scripts/Infrastructure/Template.py
with
9 additions
and
6 deletions
scripts/Infrastructure/Template.py
+
9
−
6
View file @
cfc7d277
...
@@ -252,14 +252,16 @@ class TemplateManager:
...
@@ -252,14 +252,16 @@ class TemplateManager:
raise
ValueError
(
"
Neither Both block name nor index is given
"
)
raise
ValueError
(
"
Neither Both block name nor index is given
"
)
def
__get_instruction_index
(
self
,
ident
:
str
|
Instruction
)
->
typing
.
List
[
int
]:
def
__get_instruction_index
(
self
,
ident
:
str
|
Instruction
|
typing
.
List
[
Instruction
]
)
->
typing
.
List
[
int
]:
"""
"""
internal helper function to receive the indices of instructions with ghe given identifier oris the given i
s
ntruction
internal helper function to receive the indices of instructions with ghe given identifier oris the given in
s
truction
"""
"""
if
isinstance
(
ident
,
str
):
if
isinstance
(
ident
,
str
):
return
[
idx
for
idx
,
inst
in
enumerate
(
self
.
_instructions
)
if
inst
.
get_identifier
()
==
ident
]
return
[
idx
for
idx
,
inst
in
enumerate
(
self
.
_instructions
)
if
inst
.
get_identifier
()
==
ident
]
if
isinstance
(
ident
,
Instruction
):
if
isinstance
(
ident
,
Instruction
):
return
[
idx
for
idx
,
inst
in
enumerate
(
self
.
_instructions
)
if
inst
==
ident
]
return
[
idx
for
idx
,
inst
in
enumerate
(
self
.
_instructions
)
if
inst
==
ident
]
if
isinstance
(
ident
,
list
):
return
[
idx
for
idx
,
inst
in
enumerate
(
self
.
_instructions
)
if
inst
in
ident
]
raise
ValueError
(
"
Provide string or instruction
"
)
raise
ValueError
(
"
Provide string or instruction
"
)
def
insert_instruction
(
self
,
new_instruction
:
Instruction
,
after_instruction
:
Instruction
|
str
|
int
=
None
,
def
insert_instruction
(
self
,
new_instruction
:
Instruction
,
after_instruction
:
Instruction
|
str
|
int
=
None
,
...
@@ -365,10 +367,6 @@ class TemplateManager:
...
@@ -365,10 +367,6 @@ class TemplateManager:
else
:
else
:
new_instruction_list
=
new_instruction
new_instruction_list
=
new_instruction
if
old_instruction
is
not
None
:
raise
EnvironmentError
(
"
NOT IMPLEMENTED
"
)
# TODO implement
idxs_to_replace
=
[]
idxs_to_replace
=
[]
if
idx
is
not
None
:
if
idx
is
not
None
:
if
isinstance
(
idx
,
int
):
if
isinstance
(
idx
,
int
):
...
@@ -378,6 +376,11 @@ class TemplateManager:
...
@@ -378,6 +376,11 @@ class TemplateManager:
if
identifier
is
not
None
:
if
identifier
is
not
None
:
idxs_to_replace
=
self
.
__get_instruction_index
(
identifier
)
idxs_to_replace
=
self
.
__get_instruction_index
(
identifier
)
if
old_instruction
is
not
None
:
if
isinstance
(
old_instruction
,
Instruction
):
old_instruction
=
[
old_instruction
]
idxs_to_replace
=
self
.
__get_instruction_index
(
old_instruction
)
if
len
(
idxs_to_replace
)
==
len
(
new_instruction_list
):
if
len
(
idxs_to_replace
)
==
len
(
new_instruction_list
):
raise
ValueError
(
"
Number of instructions to Replace does not match number of given instructions
"
)
raise
ValueError
(
"
Number of instructions to Replace does not match number of given instructions
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment