Testing:
Root dir:
Running
python3 tool.py --inputfile function.c
Missing tool.py running screenshot.
Some last min error occurred due to multiple file inputs I will blog on diff blog if it is past 11:59.
ls:
running the executable which has adjust chanels with
arguments test/input/bree.jpg 1.0 3.0 5.0 and test/output/breelaa.jpg
We can run this on israel machine which is an armv8
./main tests/input/bree.jpg 1.0 3.0 5.0 tests/output/breelaa.jpg
Emulating SVE2 system using qemu-aarch64:
Runnig with same arguments:
qemu-aarch64 ./main tests/input/bree.jpg 1.0 3.0 5.0 tests/output/breel_qemu.jpg
The output are the same but the built implementation are different.
That does not mean that our function_sve2.o and function_asimd.o file are the same. I was working on comparing the .o files for diff arch using filecmp but no results. Still have written some code.
How to use the tool:
Run the tool which will accept the funciton.c file as an argument and produce the main exe file along with the functions it may use.
python3 tool.py --inputfile function.c
There are 2 test files (images) provided by the professor so we could use any of them.
./main tests/input/bree.jpg 1.0 3.0 5.0 tests/output/breelaa.jpg
The main executable will take the bree.jpg file and modify it based on the chosen function. So the first time we run the exe without qemu-aarch64 the asimd_adjust_chanels() function will be chosen using the iFunc resolver.
The output file should be stored in test/output dir. ## error
I forgot to share the screenshot of the modified tree after running the command.
The output image will be different from the original image.
References:
Help was provided by Naziur Khan.
Passing multiple arguments:
https://stackoverflow.com/questions/15753701/how-can-i-pass-a-list-as-a-command-line-argument-with-argparse
Using subprocess module: used when running external os system command and manuplate the command
subprocess.Popen() returns a exit code.
https://docs.python.org/3/library/subprocess.html
Extract a function writen in c from a file:
https://stackoverflow.com/questions/55078713/extract-function-code-from-c-sourcecode-file-with-python
Filecmp:
https://www.geeksforgeeks.org/python-filecmp-cmpfiles-method/
Top comments (0)