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

CUDA-Q MPI Submodule yields incorrect results - the finalize command does not work #2297

Open
4 tasks done
zohimchandani opened this issue Oct 18, 2024 · 2 comments
Open
4 tasks done

Comments

@zohimchandani
Copy link
Collaborator

Required prerequisites

  • Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!

Describe the bug

import cudaq 

print('should yield false', cudaq.mpi.is_initialized())

cudaq.mpi.initialize()

print('should yield true', cudaq.mpi.is_initialized())

cudaq.mpi.finalize()

print('should yield false', cudaq.mpi.is_initialized())

should yield false False
should yield true True
should yield false True

Steps to reproduce the bug

NA

Expected behavior

NA

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

NA

Suggestions

No response

@zohimchandani
Copy link
Collaborator Author

Can we also please include mpi.barrier commands in CUDA-Q to ensure we don't have the script jump ahead when we don't want it to.

@1tnguyen
Copy link
Collaborator

Re: cudaq.mpi.is_initialized() yields True after cudaq.mpi.finalize()

This is an expected behavior of MPI. cudaq.mpi.is_initialized is a wrapper of MPI_Initialized function.
According to the MPI spec:

MPI_Initialized: This routine may be used to determine whether MPI_INIT or MPI_INIT_THREAD has
been called. MPI_INITIALIZED returns true if the calling process has called either of these
MPI procedures. Whether MPI_FINALIZE has been called does not affect the behavior of
MPI_INITIALIZED
.

We can expose the is_finalized API to Python to detect whether finalize has been called. This API is available in CUDA-Q C++ but not exposed to Python yet.

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

No branches or pull requests

2 participants