int main(int argc, char *argv[]) { NNTI_result_t rc; selfsend_args *ssa; char server_url[NNTI_URL_LEN]; logger_init(LOG_ERROR, NULL); pthread_barrier_init(&barrier2, NULL, 2); pthread_barrier_init(&barrier3, NULL, 3); rc=NNTI_init(NNTI_DEFAULT_TRANSPORT, NULL, &trans_hdl); rc=NNTI_get_url(&trans_hdl, server_url, NNTI_URL_LEN); launch_wait_threads(); pthread_barrier_wait(&barrier3); rc=NNTI_connect( &trans_hdl, server_url, 5000, &server_hdl); pthread_barrier_wait(&barrier2); rc=NNTI_alloc(&trans_hdl, NNTI_REQUEST_BUFFER_SIZE, 1, NNTI_SEND_SRC, &send_mr); ssa=(selfsend_args *)NNTI_BUFFER_C_POINTER(&send_mr); ssa->data.int_val =10; ssa->data.float_val =10.0; ssa->data.double_val=10.0; ssa->chksum=calc_checksum((const char *)&ssa->data, sizeof(data_t)); rc=NNTI_send(&server_hdl, &send_mr, &recv_mr, &send_wr); rc=NNTI_wait(&send_wr, 5000, &send_status); rc=NNTI_send(&server_hdl, &send_mr, NULL, &send_wr); rc=NNTI_wait(&send_wr, 5000, &send_status); pthread_barrier_wait(&barrier3); NNTI_free(&send_mr); join_wait_threads(); if (success) std::cout << "\nEnd Result: TEST PASSED" << std::endl; else std::cout << "\nEnd Result: TEST FAILED" << std::endl; return (success ? 0 : 1 ); }
/** * @brief Get the process ID of this process. * * @ingroup rpc_funcs * * The <tt>\ref nssi_get_my_pid</tt> method gets the * \ref nssi_remote_pid "process id" of the calling process. * * @param id @output If successful, points to the \ref nssi_remote_pid "process ID" * of the calling process. Undefined otherwise. * * @return \ref NSSI_OK Indicates sucess. * @return \ref NSSI_ERR_RPC Indicates failure in the NSSI RPC library. * */ int nssi_get_url( const nssi_rpc_transport rpc_transport, char *url, uint32_t maxlen) { NNTI_result_t rc=NNTI_OK; if (!rpc_initialized) { log_error(rpc_debug_level, "RPC not initialized"); return NSSI_ENOTINIT; } rc=NNTI_get_url( &transports[rpc_transport], url, maxlen); return(rc); }
int main(int argc, char *argv[]) { char logname[1024]; bool success=true; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); nservers=1; nclients=nprocs-nservers; client_rank=rank-1; if (argc != 6) { if (rank == 0) { fprintf(stderr, "Usage: %s <num sends> <num_gets> <get_size> <num_puts> <put_size>\n", argv[0]); MPI_Barrier(MPI_COMM_WORLD); } else { MPI_Barrier(MPI_COMM_WORLD); } MPI_Abort(MPI_COMM_WORLD, -1); } if (nprocs != 2) { if (rank == 0) { fprintf(stderr, "%s only supports 2 ranks.\n", argv[0]); MPI_Barrier(MPI_COMM_WORLD); } else { MPI_Barrier(MPI_COMM_WORLD); } MPI_Abort(MPI_COMM_WORLD, -1); } parse_args(argc, argv); sprintf(logname, "nntiperf.%03d.log", rank); logger_init(LOG_ERROR, NULL); NNTI_init(NNTI_DEFAULT_TRANSPORT, NULL, &trans_hdl); if (rank==0) { NNTI_get_url(&trans_hdl, url, NNTI_URL_LEN); } MPI_Bcast(&url[0], NNTI_URL_LEN, MPI_CHAR, 0, MPI_COMM_WORLD); log_debug(nntiperf_debug_level, "NNTI perfermance server url is %s", url); if (rank==0) { server(); } else { client(); } NNTI_fini(&trans_hdl); MPI_Finalize(); logger_fini(); // Teuchos::oblackholestream blackhole; // std::ostream &out = ( rank == 1 ? std::cout : blackhole ); std::ostream &out = std::cout; if (success) out << "\nEnd Result: TEST PASSED" << std::endl; else out << "\nEnd Result: TEST FAILED" << std::endl; return (success ? 0 : 1 ); // return 0; }