Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find the application's PID, "Baseline power hasn't been estimated", "Tracer was stopped" #1

Open
mesld opened this issue Jul 14, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@mesld
Copy link

mesld commented Jul 14, 2023

Problem
I installed EnergAt, and both finding the baseline power and checking the system worked (please see the output from the terminal in the attached pictures in the section "To Reproduce").
Then I created a directory named "my_directory" in the "energat" directory (the cloned one), and created a Python file named "first.py" with the proposed application from the EnergAt README.md file (see below):
image

However, in order to run this application, I need its PID, and I could not find it.
Thus I tried to run the application directly in the terminal (by only entering "..energat/my_directory/first.py") but it first claimed that the baseline was not estimated, then asked for password (even though I did not run with "sudo" in the command), and then continued to run and finally displayed a Warning saying that the tracer was stopped. The following pictures illustrate what I am describing.
image
#asked for password
image

You can see it also displays different PIDs but I do not know what to do with them.
Could you please help me find the application's PID for the command "sudo energat -pid " to make the application run?

System

  • EnergAt version: 1.0.6
  • OS version: Ubuntu 22.04.2

To Reproduce
Steps to reproduce the behavior:

  1. I first cloned the git repository, then went into "./scripts/setup/" and configured the host system by running the file "init_system.sh".
  2. After having run init_system.sh, I entered "sudo python -m pip install energat" in the terminal.
  3. I entered "sudo energat -basepower" and it displayed the following:
    image
  4. Then I entered "sudo energat -check" and it displayed the following:
    image
  5. Created a directory "my_directory" in the cloned energat directory
  6. Created a file "first.py" in "my_directory" and copy-pasted the proposed application
  7. I could not find the pid and tried to run the application directory from the terminal. It did not seem to work.

Thank you for your help!
Have a nice day :)

@HongyuHe
Copy link
Owner

Hi @mesld,

Thanks for the feedback!

First, when you are using the python API, you don't need to run energat from the command line, since it's been used as a library already, and the energy traces will be saved to the ./xyz_energy.csv. In other words, you either use it directly in your program OR attach it to any running processes from the command line.

In addition, the reason you can't find the PID of first.py is probably because the application is too short and has finished. Otherwise, you can do a ps or top on linux to get the PID of that python process. The PID/TID logged out in the terminal is of the energat itself and has nothing to do with your application.

Lastly, for the base power estimation, currently you have to use energat in the same directory as the one in which you measured the base power. Otherwise, it can't find the baseline_power.json anymore. Alternatively, you can pass the file location via the --basefile flag from the command line (see). I will improve this part later to make it remember the absolute path to the record file.

Hope this clears things up a bit.

@HongyuHe HongyuHe self-assigned this Jul 14, 2023
@HongyuHe HongyuHe added the enhancement New feature or request label Jul 14, 2023
@mesld
Copy link
Author

mesld commented Jul 17, 2023

Hi @HongyuHe,

Thank you for your answer and your help!

I am using energat directly in my program.

Indeed, I modified the application a bit (changed the range of the for loop from 100 to 1000). You can see the output in the pictures after Steps.
I am not sure whether energat automatically notices the PID of the application. You can see on the picture that it still displays "Baseline power hasn't been estimated", even though I did "sudo energat -basepower" right before, followed by "sudo energat -check".

Regarding the issue with the directory, I now have removed the directory and placed directly the python application in the energat directory.

Steps:

  1. Directly in home (NOT in the energat directory): sudo energat -basepower
  2. In home: sudo energat -check
  3. In home: /bin/python3 /local/home/./energat/first.py
    This is the output:
    Slide1
    Slide2

In order for it to stop the execution, I pressed ctrl+c (otherwise it was stuck in the same state). After pressing ctlr+c, I saw the following:
image

I also tried the same steps all in the energat directory and it displayed the same.

Thank you and have a nice day! :)

@HongyuHe
Copy link
Owner

Hi @mesld,

Thanks for asking!

For the missing baseline power, I'm sorry but I failed to reproduce it on a clean-slate server in the cloud. Could you check the following please?

  1. Make sure that you've run the setup script indicated in the README (./scripts/setup/init_system.sh).
  2. Try placing your program in the same directory as the one where the base power is estimated. (Sorry about this. Will fix this inconvenience soon.)

For the keyboard interrupt, yes, the output is expected since you interrupt the running program. The point here is that energy traces will be saved even your program is crashed by the interrupt. Also, given your output, it seems that the energy tracing is working. Could you also check the output please?

Let me know if you still have issues with it.
Thanks!

@mesld
Copy link
Author

mesld commented Aug 2, 2023

Hi @HongyuHe,

Thanks for your response!

The following seems to have worked in home directory:

  1. I ran the script init_system.sh
  2. 'sudo energat -basepower'
  3. 'sudo energat -check'
  4. 'sudo /bin/python3 /local/home/./energat/first.py'

The output was the following:
image
image
image
image

And there was no interrupt this time. Is this the correct output?

Also in the final results, what is the 'p' in 'pkg'?

Thank you and have a good evening :)

@HongyuHe
Copy link
Owner

Hi @mesld! Yes, that's the correct output. Glad to see it works for you now!

pkg == CPU package, which is also used interchangeably with socket in the code. (They are referring to the whole CPU but are different things.)

@mesld
Copy link
Author

mesld commented Aug 11, 2023

Hi @HongyuHe!

Great :) Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants