File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -1623,6 +1623,7 @@ if(NOT INTERN_BUILD_MOBILE)
16231623 find_package (LAPACK)
16241624 if (LAPACK_FOUND)
16251625 set (USE_LAPACK 1)
1626+ list (APPEND Caffe2_PRIVATE_DEPENDENCY_LIBS ${LAPACK_LIBRARIES} )
16261627 endif ()
16271628
16281629 if (NOT USE_CUDA)
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ if((NOT BLAS_LIBRARIES)
153153 BLAS
154154 sgemm
155155 ""
156- "openblas;pthread" )
156+ "openblas;pthread;m " )
157157 if (BLAS_LIBRARIES)
158158 set (BLAS_INFO "open" )
159159 endif (BLAS_LIBRARIES)
Original file line number Diff line number Diff line change @@ -123,6 +123,30 @@ if(BLAS_FOUND)
123123 IF ((NOT LAPACK_INFO) AND (BLAS_INFO STREQUAL "open" ))
124124 SET (CMAKE_REQUIRED_LIBRARIES ${BLAS_LIBRARIES} )
125125 check_function_exists("cheev_" OPEN_LAPACK_WORKS)
126+ if (OPEN_LAPACK_WORKS)
127+ check_function_exists("cgesdd_" LAPACK_CGESDD_WORKS)
128+ if (NOT LAPACK_CGESDD_WORKS)
129+ find_library (GFORTRAN_LIBRARY
130+ NAMES libgfortran.a gfortran
131+ PATHS /usr/lib/gcc/aarch64-linux-gnu/9/
132+ /usr/lib/gcc/x86_64-redhat-linux/9/
133+ /usr/lib/gcc/aarch64-linux-gnu/8/
134+ /usr/lib/gcc/x86_64-redhat-linux/8/
135+ /usr/lib/gcc/aarch64-linux-gnu/7/
136+ /usr/lib/gcc/x86_64-redhat-linux/7/
137+ )
138+ list (APPEND CMAKE_REQUIRED_LIBRARIES "${GFORTRAN_LIBRARY} " )
139+ unset (LAPACK_CGESDD_WORKS CACHE )
140+ check_function_exists("cgesdd_" LAPACK_CGESDD_WORKS)
141+ if (LAPACK_CGESDD_WORKS)
142+ list (APPEND LAPACK_LIBRARIES "${GFORTRAN_LIBRARY} " )
143+ else ()
144+ message (WARNING "OpenBlas has been compiled with Lapack support, but cgesdd can not be used" )
145+ set (OPEN_LAPACK_WORKS NO )
146+ endif ()
147+ endif ()
148+ endif ()
149+
126150 set (CMAKE_REQUIRED_LIBRARIES)
127151 if (OPEN_LAPACK_WORKS)
128152 SET (LAPACK_INFO "open" )
You can’t perform that action at this time.
0 commit comments