Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry Pi 64 OS + Jetson Nano configure.py #2420

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Modified for RPi 64 OS + Jetson Nano
Add configuration for Raspberry Pi 64-bit OS and Jetson Nano.
The Nano does not know TF_NEED_CUDA, nor TF_CUDA_VERSION (= JETSON_CUDA).
Simplest solution is an extra branch.
  • Loading branch information
Qengineering authored Mar 20, 2021
commit fe59bd93af2e45b9d673e00c1fb41151e9bd298c
25 changes: 22 additions & 3 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ def is_linux():
def is_raspi_arm():
return os.uname()[4] == "armv7l"

def is_aarch64():
return os.uname()[4] == "aarch64"

def is_nano():
return os.uname()[1] == "nano"

def get_tf_header_dir():
import tensorflow as tf
Expand All @@ -68,7 +73,7 @@ def get_tf_shared_lib_dir():
if is_windows():
tf_shared_lib_dir = tf.sysconfig.get_compile_flags()[0][2:-7] + "python"
return tf_shared_lib_dir.replace("\\", "/")
elif is_raspi_arm():
elif is_raspi_arm() or is_aarch64():
return tf.sysconfig.get_compile_flags()[0][2:-7] + "python"
else:
return tf.sysconfig.get_link_flags()[0][2:]
Expand All @@ -85,7 +90,7 @@ def get_shared_lib_name():
elif is_windows():
# Windows
return "_pywrap_tensorflow_internal.lib"
elif is_raspi_arm():
elif is_raspi_arm() or is_aarch64():
# The below command for linux would return an empty list
return "_pywrap_tensorflow_internal.so"
else:
Expand Down Expand Up @@ -120,14 +125,28 @@ def create_build_configuration():
write("build:windows --cxxopt=/std:c++14")
write("build:windows --host_cxxopt=/std:c++14")

if is_macos() or is_linux():
if is_raspi_arm() or is_aarch64():
write("build --cxxopt=-std=c++14")
write("build --host_cxxopt=-std=c++14")
elif is_macos() or is_linux():
write("build --copt=-mavx")
write("build --cxxopt=-std=c++14")
write("build --host_cxxopt=-std=c++14")

if os.getenv("TF_NEED_CUDA", "0") == "1":
print("> Building GPU & CPU ops")
configure_cuda()
elif is_nano():
print("> Building GPU & CPU ops")
write_action_env("TF_NEED_CUDA", "1")
write_action_env("CUDA_TOOLKIT_PATH", "/usr/local/cuda")
write_action_env("CUDNN_INSTALL_PATH", "/usr/lib/aarch64-linux-gnu"),
write_action_env("TF_CUDA_VERSION", "10")
write_action_env("TF_CUDNN_VERSION", "8")
write("test --config=cuda")
write("build --config=cuda")
write("build:cuda --define=using_cuda=true --define=using_cuda_nvcc=true")
write("build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain")
else:
print("> Building only CPU ops")

Expand Down