Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function to reset the compile cache #508

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/GPUCompiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand All @@ -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
10 changes: 0 additions & 10 deletions src/rtlib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading