int MPID_nem_scif_get_business_card(int my_rank, char **bc_val_p, int *val_max_sz_p) { int mpi_errno = MPI_SUCCESS; int str_errno = MPIU_STR_SUCCESS; int ret; char hostname[512]; uint16_t self; MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_SCIF_GET_BUSINESS_CARD); MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_SCIF_GET_BUSINESS_CARD); hostname[sizeof(hostname) - 1] = 0; gethostname(hostname, sizeof(hostname) - 1); str_errno = MPIU_Str_add_string_arg(bc_val_p, val_max_sz_p, MPIDI_CH3I_HOST_DESCRIPTION_KEY, hostname); if (str_errno) { MPIU_ERR_CHKANDJUMP(str_errno == MPIU_STR_NOMEM, mpi_errno, MPI_ERR_OTHER, "**buscard_len"); MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**buscard"); } str_errno = MPIU_Str_add_int_arg(bc_val_p, val_max_sz_p, MPIDI_CH3I_PORT_KEY, listen_port); if (str_errno) { MPIU_ERR_CHKANDJUMP(str_errno == MPIU_STR_NOMEM, mpi_errno, MPI_ERR_OTHER, "**buscard_len"); MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**buscard"); } ret = scif_get_nodeIDs(NULL, 0, &self); MPIU_ERR_CHKANDJUMP2(ret == -1, mpi_errno, MPI_ERR_OTHER, "**scif_get_nodeIDs", "**scif_get_nodeIDs %s %d", MPIU_Strerror(errno), errno); str_errno = MPIU_Str_add_int_arg(bc_val_p, val_max_sz_p, MPIDI_CH3I_NODE_KEY, self); if (str_errno) { MPIU_ERR_CHKANDJUMP(str_errno == MPIU_STR_NOMEM, mpi_errno, MPI_ERR_OTHER, "**buscard_len"); MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**buscard"); } fn_exit: MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_SCIF_GET_BUSINESS_CARD); return mpi_errno; fn_fail: goto fn_exit; }
int mca_btl_scif_module_init (void) { int rc; /* create an endpoint to listen for connections */ mca_btl_scif_module.scif_fd = scif_open (); if (-1 == mca_btl_scif_module.scif_fd) { BTL_VERBOSE(("scif_open failed. errno = %d", errno)); return OPAL_ERROR; } /* bind the endpoint to a port */ mca_btl_scif_module.port_id.port = scif_bind (mca_btl_scif_module.scif_fd, 0); if (-1 == mca_btl_scif_module.port_id.port) { BTL_VERBOSE(("scif_bind failed. errno = %d", errno)); scif_close (mca_btl_scif_module.scif_fd); mca_btl_scif_module.scif_fd = -1; return OPAL_ERROR; } /* determine this processes node id */ rc = scif_get_nodeIDs (NULL, 0, &mca_btl_scif_module.port_id.node); if (-1 == rc) { BTL_VERBOSE(("btl/scif error getting node id of this node")); return OPAL_ERROR; } /* Listen for connections */ /* TODO - base the maximum backlog off something */ rc = scif_listen (mca_btl_scif_module.scif_fd, 64); if (-1 == rc) { BTL_VERBOSE(("scif_listen failed. errno = %d", errno)); scif_close (mca_btl_scif_module.scif_fd); mca_btl_scif_module.scif_fd = -1; return OPAL_ERROR; } BTL_VERBOSE(("btl/scif: listening @ port %u on node %u\n", mca_btl_scif_module.port_id.port, mca_btl_scif_module.port_id.node)); OBJ_CONSTRUCT(&mca_btl_scif_module.dma_frags, opal_free_list_t); OBJ_CONSTRUCT(&mca_btl_scif_module.eager_frags, opal_free_list_t); return OPAL_SUCCESS; }
}; typedef request& request_reference_type; typedef const request& request_const_reference_type; communicator(int argc, char* argv[]) { instance_ = this; HAM_DEBUG( HAM_LOG << "FLAG_FALSE = " << FLAG_FALSE << ", NO_BUFFER_INDEX = " << NO_BUFFER_INDEX << std::endl; ) // basic SCIF initialisation uint16_t nodes[MAX_SCIF_NODES]; uint16_t self; int err = 0; num_nodes_ = scif_get_nodeIDs(nodes, MAX_SCIF_NODES, &self); errno_handler(num_nodes_, "scif_get_nodeIDs"); // command line configuration ham_process_count = num_nodes_; // number of participating processes ham_address = self; // this processes' address ham_host_address = 0; // the address of the host process ham_host_node = 0; // SCIF network node of the host process, default is 0 (which is the host machines) // command line options boost::program_options::options_description desc("HAM Options"); desc.add_options() ("ham-help", "Shows this message") ("ham-process-count", boost::program_options::value(&ham_process_count)->default_value(ham_process_count), "Number of processes the job consists of.") ("ham-address", boost::program_options::value(&ham_address)->default_value(ham_address), "This processes address, between 0 and host-process-count minus 1.") ("ham-host-node", boost::program_options::value(&ham_host_node)->default_value(ham_host_node), "The SCIF network node on which the host process is started (0, the host machine by default).")