1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ 2 /* 3 * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana 4 * University Research and Technology 5 * Corporation. All rights reserved. 6 * Copyright (c) 2004-2011 The University of Tennessee and The University 7 * of Tennessee Research Foundation. All rights 8 * reserved. 9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 10 * University of Stuttgart. All rights reserved. 11 * Copyright (c) 2004-2005 The Regents of the University of California. 12 * All rights reserved. 13 * Copyright (c) 2013-2015 Intel, Inc. All rights reserved 14 * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights 15 * reserved. 16 * $COPYRIGHT$ 17 * 18 * Additional copyrights may follow 19 * 20 * $HEADER$ 21 */ 22 /** 23 * @file 24 * 25 * Dynamic Process Management Interface 26 * 27 */ 28 29 #ifndef OMPI_DPM_H 30 #define OMPI_DPM_H 31 32 #include "ompi_config.h" 33 34 #include "ompi/info/info.h" 35 #include "ompi/communicator/communicator.h" 36 37 BEGIN_C_DECLS 38 39 /* 40 * Initialize the DPM system 41 */ 42 int ompi_dpm_init(void); 43 44 /* 45 * Connect/accept communications 46 */ 47 int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root, 48 const char *port, bool send_first, 49 ompi_communicator_t **newcomm); 50 51 /** 52 * Executes internally a disconnect on all dynamic communicators 53 * in case the user did not disconnect them. 54 */ 55 int ompi_dpm_disconnect(ompi_communicator_t *comm); 56 57 /* 58 * Dynamically spawn processes 59 */ 60 int ompi_dpm_spawn(int count, char const *array_of_commands[], 61 char **array_of_argv[], 62 const int array_of_maxprocs[], 63 const MPI_Info array_of_info[], 64 const char *port_name); 65 66 /* 67 * This routine checks, whether an application has been spawned 68 * by another MPI application, or has been independently started. 69 * If it has been spawned, it establishes the parent communicator. 70 * Since the routine has to communicate, it should be among the last 71 * steps in MPI_Init, to be sure that everything is already set up. 72 */ 73 int ompi_dpm_dyn_init(void); 74 75 /* 76 * Interface for mpi_finalize to call to ensure dynamically spawned procs 77 * collectively finalize 78 */ 79 int ompi_dpm_dyn_finalize(void); 80 81 /* this routine counts the number of different jobids of the processes 82 given in a certain communicator. If there is more than one jobid, 83 we mark the communicator as 'dynamic'. This is especially relevant 84 for the MPI_Comm_disconnect *and* for MPI_Finalize, where we have 85 to wait for all still connected processes. 86 */ 87 void ompi_dpm_mark_dyncomm(ompi_communicator_t *comm); 88 89 /* 90 * Define a rendezvous point for a dynamically spawned job 91 */ 92 int ompi_dpm_open_port(char *port_name); 93 94 /* 95 * Unpublish the rendezvous point 96 */ 97 int ompi_dpm_close_port(const char *port_name); 98 99 /* 100 * Finalize the DPM 101 */ 102 int ompi_dpm_finalize(void); 103 104 END_C_DECLS 105 106 #endif /* OMPI_DPM_H */