Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
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
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
642e5039
Commit
642e5039
authored
5 years ago
by
Elizabeth
Browse files
Options
Downloads
Patches
Plain Diff
Implemented instructions generation for source code files
parent
fc8fcc2a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/projects/hpvm-tensor-rt/code_autogenerators/cmakelists_generator.py
+21
-3
21 additions, 3 deletions
...pvm-tensor-rt/code_autogenerators/cmakelists_generator.py
with
21 additions
and
3 deletions
llvm/projects/hpvm-tensor-rt/code_autogenerators/cmakelists_generator.py
+
21
−
3
View file @
642e5039
...
...
@@ -13,6 +13,7 @@ def get_all_generated_directory_names():
'''
generated_dir_names
=
[]
for
dir_name
in
os
.
listdir
(
"
.
"
):
print
(
dir_name
)
if
dir_name
.
endswith
(
"
autogenerated_knobs
"
):
generated_dir_names
.
append
(
dir_name
)
return
generated_dir_names
...
...
@@ -31,17 +32,34 @@ def generate_cmakelists_setup(cmakelists_file):
BASE_CMAKELISTS_PATH
=
"
/home/nvidia/Gitlab/hpvm/llvm/projects/hpvm-tensor-rt/CMakeLists.txt
"
base_cmakelists_file
=
open
(
BASE_CMAKELISTS_PATH
,
"
r
"
)
for
line
in
base_cmakelists_file
:
if
line
.
startswith
(
"
#
"
):
continue
if
line
.
find
(
"
add_executable
"
)
!=
-
1
:
break
cmakelists_file
.
write
(
line
)
base_cmakelists_file
.
close
()
def
generate_cmakelists_file
(
cmakelists_file
,
source_
cod
e_dirs
):
def
generate_cmakelists_file
(
cmakelists_file
,
source_
fil
e_dirs
):
generate_cmakelists_setup
(
cmakelists_file
)
for
source_code_dir
in
source_code_dirs
:
pass
LIBRARIES
=
"
tensor_runtime ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}
"
cmake_instrs
=
[]
for
source_file_dir
in
source_file_dirs
:
cmake_instrs
.
append
(
"
# %s
"
%
source_file_dir
)
for
source_file
in
os
.
listdir
(
source_file_dir
):
# Executable name = name of source code file without file extension
file_ext_ind
=
source_file
.
find
(
"
.cc
"
)
if
file_ext_ind
==
-
1
:
print
(
"
WARNING: Found file with wrong extension. Skipping. %s
"
%
source_file
)
continue
exec_name
=
source_file
[
:
file_ext_ind
]
source_file_path
=
os
.
path
.
join
(
source_file_dir
,
source_file
)
cmake_instrs
.
append
(
"
add_executable(%s %s)
"
%
(
exec_name
,
source_file_path
))
cmake_instrs
.
append
(
"
target_link_libraries(%s %s)
\n
"
%
(
exec_name
,
LIBRARIES
))
cmake_instrs
.
append
(
"
\n
"
)
cmakelists_file
.
write
(
'
\n
'
.
join
(
cmake_instrs
))
if
__name__
==
"
__main__
"
:
num_args
=
len
(
sys
.
argv
)
...
...
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