Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

I'm having trouble implimenting ippsMalloc

dschaalma
Principiante
980 Vistas
Hi everyone, I am a real newbie to ICC, IPP, and C++ in general. I just downloaded the eval version of ICC & IPP to see if I can speed up an application using these tools. The error I'm getting is "identifier "ippsMalloc" is undefined" The original snip of source I'm trying to modify is this:
Code:
void *malloc_a(size_t size, size_t alignment) {
#if defined(USE_FFTWF)
  return fftwf_malloc(size);
#elif defined(HAVE__ALIGNED_MALLOC)
  return _aligned_malloc(size,alignment);
#elif defined(HAVE_MEMALIGN)
  return memalign(alignment,size);
#else
  PointerArith byteAlignment;
  void *pmem;
  void *palignedMem;
  void **pp;


My attempt at calling ippsMalloc looks like this:
Code:
void *malloc_a(size_t size, size_t alignment) {
#if defined(USE_FFTWF)
  return fftwf_malloc(size,);
#elif defined(USE_IPP) // My addition here
  return ippsMalloc(size,alignment); //My addition here
#elif defined(HAVE__ALIGNED_MALLOC)
  return _aligned_malloc(size,alignment);
#elif defined(HAVE_MEMALIGN)
  return memalign(alignment,size);
#else
  PointerArith byteAlignment;
  void *pmem;
  void *palignedMem;
  void **pp;


These are snippets of just the area where ippsMalloc needs to be called instead of the other libs. I have tried several variations of the size and alignment positions, but none seem to work. All the IPP include files are in the root of the source tree, so it is not a case of a missing file. I would really appreciate any help with this. Thanks for your time.
Regards, Daniel.
0 kudos
6 Respuestas
thorsan
Principiante
980 Vistas
I dont think there is anything called ippsMalloc...

Its ippMalloc or ippsMalloc_[TYPE], so i think that might be your problem



thorsan
dschaalma
Principiante
980 Vistas

ippsMalloc is a function defined in IPP5.1 in the file "ipps.h". I can find no reference to a function named ippMalloc. There IS an "ippiMalloc" in the file "ippi.h", but the file I'm trying to modify is part of a signal analysis program, and I am trying to use IPP instead of FFTW3. So, I need to figure out how to call the ippsMalloc function, instead of FFTW3. I still have not had success though.

Regards, Daniel.

Vladimir_Dudnik
Empleados
980 Vistas

Hello Daniel,

If you saw definition of ippsMalloc function in ipps.h file, you probably noticed that there is function's family for different data typesdeclared like:

/* /////////////////////////////////////////////////////////////////////////////
// Name: ippsMalloc
// Purpose: 32-byte aligned memory allocation
// Parameter:
// len number of elements (according to their type)
// Returns: pointer to allocated memory
//
// Notes: the memory allocated by ippsMalloc has to be free by ippsFree
// function only.
*/

IPPAPI( Ipp8u*, ippsMalloc_8u, (int len) )
IPPAPI( Ipp16u*, ippsMalloc_16u, (int len) )
IPPAPI( Ipp32u*, ippsMalloc_32u, (int len) )
IPPAPI( Ipp8s*, ippsMalloc_8s, (int len) )
IPPAPI( Ipp16s*, ippsMalloc_16s, (int len) )
IPPAPI( Ipp32s*, ippsMalloc_32s, (int len) )
IPPAPI( Ipp64s*, ippsMalloc_64s, (int len) )

IPPAPI( Ipp32f*, ippsMalloc_32f, (int len) )
IPPAPI( Ipp64f*, ippsMalloc_64f, (int len) )

IPPAPI( Ipp8sc*, ippsMalloc_8sc, (int len) )
IPPAPI( Ipp16sc*, ippsMalloc_16sc, (int len) )
IPPAPI( Ipp32sc*, ippsMalloc_32sc, (int len) )
IPPAPI( Ipp64sc*, ippsMalloc_64sc, (int len) )
IPPAPI( Ipp32fc*, ippsMalloc_32fc, (int len) )
IPPAPI( Ipp64fc*, ippsMalloc_64fc, (int len) )

It is not clear why do you tract it as ippsMalloc(int len, int alignment)?

Regards,
Vladimir

dschaalma
Principiante
980 Vistas

Ok, thank you. I am a real newbie to both C++ and IPP. These questions are most likely very irritating for someone who has been programming for a long time. I appreciate you taking the time to help. I have a LOT to learn, and I never used ICC or IPP until I downloaded the evaluation versions 3 days ago. I want to see if I can make this work with ICC and IPP before I spend the money to buy the full versions. I have VERY little programming experience, but I am just trying to optimize an Open Source application with ICC and IPP. If I can get a clean compile with the eval versions, then I will buy the full versions. Thanks again for your help and patience.

Regards, Daniel.

dschaalma
Principiante
980 Vistas

Ok, I tried using severalpermutationsof:

return ippsMalloc(int len, int alignment)

return ippsMalloc(int len)(int alignment)

return ippsMalloc(int len),(int alignment)

I just keep getting errors. One of these days, I'll get it figured out I hope :)

Regards, Daniel.

Vladimir_Dudnik
Empleados
980 Vistas

Hi Daniel,

you keep getting the errors because the only form of ippsMalloc function in IPP is ippsMalloc(int len); That's all. There is no "alignment" parameter in ippsMalloc function. See IPP manual for the details.

Regards,
Vladimir

Responder