|
|
|
@ -12,7 +12,6 @@
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
|
|
from mpi4py import MPI
|
|
|
|
|
import ps_pb2 as pslib
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,7 +58,7 @@ class FileSystem(object):
|
|
|
|
|
|
|
|
|
|
class MPIHelper(object):
|
|
|
|
|
"""
|
|
|
|
|
MPIHelper is a wrapper of mpi4py, supprot get_rank get_size etc.
|
|
|
|
|
MPIHelper is a wrapper of mpi4py, support get_rank get_size etc.
|
|
|
|
|
Args:
|
|
|
|
|
No params
|
|
|
|
|
Examples:
|
|
|
|
@ -68,7 +67,9 @@ class MPIHelper(object):
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
|
from mpi4py import MPI
|
|
|
|
|
self.comm = MPI.COMM_WORLD
|
|
|
|
|
self.MPI = MPI
|
|
|
|
|
|
|
|
|
|
def get_rank(self):
|
|
|
|
|
return self.comm.Get_rank()
|
|
|
|
@ -86,4 +87,4 @@ class MPIHelper(object):
|
|
|
|
|
return socket.gethostname()
|
|
|
|
|
|
|
|
|
|
def finalize(self):
|
|
|
|
|
MPI.Finalize()
|
|
|
|
|
self.MPI.Finalize()
|
|
|
|
|