Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
40 changes: 0 additions & 40 deletions src/python/library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,47 +93,13 @@ add_custom_target(
#
# Linux specific Wheel file. Compatible with x86, x64 and aarch64
#
if (NOT WIN32)
# Can generate linux specific wheel file on linux systems only.
set(LINUX_WHEEL_DEPENDS
${WHEEL_DEPENDS}
)

if (${TRITON_PACKAGE_PERF_ANALYZER})
set(perf_analyzer_arg --perf-analyzer ${CMAKE_INSTALL_PREFIX}/bin/perf_analyzer)
endif()
set(linux_wheel_stamp_file "linux_stamp.whl")
add_custom_command(
OUTPUT "${linux_wheel_stamp_file}"
COMMAND python3
ARGS
"${CMAKE_CURRENT_SOURCE_DIR}/build_wheel.py"
--dest-dir "${CMAKE_CURRENT_BINARY_DIR}/linux"
--linux
${perf_analyzer_arg}
DEPENDS ${LINUX_WHEEL_DEPENDS}
)

add_custom_target(
linux-client-wheel ALL
DEPENDS
"${linux_wheel_stamp_file}"
)
endif() # NOT WIN32

if(${TRITON_ENABLE_PYTHON_GRPC})
add_dependencies(
generic-client-wheel
grpc-service-py-library proto-py-library
)

if (NOT WIN32)
add_dependencies(
linux-client-wheel
grpc-service-py-library proto-py-library
)
endif() # NOT WIN32

file(
GLOB generated-py
${CMAKE_CURRENT_BINARY_DIR}/../../core/*_pb2.py
Expand All @@ -151,9 +117,3 @@ install(
CODE "file(INSTALL \${_Wheel} DESTINATION \"${CMAKE_INSTALL_PREFIX}/python\")"
)

if (NOT WIN32)
install(
CODE "file(GLOB _Wheel \"${CMAKE_CURRENT_BINARY_DIR}/linux/triton*.whl\")"
CODE "file(INSTALL \${_Wheel} DESTINATION \"${CMAKE_INSTALL_PREFIX}/python\")"
)
endif() # NOT WIN32
53 changes: 10 additions & 43 deletions src/python/library/build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,6 @@ def sed(pattern, replace, source, dest=None):
parser.add_argument(
"--dest-dir", type=str, required=True, help="Destination directory."
)
parser.add_argument(
"--linux",
action="store_true",
required=False,
help="Include linux specific artifacts.",
)
parser.add_argument(
"--perf-analyzer",
type=str,
required=False,
default=None,
help="perf-analyzer path.",
)

FLAGS = parser.parse_args()

FLAGS.triton_version = None
Expand Down Expand Up @@ -118,9 +104,8 @@ def sed(pattern, replace, source, dest=None):
cpdir("tritonhttpclient", os.path.join(FLAGS.whl_dir, "tritonhttpclient"))
if os.path.isdir("tritongrpcclient"):
cpdir("tritongrpcclient", os.path.join(FLAGS.whl_dir, "tritongrpcclient"))
if FLAGS.linux:
if os.path.isdir("tritonshmutils"):
cpdir("tritonshmutils", os.path.join(FLAGS.whl_dir, "tritonshmutils"))
if os.path.isdir("tritonshmutils"):
cpdir("tritonshmutils", os.path.join(FLAGS.whl_dir, "tritonshmutils"))

if os.path.isdir("tritonclient/grpc"):
cpdir("tritonclient/grpc", os.path.join(FLAGS.whl_dir, "tritonclient/grpc"))
Expand Down Expand Up @@ -169,50 +154,32 @@ def sed(pattern, replace, source, dest=None):
os.path.join(FLAGS.whl_dir, "tritonclient/utils/_shared_memory_tensor.py"),
)

if FLAGS.linux:
if os.path.isdir("tritonclient/utils/shared_memory"):
cpdir(
"tritonclient/utils/shared_memory",
os.path.join(FLAGS.whl_dir, "tritonclient/utils/shared_memory"),
)
if os.path.isdir("tritonclient/utils/cuda_shared_memory"):
cpdir(
"tritonclient/utils/cuda_shared_memory",
os.path.join(FLAGS.whl_dir, "tritonclient/utils/cuda_shared_memory"),
)

# Copy the pre-compiled perf_analyzer binary
if FLAGS.perf_analyzer is not None:
# The permission bits need to be copied to along with the executable
shutil.copy(
FLAGS.perf_analyzer, os.path.join(FLAGS.whl_dir, "perf_analyzer")
)

# Create a symbolic link for backwards compatibility
if not os.path.exists(os.path.join(FLAGS.whl_dir, "perf_client")):
os.symlink("perf_analyzer", os.path.join(FLAGS.whl_dir, "perf_client"))

shutil.copyfile("LICENSE.txt", os.path.join(FLAGS.whl_dir, "LICENSE.txt"))
shutil.copyfile("setup.py", os.path.join(FLAGS.whl_dir, "setup.py"))
cpdir("requirements", os.path.join(FLAGS.whl_dir, "requirements"))

os.chdir(FLAGS.whl_dir)
print("=== Building wheel")
if FLAGS.linux:
if os.uname().machine == "aarch64":
platform_name = "manylinux2014_aarch64"
elif os.uname().machine == "ppc64le":
platform_name = "manylinux2014_ppc64le"
else:
platform_name = "manylinux1_x86_64"
args = ["python3", "setup.py", "bdist_wheel", "--plat-name", platform_name]
else:
args = ["python3", "setup.py", "bdist_wheel"]

wenv = os.environ.copy()
wenv["VERSION"] = FLAGS.triton_version
p = subprocess.Popen(args, env=wenv)

print("=== Building wheel")
p = subprocess.Popen(
["python3", "setup.py", "bdist_wheel"],
env=wenv,
)
p.wait()
fail_if(p.returncode != 0, "setup.py failed")

cpdir("dist", FLAGS.dest_dir)

print("=== Output wheel file is in: {}".format(FLAGS.dest_dir))
Expand Down
2 changes: 0 additions & 2 deletions src/python/library/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ def req_file(filename, folder="requirements"):
data_files = [
("", ["LICENSE.txt"]),
]
if (PLATFORM_FLAG != "any") and ("@TRITON_PACKAGE_PERF_ANALYZER@" == "ON"):
data_files += [("bin", ["perf_analyzer", "perf_client"])]

setup(
name="tritonclient",
Expand Down
Loading