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

Add Barrier and Timing to the Python Interface #31

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

cangumeli
Copy link
Collaborator

No description provided.

@giangiac
Copy link
Contributor

giangiac commented Nov 9, 2020

Hi @cangumeli, it seems to me that "MPI_Wtime()" returns the number of seconds elapsed from a specific point in the past.
This point is guaranteed not to change during the life of the process, but there is no requirement that different nodes return the "same" time.

The value of "MPI_Wtime()" cannot therefore be directly compared between processes.

@giangiac
Copy link
Contributor

giangiac commented Nov 9, 2020

The barrier-related contribution works fine.

The min/max time approach may not be the best for timing the code in Python.

One simple alternative is:
min time --> time-of-day and then barrier
max time --> barrier and then time-of-day
but this is approximate.

Another approach requires that, at the point of the initialization of the MPI environment, we store the "MPI_Wtime()" separately for every process. When min/ax time is called, we return the time difference with the fixed "initialization time" of the process. However, one must be able to assume that the initialization of every process happens at the same time and this may not be the case.

Copy link
Contributor

@giangiac giangiac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check my previous two comments.
There is an issue with MinTime() and MaxTime().

@cangumeli
Copy link
Collaborator Author

I will be looking into it to find a better way of timing. Thanks for the response.

@cangumeli
Copy link
Collaborator Author

When I added min/max time, I actually thought barriers in Python don't work. However, with this contribution, they should work. So I am not sure max and min time are really necessary anymore, maybe we can just do something like this in Python:

begin = time()
run_circuit()
barrier()
end = time()
print time in the process 0

@giangiac
Copy link
Contributor

giangiac commented Dec 8, 2020

That is what I was thinking too: Providing the barrier command should suffice for most applications.
Do you want to eliminate the min/max time and simply keep the barrier?

@cangumeli
Copy link
Collaborator Author

Yes that is my idea. I will make the change and comment here when I have time :).

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

Successfully merging this pull request may close these issues.

None yet

2 participants