Skip to content

Commit b254da8

Browse files
committed
fix ci
1 parent 3adc43b commit b254da8

File tree

8 files changed

+21
-158
lines changed

8 files changed

+21
-158
lines changed

cmake/external/lapack.cmake

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,16 @@ SET(LAPACK_LIB_DIR ${LAPACK_INSTALL_DIR}/lib)
2424
# use lapack tag v3.10.0 on 06/28/2021 https://github.com/Reference-LAPACK/lapack
2525
if(LINUX)
2626
SET(LAPACK_VER "lapack_lnx_v3.10.0.20210628" CACHE STRING "" FORCE)
27-
SET(LAPACK_URL "http://paddlepaddledeps.bj.bcebos.com/${LAPACK_VER}.tar.gz" CACHE STRING "" FORCE)
28-
SET(LAPACK_URL_MD5 87eb9898d6922bf64fdf1f7b014363fc)
27+
SET(LAPACK_URL "https://paddlepaddledeps.bj.bcebos.com/${LAPACK_VER}.tar.gz" CACHE STRING "" FORCE)
28+
SET(LAPACK_URL_MD5 71f8cc8237a8571692f3e07f9a4f25f6)
2929
SET(GNU_RT_LIB_1 "${LAPACK_LIB_DIR}/libquadmath.so.0")
30-
SET(GNU_RT_LIB_2 "${LAPACK_LIB_DIR}/llibgcc_s.so.1")
3130
SET(GFORTRAN_LIB "${LAPACK_LIB_DIR}/libgfortran.so.3")
3231
SET(BLAS_LIB "${LAPACK_LIB_DIR}/libblas.so.3")
3332
SET(LAPACK_LIB "${LAPACK_LIB_DIR}/liblapack.so.3")
3433
elseif(WIN32)
3534
# Refer to [lapack-for-windows] http://icl.cs.utk.edu/lapack-for-windows/lapack/#lapacke
3635
SET(LAPACK_VER "lapack_win_v3.10.0.20210628" CACHE STRING "" FORCE)
37-
SET(LAPACK_URL "http://paddlepaddledeps.bj.bcebos.com/${LAPACK_VER}.zip" CACHE STRING "" FORCE)
36+
SET(LAPACK_URL "https://paddlepaddledeps.bj.bcebos.com/${LAPACK_VER}.zip" CACHE STRING "" FORCE)
3837
SET(LAPACK_URL_MD5 590d080392dcd5abbd5dca767a50b63a)
3938
SET(GNU_RT_LIB_1 "${LAPACK_LIB_DIR}/libquadmath-0.dll")
4039
SET(GNU_RT_LIB_2 "${LAPACK_LIB_DIR}/libgcc_s_seh-1.dll")
@@ -43,16 +42,15 @@ elseif(WIN32)
4342
SET(LAPACK_LIB "${LAPACK_LIB_DIR}/liblapack.dll")
4443
else()
4544
SET(LAPACK_VER "lapack_mac_v3.10.0.20210628" CACHE STRING "" FORCE)
46-
SET(LAPACK_URL "http://paddlepaddledeps.bj.bcebos.com/${LAPACK_VER}.tar.gz" CACHE STRING "" FORCE)
47-
SET(LAPACK_URL_MD5 09ed5048cb1edfab22f69c49b8dece79)
45+
SET(LAPACK_URL "https://paddlepaddledeps.bj.bcebos.com/${LAPACK_VER}.tar.gz" CACHE STRING "" FORCE)
46+
SET(LAPACK_URL_MD5 427aecf8dee8523de3566ca8e47944d7)
4847
SET(GNU_RT_LIB_1 "${LAPACK_LIB_DIR}/libquadmath.0.dylib")
4948
SET(GNU_RT_LIB_2 "${LAPACK_LIB_DIR}/libgcc_s.1.dylib")
5049
SET(GFORTRAN_LIB "${LAPACK_LIB_DIR}/libgfortran.5.dylib")
5150
SET(BLAS_LIB "${LAPACK_LIB_DIR}/libblas.3.dylib")
5251
SET(LAPACK_LIB "${LAPACK_LIB_DIR}/liblapack.3.dylib")
5352
endif()
5453

