mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 08:21:53 +08:00
[build] support build sm 80,86,89,90 to one whl package (#6173)
* support build sm 80,86,89,90 to one whl package * create tmp dir before build custom ops in FD_UNIFY_BUILD mode * typo fix * ignore exceptions in xpu ..
This commit is contained in:
@@ -19,7 +19,30 @@ from fastdeploy.import_ops import import_custom_ops
|
||||
|
||||
PACKAGE = "fastdeploy.model_executor.ops.gpu"
|
||||
|
||||
import_custom_ops(PACKAGE, ".fastdeploy_ops", globals())
|
||||
|
||||
def decide_module():
|
||||
import paddle
|
||||
|
||||
prop = paddle.device.cuda.get_device_properties()
|
||||
sm_version = prop.major * 10 + prop.minor
|
||||
print(f"current sm_version={sm_version}")
|
||||
|
||||
import os
|
||||
|
||||
curdir = os.path.dirname(os.path.abspath(__file__))
|
||||
sm_version_path = os.path.join(curdir, f"fastdeploy_ops_{sm_version}")
|
||||
if os.path.exists(sm_version_path):
|
||||
return f".fastdeploy_ops_{sm_version}.fastdeploy_ops"
|
||||
return ".fastdeploy_ops"
|
||||
|
||||
|
||||
module_path = ".fastdeploy_ops"
|
||||
try:
|
||||
module_path = decide_module()
|
||||
except Exception as e:
|
||||
print(f"decide_module error, load custom_ops from .fastdeploy_ops: {e}")
|
||||
pass
|
||||
import_custom_ops(PACKAGE, module_path, globals())
|
||||
|
||||
|
||||
def tolerant_import_error():
|
||||
|
||||
Reference in New Issue
Block a user