diff --git a/src/GPUCompiler.jl b/src/GPUCompiler.jl index 02301ade..bae599c0 100644 --- a/src/GPUCompiler.jl +++ b/src/GPUCompiler.jl @@ -51,7 +51,10 @@ compile_cache = "" # defined in __init__() function __init__() STDERR_HAS_COLOR[] = get(stderr, :color, false) + create_compile_cache() +end +function create_compile_cache() dir = @get_scratch!("compiled") ## add the Julia version dir = joinpath(dir, "v$(VERSION.major).$(VERSION.minor)") @@ -64,4 +67,18 @@ function __init__() global compile_cache = dir end +# remove the existing cache +# NOTE: call this function from global scope, so any change triggers recompilation. +function reset_compile_cache() + dir = @get_scratch!("compiled") + lock(runtime_lock) do + rm(dir; force=true, recursive=true) + create_compile_cache() + end + + return +end +# backwards compatibility +const reset_runtime = reset_compile_cache + end # module diff --git a/src/rtlib.jl b/src/rtlib.jl index 7d0000ac..6c1ea0f8 100644 --- a/src/rtlib.jl +++ b/src/rtlib.jl @@ -144,13 +144,3 @@ const runtime_lock = ReentrantLock() return lib end end - -# remove the existing cache -# NOTE: call this function from global scope, so any change triggers recompilation. -function reset_runtime() - lock(runtime_lock) do - rm(compile_cache; recursive=true, force=true) - end - - return -end