Esempio n. 1
0
 def __init__(self):
     
     # Initialize communicators
     try:
         self.__command_channel = 2
         self.__ping_status_channel = 1
         self.__control_service_channel = 0
         self.__command_request_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__ping_status_request_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__command_response_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__ping_status_response_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__control_service_request_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__control_service_response_communicator = MPIEnvironment.mpi_comm_world_factory()
         
         # Register exit handler in case MPICommandClient exit handler is not initialized
         # NOTE: It is not guaranteed that __del__() methods are called 
         #       for objects that still exist when the interpreter exits.
         self.__finalize_mpi_environment = True
         # jagonzal: This exit function must be registered only for the client
         if MPIEnvironment.is_mpi_client:                   
             atexit.register(self.finalize_server_and_client_mpi_environment)
     
     except Exception, instance:
         self.__command_channel = -1
         self.__ping_status_channel = -1
         self.__control_service_channel = -1               
         self.__command_request_communicator = None
         self.__ping_status_request_communicator = None
         self.__command_response_communicator = None
         self.__ping_status_response_communicator = None
         self.__control_service_request_communicator = None
         self.__control_service_response_communicator = None
         msg = "Exception initializing MPICommunicator at processor with rank "
         msg = msg + "%s: %s" % (str(MPIEnvironment.mpi_processor_rank),str(instance))
         raise Exception,msg
Esempio n. 2
0
 def __init__(self):
     
     # Initialize communicators
     try:
         self.__command_channel = 2
         self.__ping_status_channel = 1
         self.__control_service_channel = 0
         self.__command_request_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__ping_status_request_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__command_response_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__ping_status_response_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__control_service_request_communicator = MPIEnvironment.mpi_comm_world_factory()
         self.__control_service_response_communicator = MPIEnvironment.mpi_comm_world_factory()
         
         # Register exit handler in case MPICommandClient exit handler is not initialized
         # NOTE: It is not guaranteed that __del__() methods are called 
         #       for objects that still exist when the interpreter exits.
         self.__finalize_mpi_environment = True
         # jagonzal: This exit function must be registered only for the client
         if MPIEnvironment.is_mpi_client:                   
             atexit.register(self.finalize_server_and_client_mpi_environment)
     
     except Exception, instance:
         self.__command_channel = -1
         self.__ping_status_channel = -1
         self.__control_service_channel = -1               
         self.__command_request_communicator = None
         self.__ping_status_request_communicator = None
         self.__command_response_communicator = None
         self.__ping_status_response_communicator = None
         self.__control_service_request_communicator = None
         self.__control_service_response_communicator = None
         msg = "Exception initializing MPICommunicator at processor with rank "
         msg = msg + "%s: %s" % (str(MPIEnvironment.mpi_processor_rank),str(instance))
         raise Exception(msg)