Created
July 4, 2025 05:20
-
-
Save leslie-fang-intel/29f100e610b9ae5d58a5d6f4ee8f83dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run with: clear && mpiexec -n 2 python test_mpi4.py | |
from mpi4py.futures import MPIPoolExecutor | |
def work(x): | |
print(f"Working on: {x}") | |
return x * x | |
if __name__ == "__main__": | |
with MPIPoolExecutor() as executor: | |
future = executor.submit(work, 5) | |
print("Result:", future.result()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment