diff --git a/CMakeLists.txt b/CMakeLists.txt index 83191254f1a229ccfdb7497ea9c5cbe9a2830064..0f25e7d9dc771829f352b70bc16b90cb7d34eae8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,6 +222,8 @@ option(WITH_MIPS "Compile PaddlePaddle with mips support" OFF) option(WITH_MUSL "Compile with musl libc instead of gblic" OFF) option(WITH_UNITY_BUILD "Compile with UnityBuild mode" OFF) option(WITH_STRIP "Strip so files of Whl packages" OFF) +option(NEW_RELEASE_CUBIN "PaddlePaddle next-level release strategy for pypi cubin package" OFF) +option(NEW_RELEASE_JIT "PaddlePaddle next-level release strategy for backup jit package" OFF) # PY_VERSION if(NOT PY_VERSION) diff --git a/cmake/cuda.cmake b/cmake/cuda.cmake index e1a9324650ac9c2c595ea7727354069080df10c1..f9c896acd89018df4fc723c9b3e8afc28e5b97ab 100644 --- a/cmake/cuda.cmake +++ b/cmake/cuda.cmake @@ -3,10 +3,22 @@ if(NOT WITH_GPU) endif() -if (WITH_NV_JETSON) +if(WITH_NV_JETSON) add_definitions(-DWITH_NV_JETSON) set(paddle_known_gpu_archs "53 62 72") set(paddle_known_gpu_archs10 "53 62 72") +elseif(NEW_RELEASE_CUBIN) + message("Using New Release Strategy - Cubin Packge") + add_definitions(-DNEW_RELEASE_CUBIN) + set(paddle_known_gpu_archs "35 37 50 52 60 61 70 75 80 86") + set(paddle_known_gpu_archs10 "50 60 70 75") + set(paddle_known_gpu_archs11 "60 70 75 80") +elseif(NEW_RELEASE_JIT) + message("Using New Release Strategy - JIT Packge") + add_definitions(-DNEW_RELEASE_JIT) + set(paddle_known_gpu_archs "35 37 50 52 60 61 70 75 80 86") + set(paddle_known_gpu_archs10 "35 50 60 70 75") + set(paddle_known_gpu_archs11 "35 50 60 70 75 80") else() set(paddle_known_gpu_archs "35 50 52 60 61 70 75 80") set(paddle_known_gpu_archs10 "35 50 52 60 61 70 75") @@ -130,11 +142,17 @@ function(select_nvcc_arch_flags out_variable) set(cuda_arch_bin ${CUDA_ARCH_BIN}) endif() + if(NEW_RELEASE_JIT) + set(cuda_arch_ptx "${cuda_arch_ptx}${cuda_arch_bin}") + set(cuda_arch_bin "") + endif() + # remove dots and convert to lists string(REGEX REPLACE "\\." "" cuda_arch_bin "${cuda_arch_bin}") string(REGEX REPLACE "\\." "" cuda_arch_ptx "${CUDA_ARCH_PTX}") string(REGEX MATCHALL "[0-9()]+" cuda_arch_bin "${cuda_arch_bin}") string(REGEX MATCHALL "[0-9]+" cuda_arch_ptx "${cuda_arch_ptx}") + list(REMOVE_DUPLICATES cuda_arch_bin) list(REMOVE_DUPLICATES cuda_arch_ptx) diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index 1c38d5197986669398b23b7516d88f9ff6dafa61..ce338275b29358cf709ad5fbde4b4a3b1f6689ac 100755 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -14,7 +14,7 @@ try: from paddle.version import full_version as __version__ from paddle.version import commit as __git_commit__ - + from paddle.cuda_env import * except ImportError: import sys sys.stderr.write('''Warning with import paddle: you should not diff --git a/python/setup.py.in b/python/setup.py.in index 499054492694881237dff771b7ad49310931a48b..8f9f973d933933695b5b251e426933e22cad6366 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -106,6 +106,20 @@ def mkl(): write_version_py(filename='@PADDLE_BINARY_DIR@/python/paddle/version.py') +def write_cuda_env_config_py(filename='paddle/cuda_env.py'): + cnt = "" + if '${JIT_RELEASE_WHL}' == 'ON': + cnt = '''# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY +# +import os +os.environ['CUDA_CACHE_MAXSIZE'] = '805306368' +''' + + with open(filename, 'w') as f: + f.write(cnt) + +write_cuda_env_config_py(filename='@PADDLE_BINARY_DIR@/python/paddle/cuda_env.py') + def write_distributed_training_mode_py(filename='paddle/fluid/incubate/fleet/parameter_server/version.py'): cnt = '''from __future__ import print_function @@ -414,11 +428,10 @@ class InstallCommand(InstallCommandBase): def finalize_options(self): ret = InstallCommandBase.finalize_options(self) self.install_lib = self.install_platlib - self.install_headers = os.path.join(self.install_platlib, 'paddle', - 'include') + self.install_headers = os.path.join(self.install_platlib, 'paddle', 'include') + return ret - class InstallHeaders(Command): """Override how headers are copied. """