static UCS_F_ALWAYS_INLINE void ucp_tag_recv_request_init(ucp_request_t *req, ucp_worker_h worker, void* buffer, size_t count, ucp_datatype_t datatype, uint16_t req_flags) { ucp_dt_generic_t *dt_gen; req->flags = UCP_REQUEST_FLAG_EXPECTED | UCP_REQUEST_FLAG_RECV | req_flags; req->recv.state.offset = 0; req->recv.worker = worker; switch (datatype & UCP_DATATYPE_CLASS_MASK) { case UCP_DATATYPE_IOV: req->recv.state.dt.iov.iov_offset = 0; req->recv.state.dt.iov.iovcnt_offset = 0; req->recv.state.dt.iov.iovcnt = count; req->recv.state.dt.iov.memh = UCT_MEM_HANDLE_NULL; break; case UCP_DATATYPE_GENERIC: dt_gen = ucp_dt_generic(datatype); req->recv.state.dt.generic.state = UCS_PROFILE_NAMED_CALL("dt_start", dt_gen->ops.start_unpack, dt_gen->context, buffer, count); ucs_debug("req %p buffer %p count %zu dt_gen state=%p", req, buffer, count, req->recv.state.dt.generic.state); break; default: break; } if (ucs_log_enabled(UCS_LOG_LEVEL_TRACE_REQ)) { req->recv.info.sender_tag = 0; } }
ucs_log_func_rc_t ucs_log_default_handler(const char *file, unsigned line, const char *function, ucs_log_level_t level, const char *prefix, const char *message, va_list ap) { size_t buffer_size = ucs_config_memunits_get(ucs_global_opts.log_buffer_size, 256, 2048); const char *short_file; struct timeval tv; size_t length; char *buf; char *valg_buf; if (!ucs_log_enabled(level) && (level != UCS_LOG_LEVEL_PRINT)) { return UCS_LOG_FUNC_RC_CONTINUE; } buf = ucs_alloca(buffer_size + 1); buf[buffer_size] = 0; strncpy(buf, prefix, buffer_size); length = strlen(buf); vsnprintf(buf + length, buffer_size - length, message, ap); short_file = strrchr(file, '/'); short_file = (short_file == NULL) ? file : short_file + 1; gettimeofday(&tv, NULL); if (level <= ucs_global_opts.log_level_trigger) { ucs_handle_error(ucs_log_level_names[level], "%13s:%-4u %s: %s", short_file, line, ucs_log_level_names[level], buf); } else if (RUNNING_ON_VALGRIND) { valg_buf = ucs_alloca(buffer_size + 1); snprintf(valg_buf, buffer_size, "[%lu.%06lu] %16s:%-4u %-4s %-5s %s\n", tv.tv_sec, tv.tv_usec, short_file, line, "UCX", ucs_log_level_names[level], buf); VALGRIND_PRINTF("%s", valg_buf); } else if (ucs_log_initialized) { fprintf(ucs_log_file, "[%lu.%06lu] [%s:%-5d:%d] %16s:%-4u %-4s %-5s %s\n", tv.tv_sec, tv.tv_usec, ucs_log_hostname, ucs_log_pid, ucs_log_get_thread_num(), short_file, line, "UCX", ucs_log_level_names[level], buf); } else { fprintf(stdout, "[%lu.%06lu] %16s:%-4u %-4s %-5s %s\n", tv.tv_sec, tv.tv_usec, short_file, line, "UCX", ucs_log_level_names[level], buf); } /* flush the log file if the log_level of this message is fatal or error */ if (level <= UCS_LOG_LEVEL_ERROR) { ucs_log_flush(); } return UCS_LOG_FUNC_RC_CONTINUE; }
static void ucp_wireup_print_config(ucp_context_h context, const ucp_ep_config_key_t *key, const char *title, uint8_t *addr_indices) { char lane_info[128], *p, *endp; ucp_lane_index_t lane, amo_index; ucp_rsc_index_t rsc_index; ucp_md_map_t md_map; if (!ucs_log_enabled(UCS_LOG_LEVEL_DEBUG)) { return; } ucs_debug("%s: am_lane %d wirep_lane %d rma_lane_map 0x%"PRIx64 " amo_lane_map 0x%"PRIx64" reachable_mds 0x%x", title, key->am_lane, key->wireup_msg_lane, key->rma_lane_map, key->amo_lane_map, key->reachable_md_map); for (lane = 0; lane < key->num_lanes; ++lane) { p = lane_info; endp = lane_info + sizeof(lane_info); rsc_index = key->lanes[lane]; if (addr_indices != NULL) { snprintf(p, endp - p, "->addr[%d] ", addr_indices[lane]); p += strlen(p); } if (key->am_lane == lane) { snprintf(p, endp - p, "[am]"); p += strlen(p); } md_map = ucp_lane_map_get_lane(key->rma_lane_map, lane); if (md_map) { snprintf(p, endp - p, "[rma->md%d]", ucs_ffs64(md_map)); p += strlen(p); } amo_index = ucp_ep_get_amo_lane_index(key, lane); if (amo_index != UCP_NULL_LANE) { md_map = ucp_lane_map_get_lane(key->amo_lane_map, amo_index); if (md_map) { snprintf(p, endp - p, "[amo[%d]->md%d]", amo_index, ucs_ffs64(md_map)); p += strlen(p); } } if (key->wireup_msg_lane == lane) { snprintf(p, endp - p, "[wireup]"); p += strlen(p); } ucs_debug("%s: lane[%d] using rsc[%d] "UCT_TL_RESOURCE_DESC_FMT " %s", title, lane, rsc_index, UCT_TL_RESOURCE_DESC_ARG(&context->tl_rscs[rsc_index].tl_rsc), lane_info); } }