From 960ae7952e72d327b0598c66a6da9885432aee9c Mon Sep 17 00:00:00 2001 From: Melody Date: Thu, 7 Aug 2025 18:45:24 +0000 Subject: [PATCH 1/2] Test MPI option on CI Signed-off-by: Melody --- .../solvers/python/{gqe_h2.py => gqe_h2_mpi.py} | 0 scripts/ci/test_examples.sh | 11 +++++++++++ 2 files changed, 11 insertions(+) rename docs/sphinx/examples/solvers/python/{gqe_h2.py => gqe_h2_mpi.py} (100%) diff --git a/docs/sphinx/examples/solvers/python/gqe_h2.py b/docs/sphinx/examples/solvers/python/gqe_h2_mpi.py similarity index 100% rename from docs/sphinx/examples/solvers/python/gqe_h2.py rename to docs/sphinx/examples/solvers/python/gqe_h2_mpi.py diff --git a/scripts/ci/test_examples.sh b/scripts/ci/test_examples.sh index 84ac1462..7f7f36d6 100755 --- a/scripts/ci/test_examples.sh +++ b/scripts/ci/test_examples.sh @@ -81,6 +81,17 @@ if [[ "$LIB" == "solvers" || "$LIB" == "all" ]]; then for file in examples/solvers/python/*.py; do run_python_test "$file" done + + # Test python examples with MPI option + for file in examples/solvers/python/*.py; do + if echo "$file" | grep -qi "mpi"; then + echo "Running MPI example: $file" + # Run MPI using CUDAQ MPI + run_python_test "$file" "--mpi" + # Repeat using MPI Python API + PMIX_MCA_gds=hash mpiexec -np 1 python3 $file --mpi + fi + done for file in examples/solvers/cpp/*.cpp; do run_cpp_test "$file" "-lcudaq-solvers" From 1c7b32c26dda9fd888478decc87dc818e967096b Mon Sep 17 00:00:00 2001 From: Melody Date: Thu, 7 Aug 2025 20:06:29 +0000 Subject: [PATCH 2/2] Run MPI as root Signed-off-by: Melody --- scripts/ci/test_examples.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/test_examples.sh b/scripts/ci/test_examples.sh index 7f7f36d6..f9886f65 100755 --- a/scripts/ci/test_examples.sh +++ b/scripts/ci/test_examples.sh @@ -87,9 +87,9 @@ if [[ "$LIB" == "solvers" || "$LIB" == "all" ]]; then if echo "$file" | grep -qi "mpi"; then echo "Running MPI example: $file" # Run MPI using CUDAQ MPI - run_python_test "$file" "--mpi" + python3 "$file" --mpi # Repeat using MPI Python API - PMIX_MCA_gds=hash mpiexec -np 1 python3 $file --mpi + PMIX_MCA_gds=hash mpiexec -np 1 --allow-run-as-root python3 $file --mpi fi done