【问题标题】:why does tensorflow allocate more memory than requested in gpu? Is there any function to determine how much the memory allocated?为什么 tensorflow 分配的内存比 gpu 中请求的多?是否有任何函数可以确定分配了多少内存?
【发布时间】:2017-06-02 23:41:54
【问题描述】:

以下问题不是关于如何config fraction of gpu memory used。

CPU:

FixedLengthRecordReaderV2 allocation_description { requested_bytes: 64 分配字节:64 分配器名称:“cpu”分配ID:107996

GPU:

重塑/形状”张量 { dtype: DT_INT32 shape { dim { size: 1 } } 分配描述{请求字节:4分配字节:256 分配器名称:“cuda_host_bfc”分配ID:329 ptr:1112161657600 } } }

“未知”张量 { dtype: DT_UINT8 shape { dim { size: 3073 } } 分配描述{请求字节:3073分配字节:3328 分配器名称:“gpu_bfc”分配ID:152161 has_single_reference: 真正的指针:1108327235584 } } }

重塑/形状”张量 { dtype: DT_INT32 shape { dim { size: 1 } } 分配描述{请求字节:4分配字节:256 分配器名称:“cuda_host_bfc”分配ID:329 ptr:1112161657600 } } }

DecodeRaw" 张量 { dtype: DT_UINT8 shape { dim { size: 3073 } } 分配描述{请求字节:3073分配字节:4864 分配器名称:“cuda_host_bfc”分配ID:35574 has_single_reference: true ptr: 1112190177280 } } }

转置/烫发”张量 { dtype: DT_INT32 shape { dim { size: 3 } } 分配描述{请求字节:12分配字节:256 分配器名称:“cuda_host_bfc”分配ID:331 ptr:1112161658112 } } }

stack" 张量 { dtype: DT_INT32 shape { dim { size: 3 } } 分配描述{请求字节:12分配字节:256 分配器名称:“cuda_host_bfc”分配ID:332 ptr:1112161658368 } } }

stack" 张量 { dtype: DT_INT32 shape { dim { size: 3 } } 分配描述{请求字节:12分配字节:256 分配器名称:“cuda_host_bfc”分配ID:332 ptr:1112161658368 } } }

stack" 张量 { dtype: DT_INT32 shape { dim { size: 3 } } 分配描述{请求字节:12分配字节:256 分配器名称:“cuda_host_bfc”分配ID:332 ptr:1112161658368 } } }

1.为什么tensorflow分配的内存比gpu请求的多?

2.有什么函数可以判断分配了多少内存吗?

对于第一个问题,我做客的目的是为了减少分配的频率。但是我不明白为什么 gpu 采用了这种机制,而 cpu 内存分配器却没有。

我对第二个问题更感兴趣。

有人知道答案吗?任何信息都会有所帮助。

【问题讨论】:

  • 不重复 (-:

标签: memory-management tensorflow


【解决方案1】:

这可能是由于内存alignment。 所以你不能得到小于 256 字节的内存块,如果你想要更多,它总是 256 字节的倍数。 (但这并不能解释“requested_bytes:3073allocated_bytes:4864”。)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-13
    • 1970-01-01
    • 1970-01-01
    • 2014-03-02
    • 2020-03-12
    • 1970-01-01
    • 2019-12-07
    • 2012-08-28
    相关资源
    最近更新 更多