- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a fairly fundamental noob question I cant seem to find an answer to. I need to copy portions of one array to another array. Can I do the following, or will it give inconsistant results with aligned memory? Fundamentally, I'm interested in understanding how aligned memory is accessed. And specifically, I am doing an overlap/save convolution where I need to save off a chunk of one vector to be saved and then added to another vector later. Thanks!
int N1 = 200, N2 = 100;
Ipp32f init = 1.0;
Ipp32f* pSrc = ippsMalloc_32f(N1);
Ipp32f* pDst = ippsMalloc_32f(N2);
ippsSet_32f(init, pSrc, N1);
ippsZero_32f(pDst, N2);
// Important question: is this valid?
ippsCopy_32f(pSrc+N2, pDst, N2); //????
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
IPP memory allocation functions provide you 32-bytes aligned memory buffer in transparent manner. You just got aligned pSrc and pDst pointers. Of course you are able to copy part of this buffer into another place. IPP copy function will process both aligned and unaligned buffers.
Regards,
Vladimir
IPP memory allocation functions provide you 32-bytes aligned memory buffer in transparent manner. You just got aligned pSrc and pDst pointers. Of course you are able to copy part of this buffer into another place. IPP copy function will process both aligned and unaligned buffers.
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great, thanks for the quick reply! I hoped that was the case, as my experimental programs indicated such. But I wanted to verify that it wasnt just coincidence.
Thanks again!
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
May I ask what is the different between ippsMalloc/ippsFree and malloc/free ?
Ipp8u* pBuf = ippsMalloc_8u(8);
ippsFree(pBuf);
is lookly same as
Ipp8u* pBuf = (Ipp8u*)malloc(8*sizeof(Ipp8u));
ippsFree(pBuf);
so, why we should use ippsMalloc/ippsFree instead of using standard C funcion ?
Is there bonus beware to using ipp allocating/delocating memory function?
(more fast or always crash when pointer out of bound...etc)
thank you !!
May I ask what is the different between ippsMalloc/ippsFree and malloc/free ?
Ipp8u* pBuf = ippsMalloc_8u(8);
ippsFree(pBuf);
is lookly same as
Ipp8u* pBuf = (Ipp8u*)malloc(8*sizeof(Ipp8u));
ippsFree(pBuf);
so, why we should use ippsMalloc/ippsFree instead of using standard C funcion ?
Is there bonus beware to using ipp allocating/delocating memory function?
(more fast or always crash when pointer out of bound...etc)
thank you !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so, why we should use ippsMalloc/ippsFree instead of using standard C funcion ?
Is there bonus beware to using ipp allocating/delocating memory function?
Is there bonus beware to using ipp allocating/delocating memory function?
That's because of the performance of IPP functions can be significantly different when the operation with aligned or unaligned data...
Access to memory is faster if pointers to the data are aligned.
--Gennady
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's right. As Gennady mentioned, IPP memory allocation functions provide 32-bytes aligned buffer. Except that there is no difference between C run time malloc and IPP variant. Moreover, IPP memory allocation internally based on malloc. They just allocate a little bit bigger buffer, and return you 32-bytes aligned pointer inside of this buffer. That is why you need to call IPP memory deallocation functon, which know where the original pointer is located.
Regards,
Vladimir
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you two, I have more recognized SSE properties now.
just as wiki said :
http://en.wikipedia.org/wiki/Data_structure_alignment , the varible "align" is 32 in IPP.
just as wiki said :
http://en.wikipedia.org/wiki/Data_structure_alignment , the varible "align" is 32 in IPP.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page