Where is gpu memory allocated in caffe?

187 views
Skip to first unread message

Fateh Singh

unread,
Jun 22, 2017, 12:08:59 AM6/22/17
to Caffe Users
Hi
I am writing a new layer. I am not very experienced in caffe.
I am not able to find where caffe is allocating memory for the gpu. I want to allocate memory for some intermediate results and the parameters to the kernel.
I want to know the name of the file where memory is being allocated.

Thanks

Yigit Polat

unread,
Jun 22, 2017, 6:41:31 AM6/22/17
to Caffe Users
as far as I understand, its using a unified memory interface called SharedMemory. You can share data between gpu and cpu using the exact same pointers. You simply call a sync function (I guess the derefencing operator is overloaded).

Fateh Singh

unread,
Jun 22, 2017, 8:01:10 AM6/22/17
to Caffe Users
@Yigit, where do I call the sync function?
Also,can I use cudaMalloc , cudaMemcpy as we do in normal cuda code?

Przemek D

unread,
Jun 22, 2017, 8:57:50 AM6/22/17
to Caffe Users
Take a look at the AccuracyLayer. It also owns some additional memory for intermediate results (the highlighted line), but uses a simple Blob for that. Blob is a somewhat easier to use wrapper around SharedMemory (mentioned by Yigit above).

Fateh Singh

unread,
Jun 23, 2017, 9:20:59 AM6/23/17
to Caffe Users
@Yigit , sorry I could not get what you were saying
@Przemek, thanks a lot , I think that should work...just went through documentation of blob.

I will update as soon as I get it working...



On Thursday, June 22, 2017 at 9:38:59 AM UTC+5:30, Fateh Singh wrote:
Reply all
Reply to author
Forward
0 new messages