mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

How a allocate two tempory memory in the Operator Cpp

Open Yezipiaomu opened this issue 9 years ago • 4 comments

Hi, all people , I want two tempory cpu memory in the Operator, but when I use

 std::vector<ResourceRequest> BackwardResource(
     const std::vector<TShape> &in_shape) const override {
   return {ResourceRequest::kTempSpace,ResourceRequest::kTempSpace};
 }

but when I use ctx.requested[0].get_host_space_typed and ctx.requested[0].get_host_space_typed

is seem the same memory !!!!! How I solve it !!!? Thank you !!

Yezipiaomu avatar Oct 29 '17 03:10 Yezipiaomu

but when I use ctx.requested[0].get_host_space_typed and ctx.requested[1].get_host_space_typed

Yezipiaomu avatar Oct 29 '17 03:10 Yezipiaomu

Based on your second post, it seems that you have found out the correct answer, right? The same Resource instance reuses the allocated memory space if the requested size is not bigger.

reminisce avatar Oct 31 '17 06:10 reminisce

No,when allocating the memory , the two tempspace point to the same address!

Yezipiaomu avatar Nov 10 '17 06:11 Yezipiaomu

@apache/mxnet-committers: This issue has been inactive for the past 90 days. It has no label and needs triage.

For general "how-to" questions, our user forum (and Chinese version) is a good place to get help.

szha avatar Feb 09 '18 12:02 szha