14.6.1. Hello World Example 1ΒΆ
- The source code is shown below, which can be downloaded
here
. - Run the source code with 4 processors
mpiexec -np 4 python hello.py
the outputs look like
Hello World Process: 1
Hello World Process: 2
Hello World Process: 0
Total number of processes: 4
Hello World Process: 3
Process 1 Terminating
Process 2 Terminating
Process 0 Terminating
Process 3 Terminating
The script is shown below
1 2 3 4 5 6 7 8 9 | import openseespy.opensees as ops
pid = ops.getPID()
np = ops.getNP()
print('Hello World Process:', pid)
if pid == 0:
print('Total number of processes:', np)
|