Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
5003e73d
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5003e73d
编写于
6月 22, 2020
作者:
S
storypku
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Build: --output_user_root configured via scripts/apollo_config.sh
上级
b8854bb1
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
46 addition
and
30 deletion
+46
-30
bootstrap.sh
bootstrap.sh
+0
-18
scripts/apollo_config.sh
scripts/apollo_config.sh
+25
-8
tools/apollo.bazelrc.sample
tools/apollo.bazelrc.sample
+0
-3
tools/bootstrap.py
tools/bootstrap.py
+20
-0
what_works.sh
what_works.sh
+1
-1
未找到文件。
bootstrap.sh
已删除
100755 → 0
浏览文件 @
b8854bb1
#!/usr/bin/env bash
set
-eo
pipefail
TOP_DIR
=
$(
dirname
"
$0
"
)
if
[[
"
$1
"
==
"--noninteractive"
]]
;
then
cp
-f
"
${
TOP_DIR
}
/tools/sample.bazelrc"
"
${
TOP_DIR
}
/.apollo.bazelrc"
exit
0
fi
if
[
-z
"
$PYTHON_BIN_PATH
"
]
;
then
PYTHON_BIN_PATH
=
$(
which python3
||
true
)
fi
# Set all env variables
"
$PYTHON_BIN_PATH
"
"
${
TOP_DIR
}
/tools/bootstrap.py"
"
$@
"
echo
"Done bootstrap.sh"
scripts/apollo_config.sh
浏览文件 @
5003e73d
#! /usr/bin/env bash
set
-e
TOP_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/.."
&&
pwd
-P
)
"
source
"
${
TOP_DIR
}
/scripts/apollo.bashrc"
# STAGE="${STAGE:-dev}"
:
${
STAGE
:
=dev
}
IFS
=
''
read
-r
-d
''
STARTUP_TXT
<<
EOF
startup --output_user_root="
${
APOLLO_CACHE_DIR
}
/bazel"
EOF
set
-e
function
config_noninteractive
()
{
echo
"config_noninteractive"
local
bzl_cfg_file
=
"
${
APOLLO_ROOT_DIR
}
/.apollo.bazelrc"
echo
"
${
STARTUP_TXT
}
"
>
"
${
bzl_cfg_file
}
"
cat
"
${
APOLLO_ROOT_DIR
}
/tools/apollo.bazelrc.sample"
>>
"
${
bzl_cfg_file
}
"
}
function
config_interactive
()
{
echo
"config_interactive"
if
[
-z
"
$PYTHON_BIN_PATH
"
]
;
then
PYTHON_BIN_PATH
=
$(
which python3
||
true
)
fi
local
bzl_cfg_file
=
"
${
APOLLO_ROOT_DIR
}
/.apollo.bazelrc"
# Set all env variables
"
$PYTHON_BIN_PATH
"
"
${
TOP_DIR
}
/tools/bootstrap.py"
"
$@
"
echo
"
${
STARTUP_TXT
}
"
>>
"
${
bzl_cfg_file
}
"
}
function
config
()
{
local
stage
=
"
${
STAGE
}
"
local
mode
=
"
$1
"
if
[
$#
-eq
0
]
;
then
config_interactive
else
local
mode
=
"
$1
"
;
shift
if
[[
"
${
mode
}
"
==
"--noninteractive"
]]
;
then
config_noninteractive
config_noninteractive
"
$@
"
else
config_interactive
fi
fi
}
function
main
()
{
...
...
tools/
sample.bazelrc
→
tools/
apollo.bazelrc.sample
浏览文件 @
5003e73d
# Move from tools/bazelrc for unified configration
startup --output_user_root="/apollo/.cache/bazel"
build --action_env PYTHON_BIN_PATH="/usr/bin/python3"
build --action_env PYTHON_LIB_PATH="/usr/lib/python3/dist-packages"
build --python_path="/usr/bin/python3"
...
...
tools/bootstrap.py
浏览文件 @
5003e73d
...
...
@@ -48,6 +48,7 @@ _TF_CURRENT_BAZEL_VERSION = None
_TF_MIN_BAZEL_VERSION
=
'2.0.0'
_TF_MAX_BAZEL_VERSION
=
'3.99.0'
class
UserInputError
(
Exception
):
pass
...
...
@@ -55,6 +56,7 @@ class UserInputError(Exception):
def
is_linux
():
return
platform
.
system
()
==
'Linux'
def
get_input
(
question
):
try
:
try
:
...
...
@@ -102,9 +104,11 @@ def write_to_bazelrc(line):
with
open
(
_TF_BAZELRC
,
'a'
)
as
f
:
f
.
write
(
line
+
'
\n
'
)
def
write_action_env_to_bazelrc
(
var_name
,
var
):
write_to_bazelrc
(
'build --action_env {}="{}"'
.
format
(
var_name
,
str
(
var
)))
def
run_shell
(
cmd
,
allow_non_zero
=
False
,
stderr
=
None
):
if
stderr
is
None
:
stderr
=
sys
.
stdout
...
...
@@ -117,6 +121,7 @@ def run_shell(cmd, allow_non_zero=False, stderr=None):
output
=
subprocess
.
check_output
(
cmd
,
stderr
=
stderr
)
return
output
.
decode
(
'UTF-8'
).
strip
()
def
get_python_path
(
environ_cp
,
python_bin_path
):
"""Get the python site package paths."""
python_paths
=
[]
...
...
@@ -147,11 +152,13 @@ def get_python_path(environ_cp, python_bin_path):
paths
.
append
(
path
)
return
paths
def
get_python_major_version
(
python_bin_path
):
"""Get the python major version."""
return
run_shell
(
[
python_bin_path
,
'-c'
,
'import sys; print(sys.version[0])'
])
def
setup_python
(
environ_cp
):
"""Setup python related env variables."""
# Get PYTHON_BIN_PATH, default is the current running python.
...
...
@@ -216,10 +223,12 @@ def setup_python(environ_cp):
'w'
)
as
f
:
f
.
write
(
'export PYTHON_BIN_PATH="{}"'
.
format
(
python_bin_path
))
def
reset_tf_configure_bazelrc
():
"""Reset file that contains customized config settings."""
open
(
_TF_BAZELRC
,
'w'
).
close
()
def
get_var
(
environ_cp
,
var_name
,
query_item
,
...
...
@@ -489,6 +498,7 @@ def set_tf_cuda_clang(environ_cp):
no_reply
=
no_reply
,
bazel_config_name
=
'cuda_clang'
)
def
get_from_env_or_user_or_default
(
environ_cp
,
var_name
,
ask_for_var
,
var_default
):
"""Get var_name either from env, or user or default.
...
...
@@ -538,6 +548,7 @@ def set_clang_cuda_compiler_path(environ_cp):
write_action_env_to_bazelrc
(
'CLANG_CUDA_COMPILER_PATH'
,
clang_cuda_compiler_path
)
def
prompt_loop_or_load_from_env
(
environ_cp
,
var_name
,
var_default
,
...
...
@@ -710,6 +721,7 @@ def is_cuda_compatible(lib, cuda_ver, cudnn_ver):
cuda_ok
=
(
cudart
==
cuda_ver
)
return
cudnn_ok
and
cuda_ok
def
set_tf_tensorrt_version
(
environ_cp
):
"""Set TF_TENSORRT_VERSION."""
if
not
int
(
environ_cp
.
get
(
'TF_NEED_TENSORRT'
,
False
)):
...
...
@@ -724,6 +736,7 @@ def set_tf_tensorrt_version(environ_cp):
_DEFAULT_TENSORRT_VERSION
)
environ_cp
[
'TF_TENSORRT_VERSION'
]
=
tf_tensorrt_version
def
set_tf_nccl_version
(
environ_cp
):
"""Set TF_NCCL_VERSION."""
if
'TF_NCCL_VERSION'
in
environ_cp
:
...
...
@@ -880,6 +893,7 @@ def system_specific_test_config(environ_cp):
if
environ_cp
.
get
(
'TF_NEED_CUDA'
,
None
)
==
'1'
:
write_to_bazelrc
(
'test --test_env=LD_LIBRARY_PATH'
)
def
set_system_libs_flag
(
environ_cp
):
syslibs
=
environ_cp
.
get
(
'TF_SYSTEM_LIBS'
,
''
)
if
syslibs
:
...
...
@@ -897,6 +911,7 @@ def set_system_libs_flag(environ_cp):
write_to_bazelrc
(
'build --define=INCLUDEDIR=%s'
%
environ_cp
[
'INCLUDEDIR'
])
def
config_info_line
(
name
,
help_text
):
"""Helper function to print formatted help text for Bazel config options."""
print
(
'
\t
--config=%-12s
\t
# %s'
%
(
name
,
help_text
))
...
...
@@ -923,6 +938,7 @@ def validate_cuda_config(environ_cp):
if
environ_cp
.
get
(
'TF_NCCL_VERSION'
,
None
):
cuda_libraries
.
append
(
'nccl'
)
# FIXME(all): abs path for find_cuda_config.py
proc
=
subprocess
.
Popen
(
[
environ_cp
[
'PYTHON_BIN_PATH'
],
'tools/gpus/find_cuda_config.py'
]
+
cuda_libraries
,
...
...
@@ -961,6 +977,7 @@ def validate_cuda_config(environ_cp):
environ_cp
[
'CUDA_TOOLKIT_PATH'
]
=
config
[
'cuda_toolkit_path'
]
return
True
def
set_overall_build_config
():
overall_text
=
"""
## The following was adapted from tensorflow/.bazelrc
...
...
@@ -987,12 +1004,14 @@ build:nonccl --define=no_nccl_support=true
with
open
(
_TF_BAZELRC
,
'a'
)
as
f
:
f
.
write
(
overall_text
)
def
default_workspace_directory
():
current_dir
=
os
.
path
.
dirname
(
__file__
)
if
len
(
current_dir
)
==
0
:
current_dir
=
"."
return
os
.
path
.
abspath
(
current_dir
+
"/.."
)
def
main
():
if
not
is_linux
():
raise
ValueError
(
"Currently ONLY Linux platform is supported."
)
...
...
@@ -1126,5 +1145,6 @@ def main():
# config_info_line('nogcp', 'Disable GCP support.')
# config_info_line('nohdfs', 'Disable HDFS support.')
if
__name__
==
'__main__'
:
main
()
what_works.sh
浏览文件 @
5003e73d
...
...
@@ -37,7 +37,7 @@ sudo ldconfig
# Fail on first failure.
set
-e
./
bootstrap.sh
--noninteractive
./
apollo6.sh config
--noninteractive
function
bazel_build_with_dist_cache
()
{
# bazel build -c opt --distdir=/apollo/.cache/distdir "$@"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录