Multi2Sim / multi2sim

Multi2Sim source code
GNU General Public License v3.0
115 stars 66 forks source link

Why do running a python script (executable) on Multi2sim gives an error “Invalid ELF file”? #45

Open MitaliSinha00 opened 7 years ago

MitaliSinha00 commented 7 years ago

I am trying to run a simple Hello world python script on Multi2sim (simulator for CPUs and GPUs to test & validate new hardware designs). I am new to Multi2sim and as per my research it seems that we have to first compile any python program normally and run the executable on multi2sim.

So, I made my hello world program executable by following the steps: 1) Adding "#! /usr/bin/python" to the first line of my script. 2) Renaming the script from hello.py to hello. 3) Running the command "chmod +x hello.py" on the terminal. 4) Finally run the executable using "./hello"

It is perfectly executing and output the result. But I am not able to run the same executable on multi2sim using the command: m2s ./hello It gives me the error: "Invalid ELF file"

My machine specifications are: Ubuntu 16.04.1 LTS, python 2.7 and python 3.5, Muti2sim 5.0

Oliver-Piorun commented 7 years ago

The issue is that a python script is not an ELF file. You need a program that is an actual binary file. A python script gets interpreted and cannot be run natively on a machine.

Greetings

MitaliSinha00 commented 7 years ago

Okay, thanks for your comment @Oliver-Piorun .

I also tried creating an executable using an open source tool called "pyinstaller". It creates a 64-bit executable (I think since my machine is 64-bit). But since 64-bit executables are not supported by multi2sim I am not able to run it.

Oliver-Piorun commented 7 years ago

Consider switching to C or C++ (if possible).

Greetings