I am an undergraduate student working on my thesis about parallel programming. I am using OpenMP model. Now i want to use gem5 for measure performance. That's why i install gem5 Full System successfully by following link:
http://cearial01.kaist.ac.kr/index.php/2016/08/26/gem5-documentation/
Now i want to compile & run a c program with OpenMP (matmul.c) using gem5. How can i compile & run this program? I mean inside which folder i stored this program file (matmul.c) for compile? How i create object file of this program? How can i change no of processor, cache memory size, no of cpu during running & compilation?
I am new student of this section. That's why my asking list is too big! Hope anybody don't mind.
Best Regards, Litu
How to cross compile for an image is not gem5 specific, so I'll be brief.
First you must obtain a cross compiler for the image.
The best way to do that, is to get a cross compiler from the same source as the image to ensure compatibility.
My preferred approach is to use minimal Buildroot images. Buildroot:
This is my setup on GitHub. It contains a minimal OpenMP hello world which I have successfully run inside of gem5.
Another good option is to use https://crosstool-ng.github.io/
Since you want OpenMP support, you must build the GCC cross compiler compiler with support.
I think this is done in GCC with:
or through the Buildroot option:
And then when compiling, you must pass the
-fopenmp
option togcc
.The best way to answer that question yourself is to use something like:
and search the options.
You come across:
-n NUM_CPUS, --num-cpus=NUM_CPUS
.For ARM you also need to pass a
.dtb
with the corresponding core count, e.g.:./system/arm/dt/armv7_gem5_v1_2cpu.dtb
for 2 cores.caches: you will find the following options easily:
But keep in mind that:
HPI
and x86DerivO3CPU
, but notAtomicSimpleCPU
.