55-
5654
ExternalProject_Add(
5755
extern_lapack
5856
${EXTERNAL_PROJECT_LOG_ARGS}

paddle/fluid/operators/inverse_op.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License. */
1616

1717
#include "paddle/fluid/framework/op_registry.h"
1818
#include "paddle/fluid/operators/math/blas.h"
19-
#include "paddle/fluid/operators/math/lapack_function.h"
2019
#include "paddle/fluid/operators/math/matrix_inverse.h"
2120

2221
namespace paddle {
@@ -33,22 +32,6 @@ class InverseKernel : public framework::OpKernel<T> {
3332
auto& dev_ctx = context.template device_context<DeviceContext>();
3433
math::MatrixInverseFunctor<DeviceContext, T> mat_inv;
3534
mat_inv(dev_ctx, *input, output);
36-
37-
// Just test lapack in OP, not merge
38-
int m = 5;
39-
int n = 3;
40-
double A[5][3] = {{1, 2, 3}, {4, 5, 1}, {3, 5, 2}, {4, 1, 4}, {2, 5, 3}};
41-
int lda = 5;
42-
int ipiv[3] = {0, 0, 0};
43-
int info = 0;
44-
45-
VLOG(0) << "=====before dgetrf_:======" << A[0][0] << "===" << ipiv[0]
46-
<< "===" << info;
47-
48-
math::lapackLu<double>(m, n, A[0], lda, ipiv, &info);
49-
50-
VLOG(0) << "=====after dgetrf_:======" << A[0][0] << "===" << ipiv[0]
51-
<< "===" << info;
5235
}
5336
};
5437

paddle/fluid/operators/math/lapack_function.cc

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace paddle {
1919
namespace operators {
2020
namespace math {
2121

22-
// LU
22+
// LU (for example)
2323
template <>
2424
void lapackLu<double>(int m, int n, double *a, int lda, int *ipiv, int *info) {
2525
platform::dynload::dgetrf_(&m, &n, a, &lda, ipiv, info);
@@ -30,74 +30,6 @@ void lapackLu<float>(int m, int n, float *a, int lda, int *ipiv, int *info) {
3030
platform::dynload::sgetrf_(&m, &n, a, &lda, ipiv, info);
3131
}
3232

33-
// Solve
34-
template <>
35-
void lapackLuSolve<double>(char trans, int n, int nrhs, double *a, int lda,
36-
int *ipiv, double *b, int ldb, int *info) {
37-
platform::dynload::dgetrs_(&trans, &n, &nrhs, a, &lda, ipiv, b, &ldb, info);
38-
}
39-
40-
template <>
41-
void lapackLuSolve<float>(char trans, int n, int nrhs, float *a, int lda,
42-
int *ipiv, float *b, int ldb, int *info) {
43-
platform::dynload::sgetrs_(&trans, &n, &nrhs, a, &lda, ipiv, b, &ldb, info);
44-
}
45-
46-
// Cholesky
47-
template <>
48-
void lapackCholesky<double>(char uplo, int n, double *a, int lda, int *info) {
49-
platform::dynload::dpotrf_(&uplo, &n, a, &lda, info);
50-
}
51-
52-
template <>
53-
void lapackCholesky<float>(char uplo, int n, float *a, int lda, int *info) {
54-
platform::dynload::spotrf_(&uplo, &n, a, &lda, info);
55-
}
56-
57-
// Eig
58-
template <>
59-
void lapackEig<double>(char jobvl, char jobvr, int n, double *a, int lda,
60-
double *w, double *vl, int ldvl, double *vr, int ldvr,
61-
double *work, int lwork, double *rwork, int *info) {
62-
double *wr = w;
63-
double *wi = w + n;
64-
(void)rwork; // unused
65-
platform::dynload::dgeev_(&jobvl, &jobvr, &n, a, &lda, wr, wi, vl, &ldvl, vr,
66-
&ldvr, work, &lwork, info);
67-
}
68-
69-
template <>
70-
void lapackEig<float>(char jobvl, char jobvr, int n, float *a, int lda,
71-
float *w, float *vl, int ldvl, float *vr, int ldvr,
72-
float *work, int lwork, float *rwork, int *info) {
73-
float *wr = w;
74-
float *wi = w + n;
75-
(void)rwork; // unused
76-
platform::dynload::sgeev_(&jobvl, &jobvr, &n, a, &lda, wr, wi, vl, &ldvl, vr,
77-
&ldvr, work, &lwork, info);
78-
}
79-
80-
// Syevd
81-
template <>
82-
void lapackSyevd<double>(char jobz, char uplo, int n, double *a, int lda,
83-
double *w, double *work, int lwork, double *rwork,
84-
int lrwork, int *iwork, int liwork, int *info) {
85-
(void)rwork; // unused
86-
(void)lrwork; // unused
87-
platform::dynload::dsyevd_(&jobz, &uplo, &n, a, &lda, w, work, &lwork, iwork,
88-
&liwork, info);
89-
}
90-
91-
template <>
92-
void lapackSyevd<float>(char jobz, char uplo, int n, float *a, int lda,
93-
float *w, float *work, int lwork, float *rwork,
94-
int lrwork, int *iwork, int liwork, int *info) {
95-
(void)rwork; // unused
96-
(void)lrwork; // unused
97-
platform::dynload::ssyevd_(&jobz, &uplo, &n, a, &lda, w, work, &lwork, iwork,
98-
&liwork, info);
99-
}
100-
10133
} // namespace math
10234
} // namespace operators
10335
} // namespace paddle

paddle/fluid/operators/math/lapack_function.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,10 @@ namespace paddle {
1818
namespace operators {
1919
namespace math {
2020

21+
// LU (for example)
2122
template <typename T>
2223
void lapackLu(int m, int n, T *a, int lda, int *ipiv, int *info);
2324

24-
template <typename T>
25-
void lapackLuSolve(char trans, int n, int nrhs, T *a, int lda, int *ipiv, T *b,
26-
int ldb, int *info);
27-
28-
template <typename T>
29-
void lapackCholesky(char uplo, int n, T *a, int lda, int *info);
30-
31-
template <typename T1, typename T2 = T1>
32-
void lapackEig(char jobvl, char jobvr, int n, T1 *a, int lda, T1 *w, T1 *vl,
33-
int ldvl, T1 *vr, int ldvr, T1 *work, int lwork, T2 *rwork,
34-
int *info);
35-
36-
template <typename T1, typename T2 = T1>
37-
void lapackSyevd(char jobz, char uplo, int n, T1 *a, int lda, T2 *w, T1 *work,
38-
int lwork, T2 *rwork, int lrwork, int *iwork, int liwork,
39-
int *info);
40-
4125
} // namespace math
4226
} // namespace operators
4327
} // namespace paddle

paddle/fluid/platform/dynload/lapack.h

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,15 @@ limitations under the License. */
1818
#include "paddle/fluid/platform/dynload/dynamic_loader.h"
1919
#include "paddle/fluid/platform/port.h"
2020

21-
// Note(zhouwei): because lapack doesn't provide appropriate header file
22-
// getrf
21+
// Note(zhouwei): because lapack doesn't provide appropriate header file.
22+
// should expose API statement yourself.
23+
24+
// getrf_(For example)
2325
extern "C" void dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv,
2426
int *info);
2527
extern "C" void sgetrf_(int *m, int *n, float *a, int *lda, int *ipiv,
2628
int *info);
2729

28-
// getrs
29-
extern "C" void dgetrs_(char *trans, int *n, int *nrhs, double *a, int *lda,
30-
int *ipiv, double *b, int *ldb, int *info);
31-
extern "C" void sgetrs_(char *trans, int *n, int *nrhs, float *a, int *lda,
32-
int *ipiv, float *b, int *ldb, int *info);
33-
34-
// potrf
35-
extern "C" void dpotrf_(char *uplo, int *n, double *a, int *lda, int *info);
36-
extern "C" void spotrf_(char *uplo, int *n, float *a, int *lda, int *info);
37-
38-
// geev
39-
extern "C" void dgeev_(char *jobvl, char *jobvr, int *n, double *a, int *lda,
40-
double *wr, double *wi, double *vl, int *ldvl,
41-
double *vr, int *ldvr, double *work, int *lwork,
42-
int *info);
43-
extern "C" void sgeev_(char *jobvl, char *jobvr, int *n, float *a, int *lda,
44-
float *wr, float *wi, float *vl, int *ldvl, float *vr,
45-
int *ldvr, float *work, int *lwork, int *info);
46-
47-
// syevd
48-
extern "C" void dsyevd_(char *jobz, char *uplo, int *n, double *a, int *lda,
49-
double *w, double *work, int *lwork, int *iwork,
50-
int *liwork, int *info);
51-
extern "C" void ssyevd_(char *jobz, char *uplo, int *n, float *a, int *lda,
52-
float *w, float *work, int *lwork, int *iwork,
53-
int *liwork, int *info);
54-
5530
namespace paddle {
5631
namespace platform {
5732
namespace dynload {
@@ -83,15 +58,7 @@ extern void *lapack_dso_handle;
8358

8459
#define LAPACK_ROUTINE_EACH(__macro) \
8560
__macro(dgetrf_); \
86-
__macro(sgetrf_); \
87-
__macro(dgetrs_); \
88-
__macro(sgetrs_); \
89-
__macro(dpotrf_); \
90-
__macro(spotrf_); \
91-
__macro(dgeev_); \
92-
__macro(sgeev_); \
93-
__macro(dsyevd_); \
94-
__macro(ssyevd_);
61+
__macro(sgetrf_);
9562

9663
LAPACK_ROUTINE_EACH(DECLARE_DYNAMIC_LOAD_LAPACK_WRAP);
9764

paddle/scripts/paddle_build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,6 @@ function card_test() {
11531153
}
11541154

11551155
function parallel_test_base_gpu() {
1156-
GLOG_v=3 python3.7 -c "import paddle;paddle.to_tensor([[2, 0], [0, 2]], dtype='float32').inverse()"
11571156
if [ ${WITH_TESTING:-ON} == "ON" ] ; then
11581157
cat <<EOF
11591158
========================================

python/paddle/fluid/tests/unittests/test_var_base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ def _test_place(place):
227227
self.assertTrue(np.array_equal(x.numpy(), numpy_array))
228228
self.assertEqual(x.type, core.VarDesc.VarType.LOD_TENSOR)
229229

230-
x = paddle.to_tensor([[2, 0], [0, 2]], dtype='float32')
231-
print(x.inverse) # [[0.5, 0], [0, 0.5]]
232-
233230
with self.assertRaises(ValueError):
234231
paddle.randn([3, 2, 2]).item()
235232
with self.assertRaises(ValueError):

python/setup.py.in

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,19 +302,22 @@ package_dir={
302302
# put all thirdparty libraries in paddle.libs
303303
libs_path='${PADDLE_BINARY_DIR}/python/paddle/libs'
304304

305+
package_data['paddle.libs']= []
305306
package_data['paddle.libs']=[('libwarpctc' if os.name != 'nt' else 'warpctc') + ext_name]
306307
shutil.copy('${WARPCTC_LIBRARIES}', libs_path)
307308

308-
package_data['paddle.libs']+=[os.path.basename('${LAPACK_LIB}'),
309+
package_data['paddle.libs']+=[
310+
os.path.basename('${LAPACK_LIB}'),
309311
os.path.basename('${BLAS_LIB}'),
310-
os.path.basename('${GNU_RT_LIB_1}'),
311-
os.path.basename('${GNU_RT_LIB_2}'),
312-
os.path.basename('${GFORTRAN_LIB}')]
312+
os.path.basename('${GFORTRAN_LIB}'),
313+
os.path.basename('${GNU_RT_LIB_1}')]
313314
shutil.copy('${BLAS_LIB}', libs_path)
314315
shutil.copy('${LAPACK_LIB}', libs_path)
315-
shutil.copy('${GNU_RT_LIB_1}', libs_path)
316-
shutil.copy('${GNU_RT_LIB_2}', libs_path)
317316
shutil.copy('${GFORTRAN_LIB}', libs_path)
317+
shutil.copy('${GNU_RT_LIB_1}', libs_path)
318+
if not sys.platform.startswith("linux"):
319+
package_data['paddle.libs']+=[os.path.basename('${GNU_RT_LIB_2}')]
320+
shutil.copy('${GNU_RT_LIB_2}', libs_path)
318321

319322
if '${WITH_MKL}' == 'ON':
320323
shutil.copy('${MKLML_SHARED_LIB}', libs_path)

0 commit comments

Comments
 (0)