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
5149932d
Commit
5149932d
authored
3 years ago
by
Yifan Zhao
Browse files
Options
Downloads
Patches
Plain Diff
install.sh can be run from other directories
parent
1ad9f7d1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+5
-3
5 additions, 3 deletions
.gitignore
hpvm/install.sh
+1
-1
1 addition, 1 deletion
hpvm/install.sh
hpvm/scripts/hpvm_installer.py
+21
-18
21 additions, 18 deletions
hpvm/scripts/hpvm_installer.py
with
27 additions
and
22 deletions
.gitignore
+
5
−
3
View file @
5149932d
hpvm/build*/
build*/
llvm-*.src.tar.xz
llvm-*.src/
model_params.tar.gz
model_params/
hpvm/llvm/
hpvm/llvm-*.src.tar.xz
hpvm/llvm-*.src/
hpvm/llvm_patches/**/*.patch
# Below is taken from Python.gitignore: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
...
...
This diff is collapsed.
Click to expand it.
hpvm/install.sh
+
1
−
1
View file @
5149932d
#!/bin/bash
# Run installer script and pass on args to installer that can parse them
scripts/hpvm_installer.py
"
$@
"
"
${
BASH_SOURCE
%/*
}
/
scripts/hpvm_installer.py
"
"
$@
"
ret_code
=
$?
echo
"Installer returned with code
$ret_code
"
exit
$ret_code
This diff is collapsed.
Click to expand it.
hpvm/scripts/hpvm_installer.py
+
21
−
18
View file @
5149932d
...
...
@@ -14,7 +14,7 @@ LLVM_DIR = f"llvm-{VERSION}.src"
LLVM_TARBALL
=
f
"
{
LLVM_DIR
}
.tar.xz
"
ROOT_DIR
=
(
Path
(
__file__
).
parent
/
"
..
"
).
absolute
().
resolve
()
MODEL_PARAMS_TAR
=
ROOT_DIR
/
"
model_params.tar.gz
"
MODEL_PARAMS_TAR
=
Path
(
"
model_params.tar.gz
"
)
MODEL_PARAMS_DIR
=
ROOT_DIR
/
"
test/dnn_benchmarks/model_params
"
MODEL_PARAMS_LINK
=
"
https://databank.illinois.edu/datafiles/o3izd/download
"
...
...
@@ -65,7 +65,8 @@ def parse_args(args=None):
"
--build-dir
"
,
type
=
Path
,
default
=
"
build
"
,
help
=
f
"
Where to create the build directory. Relative to (
{
ROOT_DIR
}
). Default: build
"
,
help
=
f
"
Where to create the build directory
"
"
(absolute path, or relative to current directory). Default: build
"
,
)
parser
.
add_argument
(
"
-t
"
,
...
...
@@ -101,7 +102,6 @@ def parse_args(args=None):
"
Example: DCMAKE_BUILD_TYPE=Release DCMAKE_INSTALL_PREFIX=install
"
,
)
args
=
parser
.
parse_args
(
args
)
args
.
build_dir
=
ROOT_DIR
/
args
.
build_dir
args
.
cmake_args
=
[
f
"
-
{
arg
}
"
for
arg
in
args
.
cmake_args
]
return
args
...
...
@@ -202,7 +202,8 @@ def check_python_version():
def
check_download_llvm_clang
():
if
Path
(
"
llvm/
"
).
is_dir
():
llvm
=
ROOT_DIR
/
"
llvm
"
if
llvm
.
is_dir
():
print
(
"
Found LLVM directory, not extracting it again.
"
)
else
:
if
Path
(
LLVM_TARBALL
).
is_file
():
...
...
@@ -212,26 +213,26 @@ def check_download_llvm_clang():
print
(
f
"
=============================
"
)
download
(
f
"
{
URL
}
/
{
VERSION
}
/
{
LLVM_TARBALL
}
"
,
LLVM_TARBALL
)
check_call
([
"
tar
"
,
"
xf
"
,
LLVM_TARBALL
])
check_call
([
"
mv
"
,
LLVM_DIR
,
"
llvm
"
])
tools
=
Path
(
"
llvm/
tools
"
)
check_call
([
"
mv
"
,
LLVM_DIR
,
str
(
llvm
)
])
tools
=
llvm
/
"
tools
"
assert
tools
.
is_dir
(),
"
Problem with LLVM download. Exiting!
"
if
Path
(
LLVM_TARBALL
).
is_file
():
Path
(
LLVM_TARBALL
).
unlink
()
# Remove tarball
# TODO: check and remove this
environ
[
"
LLVM_SRC_ROOT
"
]
=
str
(
ROOT_DIR
/
"
llvm
"
)
if
(
tools
/
"
clang/
"
).
is_dir
():
clang
=
tools
/
"
clang
"
if
clang
.
is_dir
():
print
(
"
Found clang directory, not extracting it again.
"
)
return
chdir
(
tools
)
print
(
f
"
Downloading
{
CLANG_TARBALL
}
...
"
)
print
(
f
"
=============================
"
)
download
(
f
"
{
URL
}
/
{
VERSION
}
/
{
CLANG_TARBALL
}
"
,
CLANG_TARBALL
)
check_call
([
"
tar
"
,
"
xf
"
,
CLANG_TARBALL
])
check_call
([
"
mv
"
,
CLANG_DIR
,
"
clang
"
])
assert
Path
(
"
clang
/
"
)
.
is_dir
(),
"
Problem with clang download. Exiting!
"
check_call
([
"
mv
"
,
CLANG_DIR
,
str
(
clang
)
])
assert
clang
.
is_dir
(),
"
Problem with clang download. Exiting!
"
if
Path
(
CLANG_TARBALL
).
is_file
():
Path
(
CLANG_TARBALL
).
unlink
()
chdir
(
ROOT_DIR
)
def
check_download_model_params
():
...
...
@@ -265,6 +266,7 @@ def check_download_model_params():
def
link_and_patch
():
from
os
import
symlink
cwd
=
Path
.
cwd
()
hpvm
=
ROOT_DIR
/
"
llvm/tools/hpvm
"
print
(
"
Adding HPVM sources to tree...
"
)
makedirs
(
hpvm
,
exist_ok
=
True
)
...
...
@@ -273,11 +275,11 @@ def link_and_patch():
print
(
ROOT_DIR
/
link
,
hpvm
/
link
)
symlink
(
ROOT_DIR
/
link
,
hpvm
/
link
)
print
(
"
Applying HPVM patches...
"
)
chdir
(
"
llvm_patches
"
)
chdir
(
ROOT_DIR
/
"
llvm_patches
"
)
check_call
([
"
bash
"
,
"
./construct_patch.sh
"
])
check_call
([
"
bash
"
,
"
./apply_patch.sh
"
])
print
(
"
Patches applied.
"
)
chdir
(
"
..
"
)
chdir
(
cwd
)
def
build
(
...
...
@@ -291,10 +293,11 @@ def build(
print
(
f
"
Using
{
nthreads
}
threads to build HPVM.
"
)
makedirs
(
build_dir
,
exist_ok
=
True
)
cwd
=
Path
.
cwd
()
chdir
(
build_dir
)
cmake_args
=
[
"
cmake
"
,
"
../
llvm
"
,
str
(
ROOT_DIR
/
"
llvm
"
)
,
"
-DCMAKE_C_COMPILER=gcc
"
,
"
-DCMAKE_CXX_COMPILER=g++
"
,
f
"
-DLLVM_TARGETS_TO_BUILD=
{
targets
}
"
,
...
...
@@ -311,27 +314,27 @@ def build(
print
(
f
"
Build system (
{
build_sys
}
):
{
'
'
.
join
(
build_args
)
}
"
)
print
(
f
"
=============================
"
)
check_call
(
build_args
)
chdir
(
ROOT_DIR
)
chdir
(
cwd
)
def
install_py_packages
():
import
sys
project_root
=
Path
(
__file__
).
parent
.
parent
for
package
in
PY_PACKAGES
:
package_home
=
project_root
/
package
package_home
=
ROOT_DIR
/
package
print
(
f
"
Installing python package
{
package_home
}
"
)
check_call
([
sys
.
executable
,
"
-m
"
,
"
pip
"
,
"
install
"
,
str
(
package_home
)])
def
run_tests
(
build_dir
:
Path
,
use_ninja
:
bool
,
nthreads
:
int
):
cwd
=
Path
.
cwd
()
chdir
(
build_dir
)
build_sys
=
"
ninja
"
if
use_ninja
else
"
make
"
build_args
=
[
build_sys
,
f
"
-j
{
nthreads
}
"
,
*
MAKE_TARGETS
]
print
(
f
"
Tests:
{
'
'
.
join
(
build_args
)
}
"
)
print
(
f
"
=============================
"
)
check_call
(
build_args
)
chdir
(
ROOT_DIR
)
chdir
(
cwd
)
def
input_with_check
(
prompt
:
str
,
parse
,
prompt_when_invalid
:
str
):
...
...
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