From b9933c56eae7314d97cddbf6578408e01c6640b0 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Mon, 29 May 2017 20:24:27 +0200 Subject: [PATCH 1/2] init that works with precompile (and fixes non initialization) --- src/CUBLAS.jl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/CUBLAS.jl b/src/CUBLAS.jl index 10a0949..1658eb3 100644 --- a/src/CUBLAS.jl +++ b/src/CUBLAS.jl @@ -6,7 +6,7 @@ # Created: 2014-08-27 # License: MIT # - +__precompile__(true) module CUBLAS using Compat importall Base.LinAlg.BLAS @@ -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") From e3ba4c8deed6f90cdb13cf0220ccb62a53142a3f Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Mon, 29 May 2017 20:27:09 +0200 Subject: [PATCH 2/2] remove Compat --- REQUIRE | 1 - src/CUBLAS.jl | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/REQUIRE b/REQUIRE index 2fecf01..0cf5fd9 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,2 @@ julia 0.5 -Compat 0.18.0 CUDArt 0.3.0 diff --git a/src/CUBLAS.jl b/src/CUBLAS.jl index 1658eb3..63455a7 100644 --- a/src/CUBLAS.jl +++ b/src/CUBLAS.jl @@ -8,7 +8,7 @@ # __precompile__(true) module CUBLAS -using Compat + importall Base.LinAlg.BLAS using CUDArt