Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

Commit

Permalink
init that works with precompile (and fixes non initialization)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed May 29, 2017
1 parent 423e561 commit b9933c5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/CUBLAS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Created: 2014-08-27
# License: MIT
#

__precompile__(true)
module CUBLAS
using Compat
importall Base.LinAlg.BLAS
Expand Down Expand Up @@ -74,16 +74,19 @@ end
# find the cublas library
const libcublas = Libdl.find_library(["libcublas"], ["/usr/local/cuda"])
if isempty(libcublas)
error("CUBLAS library cannot be found")
error("CUBLAS library cannot be found. Please make sure that CUDA is installed")
end

include("libcublas.jl")

# setup cublas handle
cublashandle = cublasHandle_t[0]
cublasCreate_v2(cublashandle)
# destroy cublas handle at julia exit
atexit(()->cublasDestroy_v2(cublashandle[1]))
const cublashandle = cublasHandle_t[0]

function __init__()
cublasCreate_v2(cublashandle)
# destroy cublas handle at julia exit
atexit(()->cublasDestroy_v2(cublashandle[1]))
end

include("blas.jl")
include("highlevel.jl")
Expand Down

0 comments on commit b9933c5

Please sign in to comment.