Skip to content

Commit

Permalink
Use regular debug macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed May 25, 2020
1 parent 46f5186 commit d180990
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GPUCompiler = "61eb1bfa-7361-4325-ad38-22787b887f55"
LLVM = "929cbde3-209d-540e-8aea-75f648917ca0"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Expand Down
8 changes: 6 additions & 2 deletions src/memory.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GPU memory management and pooling

using Printf
using Logging
using TimerOutputs

using Base: @lock
Expand Down Expand Up @@ -515,10 +516,13 @@ function __init_memory__()

# the user hand-picked an allocator, so be a little verbose
atexit(()->begin
Core.println("""
old_logger = global_logger()
global_logger(Logging.ConsoleLogger(Core.stderr, old_logger.min_level))
@debug """
CUDA.jl $(nameof(pool[])) statistics:
- $(alloc_stats.pool_nalloc) pool allocations: $(Base.format_bytes(alloc_stats.pool_alloc)) in $(Base.round(alloc_stats.pool_time; digits=2))s
- $(alloc_stats.actual_nalloc) CUDA allocations: $(Base.format_bytes(alloc_stats.actual_alloc)) in $(Base.round(alloc_stats.actual_time; digits=2))s""")
- $(alloc_stats.actual_nalloc) CUDA allocations: $(Base.format_bytes(alloc_stats.actual_alloc)) in $(Base.round(alloc_stats.actual_time; digits=2))s"""
global_logger(old_logger)
end)
end

Expand Down

0 comments on commit d180990

Please sign in to comment.