- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to generate the auto-vectorization report for the below snippet; however, I don't seem to get any vectorization report.
Please let me know if you have any clue ....
#include <cstdio>
#include <ctime>
#include <cstdlib>
#define NUMEL 100000
int main(char *argv[], int argc){
float *a, *b, *c;
a = (float*) _mm_malloc(NUMEL*sizeof(float), 128);
b = (float*) _mm_malloc(NUMEL*sizeof(float), 128);
c = (float*) _mm_malloc(NUMEL*sizeof(float), 128);
clock_t start = clock();
for(int i = 0; i < NUMEL; i++){
c[i] = a[i] / (b[i]+1);
}
clock_t end = clock();
printf("Loop Done1! \n");
printf("Time taken: %f \n", (double)(end-start)/CLOCKS_PER_SEC);
return 0;
}
Here is the command I use:
C:\tmp>icl -Qopt-report:1 -Qopt-report-phase:vec test.cpp && cat test.optrpt
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.2.254 Build 20200623
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
icl: remark #10397: optimization reports are generated in *.optrpt files in the output location
test.cpp
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
test.obj
C:\tmp>
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for reaching out. The vectorization report is not generated because the loop is a dead code and the compiler removes it. Either initialize the arrays or add a print statement in the loop, the vectorization report will be generated.
Initialization in the loop
clock_t start = clock();
for(int i = 0; i < NUMEL; i++){
a[i] = 10.0; //change 1
b[i] = 4.0; //change 2
c[i] = a[i] / (b[i]+1);
}
clock_t end = clock();
OR
printing in the loop
clock_t start = clock();
for(int i = 0; i < NUMEL; i++){
printf ("c is %f\n", c[NUMEL]);
c[i] = a[i] / (b[i]+1);
}
clock_t end = clock();
Compiling and displaying the results(same command that you've followed):
icl -Qopt-report:1 -Qopt-report-phase:vec test.cpp && cat test.optrpt
Compiler version: Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Build 20201112_000000
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
For more information on vectorization reports: https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-auto-vectorization-tutorial/top/tutorial-windows-version/generating-a-vectorization-report-1.html
Regards
Gopika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Has the solution provided helped? Please let us know if the issue persists.
Regards
Gopika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have not heard back from you, so I will close this query now. If you need further assistance, please post a new question.
Regards
Gopika

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page