📄 mpidi_printf.c
字号:
/* -*- Mode: C; c-basic-offset:4 ; -*- *//* * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */#include "mpidimpl.h"#include <stdio.h>#include <stdarg.h>/* style: allow:vprintf:1 sig:0 *//* style: allow:printf:2 sig:0 *//* FIXME: What are these routines for? Who uses them? Why are they different from the src/util/dbg routines? *//* * Note on thread safety. These routines originally used * MPID_Common_thread_lock/unlock, but that lock was not defined or used * consistently with the global mutex approach (now defined as * SINGLE_CS_ENTER/EXIT). As these debugging routines should also * be withdrawn in favor of the general messaging utility, the * Common_thread_lock/unlock has been removed. */#undef MPIDI_dbg_printfvoid MPIDI_dbg_printf(int level, char * func, char * fmt, ...){ /* FIXME: This "unreferenced_arg" is an example of a problem with the API (unneeded level argument) or the code (failure to check the level argument). Inserting these "unreference_arg" macros erroneously suggests that the code is correct with this ununsed argument, and thus commits the grave harm of obscuring a real problem */ MPIU_UNREFERENCED_ARG(level); { va_list list; if (MPIR_Process.comm_world) { MPIU_dbglog_printf("[%d] %s(): ", MPIR_Process.comm_world->rank, func); } else { MPIU_dbglog_printf("[-1] %s(): ", func); } va_start(list, fmt); MPIU_dbglog_vprintf(fmt, list); va_end(list); MPIU_dbglog_printf("\n"); fflush(stdout); }}#undef MPIDI_err_printfvoid MPIDI_err_printf(char * func, char * fmt, ...){ { va_list list; if (MPIR_Process.comm_world) { printf("[%d] ERROR - %s(): ", MPIR_Process.comm_world->rank, func); } else { printf("[-1] ERROR - %s(): ", func); } va_start(list, fmt); vprintf(fmt, list); va_end(list); printf("\n"); fflush(stdout); }}/* FIXME: It would be much better if the routine to print packets used routines defined by packet type, making it easier to modify the handling of packet types (and allowing channels to customize the printing of packets). For example, an array of function pointers, indexed by packet type, could be used. Also, these routines should not use MPIU_DBG_PRINTF, instead they should us a simple fprintf with a style allowance (so that the style checker won't flag the use as a possible problem). This should switch to using a table of functions MPIDI_PktPrintFunctions[pkt->type](stdout,pkt);*/#ifdef MPICH_DBG_OUTPUTvoid MPIDI_DBG_Print_packet(MPIDI_CH3_Pkt_t *pkt){ { MPIU_DBG_PRINTF(("MPIDI_CH3_Pkt_t:\n")); switch(pkt->type) { case MPIDI_CH3_PKT_EAGER_SEND: MPIDI_CH3_PktPrint_EagerSend( stdout, pkt ); break; case MPIDI_CH3_PKT_READY_SEND: MPIDI_CH3_PktPrint_ReadySend( stdout, pkt ); break; case MPIDI_CH3_PKT_EAGER_SYNC_SEND: MPIDI_CH3_PktPrint_EagerSyncSend( stdout, pkt ); break; case MPIDI_CH3_PKT_EAGER_SYNC_ACK: MPIDI_CH3_PktPrint_EagerSyncAck( stdout, pkt ); break; case MPIDI_CH3_PKT_RNDV_REQ_TO_SEND: MPIDI_CH3_PktPrint_RndvReqToSend( stdout, pkt ); break; case MPIDI_CH3_PKT_RNDV_CLR_TO_SEND: MPIDI_CH3_PktPrint_RndvClrToSend( stdout, pkt ); break; case MPIDI_CH3_PKT_RNDV_SEND: MPIDI_CH3_PktPrint_RndvSend( stdout, pkt ); break; case MPIDI_CH3_PKT_CANCEL_SEND_REQ: MPIDI_CH3_PktPrint_CancelSendReq( stdout, pkt ); break; case MPIDI_CH3_PKT_CANCEL_SEND_RESP: MPIDI_CH3_PktPrint_CancelSendResp( stdout, pkt ); break; /* FIXME: Move these RMA descriptions into the RMA code files */ case MPIDI_CH3_PKT_PUT: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_PUT\n")); MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->put.addr)); MPIU_DBG_PRINTF((" count ........ %d\n", pkt->put.count)); MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->put.datatype)); MPIU_DBG_PRINTF((" dataloop_size. 0x%08X\n", pkt->put.dataloop_size)); MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->put.target_win_handle)); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->put.source_win_handle)); /*MPIU_DBG_PRINTF((" win_ptr ...... 0x%08X\n", pkt->put.win_ptr));*/ break; case MPIDI_CH3_PKT_GET: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_GET\n")); MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->get.addr)); MPIU_DBG_PRINTF((" count ........ %d\n", pkt->get.count)); MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->get.datatype)); MPIU_DBG_PRINTF((" dataloop_size. %d\n", pkt->get.dataloop_size)); MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get.request_handle)); MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->get.target_win_handle)); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->get.source_win_handle)); /* MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get.request)); MPIU_DBG_PRINTF((" win_ptr ...... 0x%08X\n", pkt->get.win_ptr)); */ break; case MPIDI_CH3_PKT_GET_RESP: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_GET_RESP\n")); MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get_resp.request_handle)); /*MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get_resp.request));*/ break; case MPIDI_CH3_PKT_ACCUMULATE: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_ACCUMULATE\n")); MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->accum.addr)); MPIU_DBG_PRINTF((" count ........ %d\n", pkt->accum.count)); MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->accum.datatype)); MPIU_DBG_PRINTF((" dataloop_size. %d\n", pkt->accum.dataloop_size)); MPIU_DBG_PRINTF((" op ........... 0x%08X\n", pkt->accum.op)); MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->accum.target_win_handle)); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->accum.source_win_handle)); /*MPIU_DBG_PRINTF((" win_ptr ...... 0x%08X\n", pkt->accum.win_ptr));*/ break; case MPIDI_CH3_PKT_LOCK: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK\n")); MPIU_DBG_PRINTF((" lock_type .... %d\n", pkt->lock.lock_type)); MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->lock.target_win_handle)); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock.source_win_handle)); break; case MPIDI_CH3_PKT_LOCK_PUT_UNLOCK: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK_PUT_UNLOCK\n")); MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->lock_put_unlock.addr)); MPIU_DBG_PRINTF((" count ........ %d\n", pkt->lock_put_unlock.count)); MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->lock_put_unlock.datatype)); MPIU_DBG_PRINTF((" lock_type .... %d\n", pkt->lock_put_unlock.lock_type)); MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->lock_put_unlock.target_win_handle)); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_put_unlock.source_win_handle)); break; case MPIDI_CH3_PKT_LOCK_ACCUM_UNLOCK: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK_ACCUM_UNLOCK\n")); MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->lock_accum_unlock.addr)); MPIU_DBG_PRINTF((" count ........ %d\n", pkt->lock_accum_unlock.count)); MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->lock_accum_unlock.datatype)); MPIU_DBG_PRINTF((" lock_type .... %d\n", pkt->lock_accum_unlock.lock_type)); MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->lock_accum_unlock.target_win_handle)); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_accum_unlock.source_win_handle)); break; case MPIDI_CH3_PKT_LOCK_GET_UNLOCK: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK_GET_UNLOCK\n")); MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->lock_get_unlock.addr)); MPIU_DBG_PRINTF((" count ........ %d\n", pkt->lock_get_unlock.count)); MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->lock_get_unlock.datatype)); MPIU_DBG_PRINTF((" lock_type .... %d\n", pkt->lock_get_unlock.lock_type)); MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->lock_get_unlock.target_win_handle)); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_get_unlock.source_win_handle)); MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->lock_get_unlock.request_handle)); break; case MPIDI_CH3_PKT_PT_RMA_DONE: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_PT_RMA_DONE\n")); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_accum_unlock.source_win_handle)); break; case MPIDI_CH3_PKT_LOCK_GRANTED: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK_GRANTED\n")); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_granted.source_win_handle)); break; /* case MPIDI_CH3_PKT_SHARED_LOCK_OPS_DONE: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_SHARED_LOCK_OPS_DONE\n")); MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->shared_lock_ops_done.source_win_handle)); break; */ case MPIDI_CH3_PKT_FLOW_CNTL_UPDATE: MPIU_DBG_PRINTF((" FLOW_CNTRL_UPDATE\n")); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -