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
1import openseespy.opensees as ops
2
3pid = ops.getPID()
4np = ops.getNP()
5
6print('Hello World Process:', pid)
7if pid == 0:
8 print('Total number of processes:', np)
9