Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Defination of posix_memalign

johnsonjthomas
Beginner
810 Views
Hi,

I am trying to port TBB 2.2 to HP-UX IA64 platform. I happen to encounter an error when I was building TBB 2.2. The error is regarding the undefining of posix_memalign in /src/test/test_malloc/test_malloc_compliance.cpp (line no: 257). I checked for the defination of posix_memalign and everywhere the defination is given as

int posix_memalign (void **__memptr, size_t __alignment, size_t __size)

Line no: 257 in test_malloc_compliance.cpp is

Rposix_memalign=posix_memalign;

What is the above line supposed to mean (just giving posix_memalign without any parameters)?. Is there any other defination for posix_memalign such that it does not have any parameters?.

Any help would be great!

Thanks,
Johnson
0 Kudos
7 Replies
johnsonjthomas
Beginner
810 Views
Hi,

In order to bring more clarity about the problem that I posted in the above post, I have attached the build output file.

Any help would be great!

Thanks,
Johnson
0 Kudos
Alexandr_K_Intel1
810 Views
Rposix_memalign=posix_memalign means assigning Rposix_memalign pointer to posix_memalign. Could you check that header where posix_memalign defined on HP-UX is included to test_malloc_compliance.cpp?
0 Kudos
johnsonjthomas
Beginner
810 Views
Hi Alexandr,

Thanks for the reply. When you say that Rposix_memalign is assigned to posix_memalign, should it not be with parameters?. How can you define it just as posix_memalign() when actually its definition is int posix_memalign (void **__memptr, size_t __alignment, size_t __size) . I tried finding the definition of posix_memalign, but could not. The header files that are included are
#include
#include
#include
#include
#include

I checked in each of these files and I could not find the definition of posix_memalign. Is posix_memalign a standard function (I mean is it defined in /lib or someother system file)?. I was trying to solve other errors in the file build.txt. I encountered on errors such as error #3696-D: cannot open source file "tbb/parallel_for.h"

I am not able to understand how this type of error can happen. The only errors before this error is the posix_memalign and test_malloc_compliance.cpp errors. Could you tell me what is going on here as to why these errors are occuring. I have attached the build output with my previous post

Thanks,
Johnson
0 Kudos
Alexandr_K_Intel1
810 Views
Johnson,

posix_memalign is standard function. man posix_memalign should point out correct header where it declared. If there is no such man on HP-UX, you can tryto find it via something like
find /usr/include/ -type f|xargs grep posix_memalign
If there is no this function, you can take care of it by adding HP-UX to Solaris and Mac OS X in the line
#elif __APPLE__ || __sun // Max OS X and Solaris don't have posix_memalign
in setSystemAllocs() function.
0 Kudos
johnsonjthomas
Beginner
810 Views
Hi Alexandr,

Thanks a lot. It really helped!!

Thanks,
Johnson
0 Kudos
Alexey-Kukanov
Employee
810 Views
Hi Johnson,
What solution did you end up with? If you have some changes to the test and/or other codethat are must for HP-UX, please consider contributing those to TBB so that we can incorporate into future versions.
0 Kudos
johnsonjthomas
Beginner
810 Views
Hi Alexey,

What I mean by saying "It really worked" was that the posix_memalign error was rectified and now I am presently stuck with a linker error: Unsatisfied symbol. I have posted this here. I am trying to port TBB 2.2 to HPUX IA64 platform. As soon as I have ported it, I plan to contribute it here. But since I am an amateur and that this is my university project, it would be great if I can get help whenever I encounter errors. I will contribute whatever I get out of this.

Regards,
Johnson
0 Kudos
Reply