Showing results for 
Search instead for 
Did you mean: 
Black Belt

macro to choose source for 256- vs. 512-bit ISA

I've been in the habit of using __MIC__ to tell the compiler how to vectorize (or not) e.g.

#if __MIC__
          a(:n)= pack(b(:n),b(:n)>0)
          j= 0
          do i= 1,n
            if(b(i) > 0.)then
                j= j+1
                a(j)= b(i)

or (for the case where the compiler vectorizes for AVX but loses performance)

#if ! __MIC__
!dir$ novector

Now that compilers support AVX512, it appears that additional macros will be needed, e.g.

#if (! __KNC__) && (! __AVX512F__)

Is there a better way?  Now that both ifort and gfortran are excessively aggressive sometimes about vectorization, I've introduced some conditional real,volatile :: declarations, but this is getting ugly.

I've been going through source code to remove conditional compilations where the latest Intel compilers make the right decision about vectorization, but it seems unlikely that compilers will get any better on this.


0 Kudos
1 Reply

Tim, we haven't created

Tim, we haven't created preprocessor symbols for instruction set subsets. If you know you are going to compile for AVX512 you can define your own symbol and reference it. I don't think our compiler wants to go down the path of specific macros for this sort of thing. Certainly we're interested in test cases where automatic vectorization hurts rather than helps - a Premier Support issue would be best for this sort of thing.

Retired 12/31/2016
0 Kudos