Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gpusched_parser
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GPUSched
gpusched_parser
Commits
4a570fb0
Commit
4a570fb0
authored
1 year ago
by
Nordine Feddal
Browse files
Options
Downloads
Patches
Plain Diff
added main function and all steps inside vector
parent
a85eee3f
Loading
Loading
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/gpusched_parser/parser.py
+3
-3
3 additions, 3 deletions
src/gpusched_parser/parser.py
src/gpusched_result/gpusched_result.py
+15
-3
15 additions, 3 deletions
src/gpusched_result/gpusched_result.py
src/main.py
+10
-0
10 additions, 0 deletions
src/main.py
with
28 additions
and
6 deletions
src/gpusched_parser/parser.py
+
3
−
3
View file @
4a570fb0
...
...
@@ -26,7 +26,7 @@ def parse_tasks(args):
with
open
(
args
.
gpu_tasks
,
"
r
"
)
as
inFile
,
open
(
args
.
output_file
,
"
a
"
)
as
outFile
:
outFile
.
write
(
"
#include <stdio.h>
\n
"
"
#include <string>
\n
"
"
#include
\"
step_struct.hpp
\"\n
"
"
#include
\"
step
s
_struct.hpp
\"\n
"
"
#include
\"
{kernel_file}
\"\n
"
.
format
(
kernel_file
=
args
.
kernel_declaration
)
)
...
...
@@ -99,7 +99,6 @@ def parse_sched_order(args):
outFile
.
write
(
"
#define __GPUSCHED_STEPS__HPP
\n
"
)
outFile
.
write
(
"
#include <vector>
\n
"
)
outFile
.
write
(
GPUSchedStepParams
.
dump_struct
())
outFile
.
write
(
GPUSchedStepParams
.
dump_global_vector
())
for
step
in
schedOrder
:
step
=
step
.
rstrip
(
'
'
).
lstrip
(
'
'
).
rstrip
(
'
\n
'
)
# If to differentiate step with multiple kernels call and those with only one
...
...
@@ -112,8 +111,9 @@ def parse_sched_order(args):
outFile
.
write
(
currGpuSchedStep
.
dump_str
())
step_no
+=
1
outFile
.
write
(
GPUSchedStepParams
.
dump_global_vector
())
outFile
.
write
(
"
#endif
"
)
print
(
GPUSchedStepParams
.
dump_struct
())
"""
Retrieve a task in list_gpu_tasks_object by its id.
...
...
This diff is collapsed.
Click to expand it.
src/gpusched_result/gpusched_result.py
+
15
−
3
View file @
4a570fb0
...
...
@@ -26,28 +26,40 @@ class GPUSchedStepParams:
return
dump
def
dump_global_vector
():
dump
=
"
static std::vector<{struct_name}>& gpusched_steps()
\n
{{
\n
"
.
format
(
struct_name
=
GPUSchedStepParams
.
STRUCT_NAME
)
dump
=
"
static std::vector<{struct_name}>&
get_
gpusched_steps()
\n
{{
\n
"
.
format
(
struct_name
=
GPUSchedStepParams
.
STRUCT_NAME
)
dump
+=
"
\t
static std::vector<{struct_name}> steps;
\n
"
.
format
(
struct_name
=
GPUSchedStepParams
.
STRUCT_NAME
)
dump
+=
"
\t
// Add all steps in vector
\n
"
for
i
in
range
(
0
,
GPUSchedResultStep
.
NUMBER_STEP
+
1
):
dump
+=
"
\t
steps.push_back(step_{no});
\n
"
.
format
(
no
=
i
)
dump
+=
"
\t
return steps;
\n
}
\n\n
"
return
dump
class
GPUSchedResultStep
:
STRUCT_STEP
=
"
gpusched_step_t step_{no} = {{
\n
"
;
TRACK_MAX_JOBS
=
0
# tracker to know how much stream is required for this schedule order
NUMBER_STEP
=
0
def
__init__
(
self
,
number_kernels
,
list_jobs
,
step_no
):
if
GPUSchedResultStep
.
TRACK_MAX_JOBS
<
number_kernels
:
GPUSchedResultStep
.
TRACK_MAX_JOBS
=
number_kernels
GPUSchedResultStep
.
NUMBER_STEP
=
step_no
self
.
number_kernels
=
number_kernels
# number of kernels to execute for this step
self
.
list_jobs
=
list_jobs
# list of jobs
self
.
step_no
=
step_no
# differentiate case when we only have one kernel we don't want to join with comma
if
number_kernels
!=
1
:
self
.
str_list_jobs
=
'
,
'
.
join
(
self
.
list_jobs
)
else
:
self
.
str_list_jobs
=
list_jobs
self
.
step_no
=
step_no
self
.
dump_str
()
def
dump_str
(
self
):
print
(
"
Start a GPUSCHED step dump
"
)
dump
=
GPUSchedResultStep
.
STRUCT_STEP
.
format
(
no
=
self
.
step_no
)
dump
+=
GPUSchedStepParams
.
ARRAY_IMPL
.
format
(
SIZE
=
self
.
number_kernels
,
list_jobs
=
self
.
str_list_jobs
)
...
...
This diff is collapsed.
Click to expand it.
src/main.py
+
10
−
0
View file @
4a570fb0
...
...
@@ -17,6 +17,15 @@ def check_file_exist(args):
else
:
return
True
def
write_main
(
args
):
with
open
(
args
.
output_file
,
"
a
"
)
as
outFile
:
outFile
.
write
(
"
int main(int argc, char **argv){
\n
"
"
\t
auto steps = get_gpusched_steps();
\n
"
"
\t
printf(
\"
Start the execution of GPUSCHED order
\"
);
\n
"
"
\t
printf(
\"
There is %d steps to execute
\"
, steps.size());
\n
"
"
}
"
)
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
"
Generate a cu file that impelement the schedule graph generated by GPUSCHED
"
)
parser
.
add_argument
(
'
-t
'
,
'
--gpu_tasks
'
,
type
=
str
,
help
=
'
Input file containing GPU Tasks information
'
)
...
...
@@ -38,6 +47,7 @@ def main():
parse_tasks
(
args
)
parse_jobs
(
args
)
parse_sched_order
(
args
)
write_main
(
args
)
if
__name__
==
"
__main__
"
:
...
...
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