Skip to content

Commit a3b247a

Browse files
committed
fix
1 parent 27dfdbf commit a3b247a

File tree

3 files changed

+69
-36
lines changed

3 files changed

+69
-36
lines changed

cmake/external/xpu.cmake

+11-11
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ set(XPU_CUDA_RT_LIB "${XPU_LIB_DIR}/${XPU_CUDA_RT_LIB_NAME}")
164164
set(XPU_ML_LIB "${XPU_LIB_DIR}/${XPU_ML_LIB_NAME}")
165165
set(XPU_XFA_LIB "${XPU_LIB_DIR}/${XPU_XFA_LIB_NAME}")
166166
set(XPU_XPUDNN_LIB "${XPU_LIB_DIR}/${XPU_XPUDNN_LIB_NAME}")
167-
set(XPU_FFT_LIB "${XPU_LIB_DIR}/${XPU_FFT_LIB_NAME}")
168167

169168
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}" "${XPU_INSTALL_DIR}/lib")
170169

@@ -233,11 +232,12 @@ if(WITH_XPU_XRE5)
233232
DOWNLOAD_COMMAND
234233
bash ${CMAKE_SOURCE_DIR}/tools/xpu/pack_paddle_dependence.sh
235234
${XPU_XRE_URL} ${XPU_XRE_DIR_NAME} ${XPU_XHPC_URL} ${XPU_XHPC_DIR_NAME}
236-
${XPU_XCCL_URL} ${XPU_XCCL_DIR_NAME} ${XPU_FFT_URL} ${XPU_FFT_DIR_NAME} 1
237-
&& wget ${XPU_XFT_GET_DEPENCE_URL} && bash ${XFT_COMMAND} ${XPU_XFT_URL}
238-
${XPU_XFT_DIR_NAME} && bash
235+
${XPU_XCCL_URL} ${XPU_XCCL_DIR_NAME} 1 && wget ${XPU_XFT_GET_DEPENCE_URL}
236+
&& bash ${XFT_COMMAND} ${XPU_XFT_URL} ${XPU_XFT_DIR_NAME} && bash
239237
${CMAKE_SOURCE_DIR}/tools/xpu/get_xpti_dependence.sh ${XPU_XPTI_URL}
240-
${XPU_XPTI_DIR_NAME}
238+
${XPU_XPTI_DIR_NAME} && bash
239+
${CMAKE_SOURCE_DIR}/tools/xpu/get_xpufft_dependence.sh ${XPU_FFT_URL}
240+
${XPU_FFT_DIR_NAME}
241241
DOWNLOAD_NO_PROGRESS 1
242242
UPDATE_COMMAND ""
243243
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${XPU_INSTALL_ROOT}
@@ -249,8 +249,7 @@ if(WITH_XPU_XRE5)
249249
BUILD_BYPRODUCTS ${XPU_RT_LIB}
250250
BUILD_BYPRODUCTS ${XPU_CUDA_RT_LIB}
251251
BUILD_BYPRODUCTS ${XPU_ML_LIB}
252-
BUILD_BYPRODUCTS ${XPU_BKCL_LIB}
253-
BUILD_BYPRODUCTS ${XPU_FFT_LIB})
252+
BUILD_BYPRODUCTS ${XPU_BKCL_LIB})
254253
else()
255254
ExternalProject_Add(
256255
${XPU_PROJECT}
@@ -260,11 +259,12 @@ else()
260259
DOWNLOAD_COMMAND
261260
bash ${CMAKE_SOURCE_DIR}/tools/xpu/pack_paddle_dependence.sh
262261
${XPU_XRE_URL} ${XPU_XRE_DIR_NAME} ${XPU_XHPC_URL} ${XPU_XHPC_DIR_NAME}
263-
${XPU_XCCL_URL} ${XPU_XCCL_DIR_NAME} ${XPU_FFT_URL} ${XPU_FFT_DIR_NAME} 0
264-
&& wget ${XPU_XFT_GET_DEPENCE_URL} && bash get_xft_dependence.sh
265-
${XPU_XFT_URL} ${XPU_XFT_DIR_NAME} && bash
262+
${XPU_XCCL_URL} ${XPU_XCCL_DIR_NAME} 0 && wget ${XPU_XFT_GET_DEPENCE_URL}
263+
&& bash get_xft_dependence.sh ${XPU_XFT_URL} ${XPU_XFT_DIR_NAME} && bash
266264
${CMAKE_SOURCE_DIR}/tools/xpu/get_xpti_dependence.sh ${XPU_XPTI_URL}
267-
${XPU_XPTI_DIR_NAME}
265+
${XPU_XPTI_DIR_NAME} && bash
266+
${CMAKE_SOURCE_DIR}/tools/xpu/get_xpufft_dependence.sh ${XPU_FFT_URL}
267+
${XPU_FFT_DIR_NAME}
268268
DOWNLOAD_NO_PROGRESS 1
269269
UPDATE_COMMAND ""
270270
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${XPU_INSTALL_ROOT}

tools/xpu/get_xpufft_dependence.sh

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -ex
18+
19+
FFT_URL=$1
20+
FFT_DIR_NAME=$2
21+
22+
if ! [ -n "$FFT_URL" ]; then
23+
exit 0
24+
fi
25+
26+
mkdir -p xpu/include/fft
27+
28+
function download_from_bos() {
29+
local url=$1
30+
wget --no-check-certificate ${url} -q -O tmp.tar.gz
31+
if [[ $? -ne 0 ]]; then
32+
echo "downloading failed: ${url}"
33+
exit 1
34+
fi
35+
tar xvf tmp.tar.gz
36+
rm -f tmp.tar.gz
37+
}
38+
39+
function check_files() {
40+
local files=("$@")
41+
for file in "${files[@]}";
42+
do
43+
echo "checking $file"
44+
if [[ ! -f $file ]]; then
45+
echo "checking failed: $file"
46+
exit 1
47+
else
48+
echo "checking ok: $file"
49+
fi
50+
done
51+
}
52+
53+
download_from_bos ${FFT_URL}
54+
check_files ${FFT_DIR_NAME}/include/cufft.h ${FFT_DIR_NAME}/lib64/libcufft.so
55+
cp -r ${FFT_DIR_NAME}/include/* xpu/include/xpu/
56+
cp -r ${FFT_DIR_NAME}/lib64/* xpu/lib/
57+
cp -r ${FFT_DIR_NAME}/include/* xpu/include/fft

tools/xpu/pack_paddle_dependence.sh

+1-25
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@ XHPC_DIR_NAME=$4
2626
XCCL_URL=$5
2727
XCCL_DIR_NAME=$6
2828

29-
XFFT_URL=$7
30-
XFFT_DIR_NAME=$8
31-
32-
WITH_XPU_XRE5=$9
29+
WITH_XPU_XRE5=$7
3330

3431
mkdir -p xpu/include/xhpc/xblas
3532
mkdir -p xpu/include/xhpc/xfa
3633
mkdir -p xpu/include/xhpc/xpudnn
37-
mkdir -p xpu/include/xfft
3834
mkdir -p xpu/include/xpu
3935
mkdir -p xpu/include/xre
4036
mkdir -p xpu/lib
@@ -103,13 +99,6 @@ function xccl_prepare() {
10399
patchelf --set-rpath '$ORIGIN/' xpu/lib/libbkcl.so
104100
}
105101

106-
function xfft_prepare() {
107-
check_files ${XFFT_DIR_NAME}/include/cufft.h ${XFFT_DIR_NAME}/lib64/libcufft.so
108-
cp -r ${XFFT_DIR_NAME}/include/* xpu/include/xpu/
109-
cp -r ${XFFT_DIR_NAME}/lib64/* xpu/lib/
110-
cp -r ${XFFT_DIR_NAME}/include/* xpu/include/xfft
111-
}
112-
113102
function local_prepare() {
114103
# xre prepare
115104
if [[ ! -d ${LOCAL_PATH}/${XRE_DIR_NAME} ]]; then
@@ -128,12 +117,6 @@ function local_prepare() {
128117
XHPC_TAR_NAME=${XHPC_DIR_NAME}.tar.gz
129118
tar -zxf ${LOCAL_PATH}/${XHPC_TAR_NAME} -C ${LOCAL_PATH}
130119
fi
131-
132-
# xfft prepare
133-
if [[ ! -d ${LOCAL_PATH}/${XFFT_DIR_NAME} ]]; then
134-
XFFT_TAR_NAME=${XFFT_DIR_NAME}.tar.gz
135-
tar -zxf ${LOCAL_PATH}/${XFFT_TAR_NAME} -C ${LOCAL_PATH}
136-
fi
137120
}
138121

139122
function local_assemble() {
@@ -146,11 +129,6 @@ function local_assemble() {
146129
cp -r ${LOCAL_PATH}/$XCCL_DIR_NAME/include/* xpu/include/xpu/
147130
cp -r ${LOCAL_PATH}/$XCCL_DIR_NAME/so/* xpu/lib/
148131

149-
# xfft assemble
150-
cp -r ${LOCAL_PATH}/$XFFT_DIR_NAME/include/* xpu/include/xpu/
151-
cp -r ${LOCAL_PATH}/$XFFT_DIR_NAME/so/* xpu/lib/
152-
cp -r ${LOCAL_PATH}/$XFFT_DIR_NAME/include/* xpu/include/xfft
153-
154132
# xhpc assemble
155133
cp -r ${LOCAL_PATH}/${XHPC_DIR_NAME}/xdnn/include/* xpu/include/
156134
cp -r ${LOCAL_PATH}/${XHPC_DIR_NAME}/xdnn/so/libxpuapi.so xpu/lib
@@ -183,9 +161,7 @@ else
183161
download_from_bos ${XRE_URL}
184162
download_from_bos ${XHPC_URL}
185163
download_from_bos ${XCCL_URL}
186-
download_from_bos ${XFFT_URL}
187164
xre_prepare
188165
xhpc_prepare
189166
xccl_prepare
190-
xfft_prepare
191167
fi

0 commit comments

Comments
 (0)