Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
RE: [apple scitech] posix_memalign on PowerPC?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [apple scitech] posix_memalign on PowerPC?



>
> > Indeed, we just had to find a replacement for _posix_memalign for
> > MSVC
> > ... now it looks like we need a replacement here too!
> >
> > Please tell me what equivalent function your platform has (hint,
> on
> > windows it was called _aligned_malloc).
>
> I'm helping a PowerPC G5 user and a Linux developer port a science
> package (Eigen) to Mac. This works fine for me on Leopard/Intel, but
> doesn't work for the G5 user.
>
> Is _posix_memalign not defined for PowerPC, or is it another issue?
>
> Thanks,
> -Geoff
>  _______________________________________________

Hi Geoff,

posix_memalign is not necessary in OSX.

>From some alloc.c code I stumbled across:

#elif defined(__APPLE__)
    /*
     * malloc in Mac OS X guarantees 16 byte alignment.  And large
     * memory allocations are guaranteed to be page-aligned.  See
     * http://developer.apple.com/documentation/Performance/Conceptual/
     * ManagingMemory/Articles/MemoryAlloc.html
     * --
     * ekato Jan 23 2006
     */
    if (sizeof(ScmCell) <= 16)
        p = malloc(size);
    else
        PLAIN_ERR("cannot ensure memory alignment");

As noted in the comments above and the developer info, OSX
guarantees 16 byte alignment. So, you'll have to find some
way add in the code that sets this in the Eigen code.

Ian Kaufman
Research Systems Administrator
Jacobs School of Engineering

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Scitech mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >[apple scitech] posix_memalign on PowerPC? (From: Geoffrey Hutchison <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.