@@ -72,10 +72,12 @@ function generate_sm_version(){
72
72
}
73
73
74
74
function create_directories(){
75
- mkdir -p $OPS_SRC_DIR /tmp/paddlenlp_ops
76
- touch $OPS_SRC_DIR /tmp/setup.py
77
- touch $OPS_SRC_DIR /tmp/paddlenlp_ops/__init__.py
78
- echo ' # Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
75
+ for sm_version in " ${sm_versions[@]} " ; do
76
+ echo " create sm$sm_version "
77
+ mkdir -p $OPS_SRC_DIR /tmp/paddlenlp_ops
78
+ touch $OPS_SRC_DIR /tmp/setup.py
79
+ touch $OPS_SRC_DIR /tmp/paddlenlp_ops/__init__.py
80
+ echo ' # Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
79
81
#
80
82
# Licensed under the Apache License, Version 2.0 (the "License");
81
83
# you may not use this file except in compliance with the License.
@@ -110,11 +112,6 @@ def read(file: str):
110
112
content = f.read().strip()
111
113
return content
112
114
113
- def get_sm_version():
114
- prop = paddle.device.cuda.get_device_properties()
115
- cc = prop.major * 10 + prop.minor
116
- return cc
117
-
118
115
def read_version():
119
116
"""
120
117
read version and return content
@@ -123,7 +120,7 @@ def read_version():
123
120
124
121
formatted_date = datetime.now().date().strftime("%Y%m%d")
125
122
cuda_version = float(paddle.version.cuda())
126
- sm_version = get_sm_version()
123
+ sm_version=80
127
124
paddle_commit = paddle.__git_commit__[:7]
128
125
build_tag = "{}+cuda{}sm{}paddle{}".format(formatted_date, cuda_version, sm_version, paddle_commit)
129
126
@@ -195,12 +192,9 @@ try:
195
192
except ImportError:
196
193
logger.WARNING(f"No {module_name} ")
197
194
' > $OPS_SRC_DIR /tmp/paddlenlp_ops/__init__.py
198
-
199
- for sm_version in " ${sm_versions[@]} " ; do
200
- echo " create sm$sm_version "
201
- mkdir -p $OPS_SRC_DIR /tmp/paddlenlp_ops/sm${sm_version}
202
- touch $OPS_SRC_DIR /tmp/paddlenlp_ops/sm${sm_version} /__init__.py
203
- echo ' # Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
195
+ mkdir -p $OPS_SRC_DIR /tmp/paddlenlp_ops/sm${sm_version}
196
+ touch $OPS_SRC_DIR /tmp/paddlenlp_ops/sm${sm_version} /__init__.py
197
+ echo ' # Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
204
198
#
205
199
# Licensed under the Apache License, Version 2.0 (the "License");
206
200
# you may not use this file except in compliance with the License.
221
215
except ImportError:
222
216
logger.WARNING("No paddlenlp_ops_' ${sm_version} ' ops")
223
217
' > $OPS_SRC_DIR /tmp/paddlenlp_ops/sm${sm_version} /__init__.py
218
+ build_ops
224
219
done
225
220
}
226
221
@@ -239,11 +234,11 @@ function init() {
239
234
}
240
235
241
236
function build_ops() {
242
- for sm_version in " ${sm_versions[@]} " ; do
243
- echo " Building and installing for sm_version: $sm_version "
244
- build_and_install_ops $sm_version
245
- done
246
- return
237
+ echo " Building and installing for sm_version: $sm_version "
238
+ build_and_install_ops $sm_version
239
+ build_and_install_whl
240
+ unittest
241
+ cleanup
247
242
}
248
243
249
244
function copy_ops(){
@@ -280,6 +275,7 @@ function build_and_install_whl() {
280
275
echo -e " ${BLUE} [build]${NONE} building paddlenlp_ops wheel..."
281
276
rm -rf ./dist
282
277
cd ${TMP_DIR}
278
+ sed -i " s/sm_version=80/sm_version=${sm_version} /g" setup.py
283
279
${python} setup.py bdist_wheel --dist-dir ./$DIST_DIR
284
280
if [ $? -ne 0 ]; then
285
281
echo -e " ${RED} [FAIL]${NONE} build paddlenlp_ops wheel failed !"
@@ -297,7 +293,8 @@ function build_and_install_whl() {
297
293
fi
298
294
echo -e " ${BLUE} [install]${NONE} ${GREEN} paddlenlp_ops install success\n"
299
295
cd ..
300
- mv $DIST_DIR ../
296
+ mkdir -p ../$DIST_DIR
297
+ mv $DIST_DIR /* ../$DIST_DIR /
301
298
cd ..
302
299
}
303
300
@@ -332,10 +329,6 @@ trap 'abort' 0
332
329
set -e
333
330
334
331
init
335
- build_ops
336
- build_and_install_whl
337
- unittest
338
- cleanup
339
332
340
333
# get Paddle version
341
334
PADDLE_VERSION=` ${python} -c " import paddle; print(paddle.version.full_version)" `
0 commit comments