| 3847 | } // namespace gpu |
| 3848 | |
| 3849 | void initialize_cublas() { |
| 3850 | port::Status status = |
| 3851 | PluginRegistry::Instance()->RegisterFactory<PluginRegistry::BlasFactory>( |
| 3852 | cuda::kCudaPlatformId, gpu::kCuBlasPlugin, "cuBLAS", |
| 3853 | [](internal::StreamExecutorInterface *parent) -> blas::BlasSupport * { |
| 3854 | gpu::GpuExecutor *cuda_executor = |
| 3855 | dynamic_cast<gpu::GpuExecutor *>(parent); |
| 3856 | if (cuda_executor == nullptr) { |
| 3857 | LOG(ERROR) |
| 3858 | << "Attempting to initialize an instance of the cuBLAS " |
| 3859 | << "support library with a non-CUDA StreamExecutor"; |
| 3860 | return nullptr; |
| 3861 | } |
| 3862 | |
| 3863 | gpu::CUDABlas *blas = new gpu::CUDABlas(cuda_executor); |
| 3864 | if (!blas->Init()) { |
| 3865 | // Note: Init() will log a more specific error. |
| 3866 | delete blas; |
| 3867 | return nullptr; |
| 3868 | } |
| 3869 | return blas; |
| 3870 | }); |
| 3871 | |
| 3872 | if (!status.ok()) { |
| 3873 | LOG(ERROR) << "Unable to register cuBLAS factory: " |
| 3874 | << status.error_message(); |
| 3875 | } |
| 3876 | |
| 3877 | PluginRegistry::Instance()->SetDefaultFactory( |
| 3878 | cuda::kCudaPlatformId, PluginKind::kBlas, gpu::kCuBlasPlugin); |
| 3879 | } |
| 3880 | |
| 3881 | } // namespace stream_executor |
| 3882 |
no test coverage detected