int MPIDI_CH3U_Init_sock(int has_parent, MPIDI_PG_t *pg_p, int pg_rank, char **bc_val_p, int *val_max_sz_p) { int mpi_errno = MPI_SUCCESS; int pg_size; int p; /* FIXME: Why are these unused? */ MPIU_UNREFERENCED_ARG(has_parent); MPIU_UNREFERENCED_ARG(pg_rank); /* * Initialize the VCs associated with this process group (and thus * MPI_COMM_WORLD) */ /* FIXME: Get the size from the process group */ pg_size = MPIDI_PG_Get_size(pg_p); /* FIXME: This should probably be the same as MPIDI_VC_InitSock. If not, why not? */ /* FIXME: Note that MPIDI_CH3_VC_Init sets state, sendq_head and tail. so this should be MPIDI_CH3_VC_Init( &pg_p->vct[p] ); followed by MPIDI_VC_InitSock( ditto ); In fact, there should be a single VC_Init call here */ /* FIXME: Why isn't this MPIDI_VC_Init( vc, NULL, 0 )? */ for (p = 0; p < pg_size; p++) { MPIDI_CH3I_VC *vcch = &pg_p->vct[p].ch; vcch->sendq_head = NULL; vcch->sendq_tail = NULL; vcch->state = MPIDI_CH3I_VC_STATE_UNCONNECTED; vcch->sock = MPIDU_SOCK_INVALID_SOCK; vcch->conn = NULL; } mpi_errno = MPIDI_CH3U_Get_business_card_sock(pg_rank, bc_val_p, val_max_sz_p); if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER, "**init_buscard"); } fn_exit: return mpi_errno; fn_fail: /* FIXME: This doesn't belong here, since the pg is not created in this routine */ /* --BEGIN ERROR HANDLING-- */ if (pg_p != NULL) { MPIDI_PG_Destroy(pg_p); } goto fn_exit; /* --END ERROR HANDLING-- */ }
int MPIOI_File_read_all_end(MPI_File fh, void *buf, char *myname, MPI_Status *status) { int error_code = MPI_SUCCESS; ADIO_File adio_fh; MPIU_UNREFERENCED_ARG(buf); adio_fh = MPIO_File_resolve(fh); /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); if (!(adio_fh->split_coll_count)) { error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**iosplitcollnone", 0); error_code = MPIO_Err_return_file(adio_fh, error_code); goto fn_exit; } /* --END ERROR HANDLING-- */ #ifdef HAVE_STATUS_SET_BYTES if (status != MPI_STATUS_IGNORE) *status = adio_fh->split_status; #endif adio_fh->split_coll_count = 0; fn_exit: return error_code; }
PMPI_LOCAL int MPIR_Ibsend_cancel( void *extra, int complete ) { int mpi_errno = MPI_SUCCESS; ibsend_req_info *ibsend_info = (ibsend_req_info *)extra; MPI_Status status; MPID_Request *req = ibsend_info->req; /* FIXME: There should be no unreferenced args! */ /* Note that this value should always be 1 because Grequest_complete is called on this request when it is created */ MPIU_UNREFERENCED_ARG(complete); /* Try to cancel the underlying request */ mpi_errno = MPIR_Cancel_impl(req); if (mpi_errno) MPIU_ERR_POP(mpi_errno); mpi_errno = MPIR_Wait_impl( &req->handle, &status ); if (mpi_errno) MPIU_ERR_POP(mpi_errno); MPIR_Test_cancelled_impl( &status, &ibsend_info->cancelled ); fn_exit: return mpi_errno; fn_fail: goto fn_exit; }
/*@ MPI_File_delete - Deletes a file Input Parameters: . filename - name of file to delete (string) . info - info object (handle) .N fortran @*/ int MPI_File_delete(ROMIO_CONST char *filename, MPI_Info info) { int error_code, file_system; char *tmp; ADIOI_Fns *fsops; #ifdef MPI_hpux int fl_xmpi; HPMP_IO_START(fl_xmpi, BLKMPIFILEDELETE, TRDTBLOCK, MPI_FILE_NULL, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ MPIU_UNREFERENCED_ARG(info); MPIU_THREAD_CS_ENTER(ALLFUNC,); MPIR_MPIOInit(&error_code); if (error_code != MPI_SUCCESS) goto fn_exit; /* resolve file system type from file name; this is a collective call */ ADIO_ResolveFileType(MPI_COMM_SELF, filename, &file_system, &fsops, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) { /* ADIO_ResolveFileType() will print as informative a message as it * possibly can or call MPIR_Err_setmsg. We just need to propagate * the error up. In the PRINT_ERR_MSG case MPI_Abort has already * been called as well, so we probably didn't even make it this far. */ error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); goto fn_exit; } /* --END ERROR HANDLING-- */ /* skip prefixes on file names if they have more than one character; * single-character prefixes are assumed to be windows drive * specifications (e.g. c:\foo) and are left alone. */ tmp = strchr(filename, ':'); if (tmp > filename + 1) filename = tmp + 1; /* call the fs-specific delete function */ (fsops->ADIOI_xxx_Delete)(filename, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); /* --END ERROR HANDLING-- */ #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, MPI_FILE_NULL, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ fn_exit: MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; }
/* style: allow:fprintf:1 sig:0 */ static int assert_hook( int reportType, char *message, int *returnValue ) { MPIU_UNREFERENCED_ARG(reportType); fprintf(stderr, "%s", message); if (returnValue != NULL) ExitProcess((UINT)(*returnValue)); ExitProcess((UINT)(-1)); return TRUE; }
int MPID_NS_Create( const MPID_Info *info_ptr, MPID_NS_Handle *handle_ptr ) { static struct MPID_NS_Handle nsHandleWithNoData; MPIU_UNREFERENCED_ARG(info_ptr); /* MPID_NS_Create() should always create a valid handle */ *handle_ptr = &nsHandleWithNoData; /* The name service needs no local data */ return 0; }
int MPIDI_CH3_PG_Destroy(MPIDI_PG_t *pg_p) { MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PG_DESTROY); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PG_DESTROY); MPIU_UNREFERENCED_ARG(pg_p); MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PG_DESTROY); return MPI_SUCCESS; }
/* We don't initialize before calling MPIDI_CH3_VC_Init */ int MPIDI_CH3_PG_Init(MPIDI_PG_t *pg_p) { MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PG_INIT); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PG_INIT); MPIU_UNREFERENCED_ARG(pg_p); MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PG_INIT); return MPI_SUCCESS; }
/* This function simply tells the CH3 device to use the defaults for the MPI Port functions */ int MPIDI_CH3_PortFnsInit( MPIDI_PortFns *portFns ) { MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PORTFNSINIT); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PORTFNSINIT); MPIU_UNREFERENCED_ARG(portFns); MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PORTFNSINIT); return 0; }
int MPID_NS_Lookup( MPID_NS_Handle handle, const MPID_Info *info_ptr, const char service_name[], char port[] ) { int mpi_errno = MPI_SUCCESS; int rc; MPIU_UNREFERENCED_ARG(info_ptr); MPIU_UNREFERENCED_ARG(handle); #ifdef USE_PMI2_API /* release the global CS for PMI calls */ MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); rc = PMI2_Nameserv_lookup(service_name, info_ptr, port, MPI_MAX_PORT_NAME); MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); #else rc = PMI_Lookup_name( service_name, port ); #endif MPIR_ERR_CHKANDJUMP1(rc, mpi_errno, MPI_ERR_NAME, "**namepubnotfound", "**namepubnotfound %s", service_name); fn_fail: return mpi_errno; }
int MPID_NS_Unpublish( MPID_NS_Handle handle, const MPID_Info *info_ptr, const char service_name[] ) { int mpi_errno = MPI_SUCCESS; int rc; MPIU_UNREFERENCED_ARG(info_ptr); MPIU_UNREFERENCED_ARG(handle); #ifdef USE_PMI2_API /* release the global CS for PMI calls */ MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); rc = PMI2_Nameserv_unpublish(service_name, info_ptr); MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); #else rc = PMI_Unpublish_name( service_name ); #endif MPIR_ERR_CHKANDJUMP1(rc, mpi_errno, MPI_ERR_SERVICE, "**namepubnotunpub", "**namepubnotunpub %s", service_name); fn_fail: return mpi_errno; }
int MPID_NS_Publish( MPID_NS_Handle handle, const MPID_Info *info_ptr, const char service_name[], const char port[] ) { int mpi_errno = MPI_SUCCESS; int rc; MPIU_THREADPRIV_DECL; MPIU_UNREFERENCED_ARG(info_ptr); MPIU_UNREFERENCED_ARG(handle); #ifdef USE_PMI2_API /* release the global CS for PMI calls */ MPIU_THREAD_CS_EXIT(ALLFUNC,); rc = PMI2_Nameserv_publish(service_name, info_ptr, port); MPIU_THREAD_CS_ENTER(ALLFUNC,); #else rc = PMI_Publish_name( service_name, port ); #endif MPIU_ERR_CHKANDJUMP1(rc, mpi_errno, MPI_ERR_NAME, "**namepubnotpub", "**namepubnotpub %s", service_name); fn_fail: return mpi_errno; }
int MPIDI_CH3_PortFnsInit (MPIDI_PortFns* portFns) { MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_RDMA_PORTFNSINIT); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_RDMA_PORTFNSINIT); if (!MPIDI_CH3I_Process.has_dpm) { portFns->OpenPort = 0; portFns->ClosePort = 0; portFns->CommAccept = 0; portFns->CommConnect = 0; } else MPIU_UNREFERENCED_ARG(portFns); MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_RDMA_PORTFNSINIT); return MPI_SUCCESS; }
int MPIOI_File_write_all_end(MPI_File mpi_fh, void *buf, char *myname, MPI_Status *status) { int error_code; ADIO_File fh; MPIU_UNREFERENCED_ARG(buf); MPIU_THREAD_CS_ENTER(ALLFUNC,); fh = MPIO_File_resolve(mpi_fh); /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); if (!(fh->split_coll_count)) { error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**iosplitcollnone", 0); error_code = MPIO_Err_return_file(fh, error_code); goto fn_exit; } /* --END ERROR HANDLING-- */ #ifdef HAVE_STATUS_SET_BYTES /* FIXME - we should really ensure that the split_datatype remains valid by incrementing the ref count in the write_allb.c routine and decrement it here after setting the bytes */ if (status != MPI_STATUS_IGNORE) *status = fh->split_status; #endif fh->split_coll_count = 0; error_code = MPI_SUCCESS; fn_exit: MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; }
int MPIOI_File_read_all_end(MPI_File mpi_fh, void *buf, char *myname, MPI_Status *status) { int error_code; ADIO_File fh; MPIU_UNREFERENCED_ARG(buf); MPIU_THREAD_SINGLE_CS_ENTER("io"); MPIR_Nest_incr(); fh = MPIO_File_resolve(mpi_fh); /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); if (!(fh->split_coll_count)) { error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**iosplitcollnone", 0); error_code = MPIO_Err_return_file(fh, error_code); goto fn_exit; } /* --END ERROR HANDLING-- */ #ifdef HAVE_STATUS_SET_BYTES if (status != MPI_STATUS_IGNORE) *status = fh->split_status; #endif fh->split_coll_count = 0; fn_exit: MPIR_Nest_decr(); MPIU_THREAD_SINGLE_CS_EXIT("io"); return MPI_SUCCESS; }
/*@ MPI_File_write_ordered_end - Complete a split collective write using shared file pointer Input Parameters: . fh - file handle (handle) Output Parameters: . buf - initial address of buffer (choice) . status - status object (Status) .N fortran @*/ int MPI_File_write_ordered_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *status) { int error_code; static char myname[] = "MPI_FILE_WRITE_ORDERED_END"; ADIO_File adio_fh; MPIU_UNREFERENCED_ARG(buf); ROMIO_THREAD_CS_ENTER(); adio_fh = MPIO_File_resolve(fh); /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); if (!(adio_fh->split_coll_count)) { error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**iosplitcollnone", 0); error_code = MPIO_Err_return_file(adio_fh, error_code); goto fn_exit; } /* --END ERROR HANDLING-- */ #ifdef HAVE_STATUS_SET_BYTES if (status != MPI_STATUS_IGNORE) *status = adio_fh->split_status; #endif adio_fh->split_coll_count = 0; fn_exit: ROMIO_THREAD_CS_EXIT(); return MPI_SUCCESS; }
int MPID_NS_Free( MPID_NS_Handle *handle_ptr ) { /* MPID_NS_Handle is Null */ MPIU_UNREFERENCED_ARG(handle_ptr); return 0; }
int MPIDI_Win_create(void *base, MPI_Aint size, int disp_unit, MPID_Info *info, MPID_Comm *comm_ptr, MPID_Win **win_ptr ) { int mpi_errno=MPI_SUCCESS, i, k, comm_size, rank; MPI_Aint *tmp_buf; MPID_Comm *win_comm_ptr; int errflag = FALSE; MPIU_CHKPMEM_DECL(4); MPIU_CHKLMEM_DECL(1); MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_CREATE); MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_CREATE); /* FIXME: There should be no unreferenced args */ MPIU_UNREFERENCED_ARG(info); if(initRMAoptions) { int rc; MPIU_THREADSAFE_INIT_BLOCK_BEGIN(initRMAoptions); /* Default is to enable the use of the immediate accumulate feature */ if (!MPL_env2bool( "MPICH_RMA_ACC_IMMED", &rc )) rc = 1; MPIDI_CH3_RMA_SetAccImmed(rc); #ifdef USE_MPIU_INSTR /* Define all instrumentation handle used in the CH3 RMA here*/ MPIU_INSTR_DURATION_INIT(wincreate_allgather,0,"WIN_CREATE:Allgather"); MPIU_INSTR_DURATION_INIT(winfree_rs,0,"WIN_FREE:ReduceScatterBlock"); MPIU_INSTR_DURATION_INIT(winfree_complete,0,"WIN_FREE:Complete"); MPIU_INSTR_DURATION_INIT(rmaqueue_alloc,0,"Allocate RMA Queue element"); MPIDI_CH3_RMA_InitInstr(); #endif MPIU_THREADSAFE_INIT_CLEAR(initRMAoptions); MPIU_THREADSAFE_INIT_BLOCK_END(initRMAoptions); } comm_size = comm_ptr->local_size; rank = comm_ptr->rank; *win_ptr = (MPID_Win *)MPIU_Handle_obj_alloc( &MPID_Win_mem ); MPIU_ERR_CHKANDJUMP1(!(*win_ptr),mpi_errno,MPI_ERR_OTHER,"**nomem", "**nomem %s","MPID_Win_mem"); MPIU_Object_set_ref(*win_ptr, 1); (*win_ptr)->fence_cnt = 0; (*win_ptr)->base = base; (*win_ptr)->size = size; (*win_ptr)->disp_unit = disp_unit; (*win_ptr)->start_group_ptr = NULL; (*win_ptr)->start_assert = 0; (*win_ptr)->attributes = NULL; (*win_ptr)->rma_ops_list_head = NULL; (*win_ptr)->rma_ops_list_tail = NULL; (*win_ptr)->lock_granted = 0; (*win_ptr)->current_lock_type = MPID_LOCK_NONE; (*win_ptr)->shared_lock_ref_cnt = 0; (*win_ptr)->lock_queue = NULL; (*win_ptr)->my_counter = 0; (*win_ptr)->my_pt_rma_puts_accs = 0; mpi_errno = MPIR_Comm_dup_impl(comm_ptr, &win_comm_ptr); if (mpi_errno) MPIU_ERR_POP(mpi_errno); (*win_ptr)->comm_ptr = win_comm_ptr; (*win_ptr)->myrank = rank; MPIU_INSTR_DURATION_START(wincreate_allgather); /* allocate memory for the base addresses, disp_units, and completion counters of all processes */ MPIU_CHKPMEM_MALLOC((*win_ptr)->base_addrs, void **, comm_size*sizeof(void *), mpi_errno, "(*win_ptr)->base_addrs"); MPIU_CHKPMEM_MALLOC((*win_ptr)->disp_units, int *, comm_size*sizeof(int), mpi_errno, "(*win_ptr)->disp_units"); MPIU_CHKPMEM_MALLOC((*win_ptr)->all_win_handles, MPI_Win *, comm_size*sizeof(MPI_Win), mpi_errno, "(*win_ptr)->all_win_handles"); MPIU_CHKPMEM_MALLOC((*win_ptr)->pt_rma_puts_accs, int *, comm_size*sizeof(int), mpi_errno, "(*win_ptr)->pt_rma_puts_accs"); for (i=0; i<comm_size; i++) (*win_ptr)->pt_rma_puts_accs[i] = 0; /* get the addresses of the windows, window objects, and completion counters of all processes. allocate temp. buffer for communication */ MPIU_CHKLMEM_MALLOC(tmp_buf, MPI_Aint *, 3*comm_size*sizeof(MPI_Aint), mpi_errno, "tmp_buf"); /* FIXME: This needs to be fixed for heterogeneous systems */ tmp_buf[3*rank] = MPIU_PtrToAint(base); tmp_buf[3*rank+1] = (MPI_Aint) disp_unit; tmp_buf[3*rank+2] = (MPI_Aint) (*win_ptr)->handle; mpi_errno = MPIR_Allgather_impl(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, tmp_buf, 3 * sizeof(MPI_Aint), MPI_BYTE, comm_ptr, &errflag); MPIU_INSTR_DURATION_END(wincreate_allgather); if (mpi_errno) { MPIU_ERR_POP(mpi_errno); } MPIU_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail"); k = 0; for (i=0; i<comm_size; i++) { (*win_ptr)->base_addrs[i] = MPIU_AintToPtr(tmp_buf[k++]); (*win_ptr)->disp_units[i] = (int) tmp_buf[k++]; (*win_ptr)->all_win_handles[i] = (MPI_Win) tmp_buf[k++]; } fn_exit: MPIU_CHKLMEM_FREEALL(); MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_CREATE); return mpi_errno; /* --BEGIN ERROR HANDLING-- */ fn_fail: MPIU_CHKPMEM_REAP(); goto fn_exit; /* --END ERROR HANDLING-- */ }