1

I am trying to vectorize a loop using ivdep but I'm not getting any output. I looked at the documentation and used the flags mentioned there. This is my code:

int main()
{
int a[100], b[100];
int size = 100;

for (int i = 0; i < size; i++)
      a[i] = 5; 

#pragma GCC ivdep
   for (int i = 0; i < size; i++)
      b[i] = a[i] + i;
}

How I compile it:

g++ vectest.c -O2 -fopt-info-all -fopt-info-missed-all -o vectest
Moody
  • 1,297
  • 2
  • 12
  • 21

1 Answers1

0

You are missing the -g flag to make the GNU Debugger work. Compile it this way:

g++ vectest.c -O2 -g -fopt-info-all -fopt-info-missed-all -o vectest
Ronald Pereira
  • 397
  • 1
  • 3
  • 12
  • If isn't that you wanted as a answer, let me know. – Ronald Pereira Nov 16 '16 at 13:39
  • So I really misunderstood what you wanted there. Try to explain more about "what this output must be", please – Ronald Pereira Nov 16 '16 at 14:03
  • I just want it to tell me if the loop was vectorized or not. This is just a test program. I have a very large parallel application and I'm not getting any speed ups when I use #pragmas, and I cannot debug because I don't get any debugging vectorization output. Something like [this](http://stackoverflow.com/a/29292944/2942145) @Barretxx – Moody Nov 16 '16 at 14:08
  • Ah... I see it now. So, if you want to see if your program uses the parallelism in the best way it can use, so compile it without any optimization (-O0 flag). Then you will be able to see the sequential code running step by step. You think this way it will output what you want @Mo – Ronald Pereira Nov 16 '16 at 14:11
  • Sorry, misspelled you username @Moody * – Ronald Pereira Nov 16 '16 at 14:11
  • 2
    I got the output I need by using this: `g++ vectest.c -O3 -fopt-info-all -fopt-info-all-missed -o vectest` . I was using 'missed-all' instead of 'all-missed'. But now I have another problem. This only works if I specify `O3`, regardless of `ivdep`. Why won't `ivdep` work by itself? @Barretxx – Moody Nov 16 '16 at 14:22