How to generate IACA analysis report for a c program?

44 Views Asked by At

I would like to analyze the effect, if any, #pragma GCC unroll n has on a simple for-loop summation program in C. From my research, I learned of the IACA tool and have downloaded it but I am having a hard time getting an analysis report as it is shown here.

Issue number 1: Configuring IACA. I noticed IACA is an app and not a collection of libraries but the app doesn't open, (should I be able to interact with it?). I extracted IACA files into its own folder in OS and No squiggly lines appeared under

#include <iacaMarks.h>

So I assumed it was on the right path but when I run the program I get the following error:

a.c:2:23: fatal error: iacaMarks.h: No such file or directory
#include <iacaMarks.h>
                      ^
compilation terminated.

Issue number 2: Which command prompt will produce the analysis report? From the IACA guide. I gathered the command prompt iaca -trace filename.c which I used in the terminal but received an error:

iaca : The term 'iaca' is not recognized as the name of a cmdlet..... most likely because it has not been integrated properly. 

I am getting a bit overwhelmed and could use some help.

  1. What am I doing wrong here?
  2. Is there an easier or another way to analyze performance changes due to loop unrolling? I have a limited capability of reading assembly code, but should I be able to gather any information regarding latency and throughput from it?

I am using a Windows machine with 64-bit operating system and x64-based processor. I have a GCC compiler and am using vs-code for c code and VS for assembly code. I don't think there is anything wrong with the C code but clearly, I am no expert so here it is:

#include <stdio.h>
#include <iacaMarks.h>

int main(){
int arr[50]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49};
int result=0;
#pragma GCC unroll 2
for(int i=0; i< 50; i++){
    IACA_VC64_START
result+=arr[i]; 

}
IACA_VC64_END

return 0;

}

To try get IACA on the right path did this: I created an IACA folder in OS and extracted the files there. There are 2 items in the folder, the first is the IACA app, and the 2nd is iacaMarks.c. Then I added

"C:\\iaca\\iaca-win64"

under Include path in c_cpp_preperties.json file.

0

There are 0 best solutions below