提交 afc84114 编写于 作者: L liaogang

fix dsohandle bug

上级 5b8fe87f
......@@ -32,7 +32,7 @@ void* lapack_dso_handle = nullptr;
#define DYNAMIC_LOAD_LAPACK_WRAP(__name) \
struct DynLoad__##__name { \
template <typename... Args> \
int operator()(Args... args)->decltype(__name(args...)) { \
auto operator()(Args... args)->decltype(__name(args...)) { \
using lapack_func = decltype(__name(args...)) (*)(Args...); \
std::call_once(lapack_dso_flag, GetLapackDsoHandle, &lapack_dso_handle); \
void* p_##__name = dlsym(lapack_dso_handle, #__name); \
......@@ -47,15 +47,18 @@ void* lapack_dso_handle = nullptr;
__macro(clapack_sgetrf) \
__macro(clapack_dgetrf) \
__macro(clapack_sgetri) \
__macro(clapack_dgetri)
__macro(clapack_dgetri)
#else
#define LAPACK_ROUTINE_EACH(__macro) \
__macro(LAPACKE_sgetrf) \
__macro(LAPACKE_dgetrf) \
__macro(LAPACKE_sgetri) \
__macro(LAPACKE_dgetri)
__macro(LAPACKE_dgetri)
#endif
#endif
LAPACK_ROUTINE_EACH(DYNAMIC_LOAD_LAPACK_WRAP)
// clang-format on
} // namespace dynload
......
......@@ -12,12 +12,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#ifndef HL_DYNAMIC_LOAD_H_
#define HL_DYNAMIC_LOAD_H_
#ifndef DYNAMIC_LOAD_H_
#define DYNAMIC_LOAD_H_
#include <dlfcn.h>
#include <memory>
#include <string>
#include <mutex>
/**
* @brief load the DSO of CUBLAS
......@@ -59,4 +60,4 @@ void GetWarpCTCDsoHandle(void** dso_handle);
*/
void GetLapackDsoHandle(void** dso_handle);
#endif // HL_DYNAMIC_LOAD_H_
#endif // DYNAMIC_LOAD_H_
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册