diff --git a/doc/LATEST_PACKAGES.md b/doc/LATEST_PACKAGES.md index 98bef9246dea4a8b112699f8ed54d969ea32864d..038641afd38192da5b99f714d278232d3ad79fb4 100644 --- a/doc/LATEST_PACKAGES.md +++ b/doc/LATEST_PACKAGES.md @@ -14,11 +14,17 @@ https://paddle-serving.bj.bcebos.com/whl/paddle_serving_server-0.3.2-py2-none-an ## GPU server ### Python 3 ``` -https://paddle-serving.bj.bcebos.com/whl/paddle_serving_server_gpu-0.3.2-py3-none-any.whl +#cuda 9.0 +https://paddle-serving.bj.bcebos.com/whl/paddle_serving_server_gpu-0.3.2.post9-py3-none-any.whl +#cuda 10.0 +https://paddle-serving.bj.bcebos.com/whl/paddle_serving_server_gpu-0.3.2.post10-py3-none-any.whl ``` ### Python 2 ``` -https://paddle-serving.bj.bcebos.com/whl/paddle_serving_server_gpu-0.3.2-py2-none-any.whl +#cuda 9.0 +https://paddle-serving.bj.bcebos.com/whl/paddle_serving_server_gpu-0.3.2.post9-py2-none-any.whl +#cuda 10.0 +https://paddle-serving.bj.bcebos.com/whl/paddle_serving_server_gpu-0.3.2.post10-py2-none-any.whl ``` ## Client diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 098453a2da2411f5bb83cbdd248898e8879a3922..edec41573b67f50feca52ee017bae2d7fa2b28ac 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -83,6 +83,7 @@ if (SERVER) OUTPUT ${PADDLE_SERVING_BINARY_DIR}/.timestamp COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/paddle_serving_server_gpu/ ${PADDLE_SERVING_BINARY_DIR}/python/ + COMMAND env ${py_env} ${PYTHON_EXECUTABLE} paddle_serving_server_gpu/gen_cuda_version.py ${CUDA_VERSION_MAJOR} COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py bdist_wheel DEPENDS ${SERVING_SERVER_CORE} server_config_py_proto ${PY_FILES}) add_custom_target(paddle_python ALL DEPENDS ${PADDLE_SERVING_BINARY_DIR}/.timestamp) diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index 0261003a7863d11fb342d1572b124d1cbb533a2b..70e9d27ccdd802700893d7d6fbca90bf7b8852be 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -363,7 +363,15 @@ class Server(object): def download_bin(self): os.chdir(self.module_path) need_download = False - device_version = "serving-gpu-" + + #acquire lock + version_file = open("{}/version.py".format(self.module_path), "r") + import re + for line in version_file.readlines(): + if re.match("cuda_version", line): + cuda_version = line.split("\"")[1] + device_version = "serving-gpu-cuda" + cuda_version + "-" + folder_name = device_version + serving_server_version tar_name = folder_name + ".tar.gz" bin_url = "https://paddle-serving.bj.bcebos.com/bin/" + tar_name @@ -372,8 +380,6 @@ class Server(object): download_flag = "{}/{}.is_download".format(self.module_path, folder_name) - #acquire lock - version_file = open("{}/version.py".format(self.module_path), "r") fcntl.flock(version_file, fcntl.LOCK_EX) if os.path.exists(download_flag): @@ -385,6 +391,7 @@ class Server(object): os.system("touch {}/{}.is_download".format(self.module_path, folder_name)) print('Frist time run, downloading PaddleServing components ...') + r = os.system('wget ' + bin_url + ' --no-check-certificate') if r != 0: if os.path.exists(tar_name): diff --git a/python/paddle_serving_server_gpu/gen_cuda_version.py b/python/paddle_serving_server_gpu/gen_cuda_version.py new file mode 100644 index 0000000000000000000000000000000000000000..4a320a0e4dd9f9145a2c7682d5eecb7f582862b5 --- /dev/null +++ b/python/paddle_serving_server_gpu/gen_cuda_version.py @@ -0,0 +1,27 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import re +import os + +new_str = "" +with open("paddle_serving_server_gpu/version.py", "r") as f: + for line in f.readlines(): + if re.match("cuda_version", line): + line = re.sub(r"\d+", sys.argv[1], line) + new_str = new_str + line + +with open("paddle_serving_server_gpu/version.py", "w") as f: + f.write(new_str) diff --git a/python/paddle_serving_server_gpu/version.py b/python/paddle_serving_server_gpu/version.py index f7fc14b2a7f0c25b471e8d3bb44e9d6db6839d01..2272c3aa91f999697ea8ef3e2cdb585b01db8bed 100644 --- a/python/paddle_serving_server_gpu/version.py +++ b/python/paddle_serving_server_gpu/version.py @@ -15,3 +15,4 @@ serving_client_version = "0.3.2" serving_server_version = "0.3.2" module_proto_version = "0.3.2" +cuda_version = "9" diff --git a/python/setup.py.server_gpu.in b/python/setup.py.server_gpu.in index 65dec4621fceba3967ff21814b218c0229a5124b..4554c1d368f70a32d16ceeabb54d63625f9f256d 100644 --- a/python/setup.py.server_gpu.in +++ b/python/setup.py.server_gpu.in @@ -41,7 +41,6 @@ REQUIRED_PACKAGES = [ 'paddle_serving_client', 'flask >= 1.1.1', 'paddle_serving_app' ] - packages=['paddle_serving_server_gpu', 'paddle_serving_server_gpu.proto', 'paddle_serving_server_gpu.pipeline', @@ -58,7 +57,7 @@ package_dir={'paddle_serving_server_gpu': setup( name='paddle-serving-server-gpu', - version=serving_server_version.replace('-', ''), + version=serving_server_version.replace('-', '') + '.post@CUDA_VERSION_MAJOR@', description= ('Paddle Serving Package for saved model with PaddlePaddle'), url='https://github.com/PaddlePaddle/Serving',