target processor options for MacBook pro

Hi All,

I recently installed the FORTRAN compilers on a new MacBook Pro (2.4 GHz Intel Core i7, 4 GB RAM, OS 10.7.2, Xcode 4.2.1 (834)). I tried to compile a simple code:

pgf90 -Mextend -O2 -o icvn icvn.for

and got these errors:

icvn.for:73:no such instruction: vzeroupper' icvn.for:82:no such instruction: vzeroupper’
icvn.for:89:no such instruction: vzeroupper' icvn.for:95:no such instruction: vzeroupper’
icvn.for:98:no such instruction: vzeroupper' icvn.for:104:no such instruction: vzeroupper’
icvn.for:116:no such instruction: vzeroupper' icvn.for:125:no such instruction: vzeroupper’
icvn.for:128:no such instruction: vzeroupper' icvn.for:134:no such instruction: vzeroupper’
icvn.for:141:no such instruction: vzeroupper' icvn.for:145:no such instruction: vzeroupper’
icvn.for:150:no such instruction: vzeroupper' icvn.for:153:no such instruction: vzeroupper’
icvn.for:158:no such instruction: vzeroupper' icvn.for:264:no such instruction: vzeroupper’

I saw an earlier post on this, and the default target processor is not correct. I can compile without errors using -tp core2-64. However, I would like to actually target the correct, processor, but
I cannot find a list of acceptable target processors appropriate for my MacBook Pro (the man command does not work for some reason). Does anyone know the correct string for the -tp flag, and if so, how to make that option the default?

Thanks,

Jerry

Hi Jerry,

The target processor is actually correctly detecting that your Core i7 uses the Sandy Bridge microarchitecture and hence enables AVX code generation (vzeroupper is AVX). The problem is that the Mac OS Xcode hasn’t been updated to use AVX, in this particular case the assembler. We expected Apple to have an update, but unfortunately haven’t seen one yet. Hence in the meantime, you’ll need to target a slightly older processor such as Nehalem (-tp nehalem-64).

Best Regards,
Mat

Hi Mat,

Thanks for the quick reply. I guess I will wait for Apple to catch up.

On a related note, the -mcmodel=medium option does not seem to be available for Mac OS. Is there a way around this when compiling code with large arrays?

Thanks,

Jerry

On a related note, the -mcmodel=medium option does not seem to be available for Mac OS. Is there a way around this when compiling code with large arrays?

The medium memory model is only needed for large (>2GB) static objects (like fixed size arrays). The work around is to use dynamic memory allocation (i.e. allocatable arrays) and the flag “-Mlarge_arrays”.

Hope this helps,
Mat