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

Commit

Permalink
Merge pull request #27 from JuliaGPU/sd/init
Browse files Browse the repository at this point in the history
init that works with precompile (and fixes non initialization)
  • Loading branch information
SimonDanisch authored May 29, 2017
2 parents 423e561 + e3ba4c8 commit 0f19aac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
julia 0.5
Compat 0.18.0
CUDArt 0.3.0
17 changes: 10 additions & 7 deletions src/CUBLAS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# Created: 2014-08-27
# License: MIT
#

__precompile__(true)
module CUBLAS
using Compat

importall Base.LinAlg.BLAS

using CUDArt
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 0f19aac

Please sign in to comment.