Skip to content

Commit

Permalink
Merge pull request #1991 from hoopoepg/topic/v1.2.x
Browse files Browse the repository at this point in the history
UCX: backports from 1.3/master
  • Loading branch information
yosefe authored Nov 14, 2017
2 parents 46bd382 + 808406b commit afad266
Show file tree
Hide file tree
Showing 61 changed files with 261 additions and 67 deletions.
5 changes: 5 additions & 0 deletions config/m4/ucm.m4
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ esac

AM_CONDITIONAL([HAVE_UCM_PTMALLOC286],[test "x$HAVE_UCM_PTMALLOC286" = "xyes"])

AC_CHECK_FUNCS([malloc_get_state malloc_set_state],
[],
[],
[#include <stdlib.h>])

3 changes: 3 additions & 0 deletions src/ucp/api/ucp.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
#include <ucs/type/thread_mode.h>
#include <ucs/type/cpu_set.h>
#include <ucs/config/types.h>
#include <ucs/sys/compiler_def.h>
#include <stdio.h>

BEGIN_C_DECLS

/**
* @defgroup UCP_API Unified Communication Protocol (UCP) API
Expand Down Expand Up @@ -2446,5 +2448,6 @@ ucs_status_t ucp_worker_flush(ucp_worker_h worker);
* UCP hello world client / server example utility.
*/

END_C_DECLS

#endif
3 changes: 3 additions & 0 deletions src/ucp/api/ucp_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@


#include <ucp/api/ucp_def.h>
#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

/**
* @ingroup UCP_COMM
Expand All @@ -32,5 +34,6 @@ void ucp_request_release(void *request);
*/
void ucp_ep_destroy(ucp_ep_h ep);

END_C_DECLS

#endif
2 changes: 1 addition & 1 deletion src/ucp/wireup/wireup.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ ucs_status_t ucp_wireup_init_lanes(ucp_ep_h ep, unsigned address_count,
key.reachable_md_map |= ucp_ep_config(ep)->key.reachable_md_map;

new_cfg_index = ucp_worker_get_ep_config(worker, &key);
if ((ep->cfg_index == new_cfg_index)) {
if (ep->cfg_index == new_cfg_index) {
return UCS_OK; /* No change */
}

Expand Down
5 changes: 5 additions & 0 deletions src/ucs/algorithm/crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include <stddef.h>
#include <stdint.h>

#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

/**
* Calculate CRC16 of an arbitrary buffer.
*
Expand All @@ -26,5 +30,6 @@ uint16_t ucs_crc16(const void *buffer, size_t size);
*/
uint16_t ucs_crc16_string(const char *s);

END_C_DECLS

#endif
4 changes: 4 additions & 0 deletions src/ucs/algorithm/qsort_r.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@

#include <stddef.h>

#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

/**
* Compare callback for @ref qsort_r.
Expand All @@ -59,5 +62,6 @@ typedef int ucs_qsort_r_compare_cb_t(const void *elem1, const void *elem2,
void ucs_qsort_r(void *base, size_t nmemb, size_t size,
ucs_qsort_r_compare_cb_t *compare, void *arg);

END_C_DECLS

#endif
10 changes: 8 additions & 2 deletions src/ucs/arch/aarch64/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "config.h"
#include <time.h>
#include <sys/times.h>
#include <ucs/sys/compiler_def.h>
#include <ucs/arch/generic/cpu.h>
#if __ARM_NEON
#include <arm_neon.h>
Expand All @@ -19,6 +20,8 @@

#define UCS_ARCH_CACHE_LINE_SIZE 64

BEGIN_C_DECLS

/**
* Assume the worst - weak memory ordering.
*/
Expand Down Expand Up @@ -63,8 +66,6 @@ static inline int ucs_arch_get_cpu_flag()
return UCS_CPU_FLAG_UNKNOWN;
}

#endif

static inline void ucs_arch_wait_mem(void *address)
{
unsigned long tmp;
Expand All @@ -73,3 +74,8 @@ static inline void ucs_arch_wait_mem(void *address)
: "=&r"(tmp)
: "r"(address));
}

END_C_DECLS

#endif

4 changes: 4 additions & 0 deletions src/ucs/arch/ppc64/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
#ifdef HAVE_SYS_PLATFORM_PPC_H
# include <sys/platform/ppc.h>
#endif
#include <ucs/sys/compiler_def.h>
#include <ucs/arch/generic/cpu.h>
#include <stdint.h>

BEGIN_C_DECLS

#define UCS_ARCH_CACHE_LINE_SIZE 128

Expand Down Expand Up @@ -53,4 +55,6 @@ double ucs_arch_get_clocks_per_sec();

#define ucs_arch_wait_mem ucs_arch_generic_wait_mem

END_C_DECLS

#endif
3 changes: 3 additions & 0 deletions src/ucs/arch/x86_64/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <ucs/sys/compiler.h>
#include <ucs/arch/generic/cpu.h>
#include <ucs/sys/compiler_def.h>
#include <stdint.h>

#ifdef __SSE4_1__
Expand All @@ -19,6 +20,7 @@
# include <immintrin.h>
#endif

BEGIN_C_DECLS

#define UCS_ARCH_CACHE_LINE_SIZE 64

Expand Down Expand Up @@ -48,6 +50,7 @@ ucs_cpu_flag_t ucs_arch_get_cpu_flag() UCS_F_NOOPTIMIZE;

#define ucs_arch_wait_mem ucs_arch_generic_wait_mem

END_C_DECLS

#endif

4 changes: 4 additions & 0 deletions src/ucs/async/async.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#include "signal.h"
#include "async_fwd.h"

#include <ucs/sys/compiler_def.h>
#include <ucs/datastruct/mpmc.h>
#include <ucs/time/time.h>
#include <ucs/debug/log.h>

BEGIN_C_DECLS

/**
* Async event context. Manages timer and fd notifications.
Expand Down Expand Up @@ -119,4 +121,6 @@ static inline int ucs_async_check_miss(ucs_async_context_t *async)
} while (0)


END_C_DECLS

#endif
2 changes: 2 additions & 0 deletions src/ucs/async/async_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <ucs/config/types.h>
#include <ucs/time/time_def.h>

BEGIN_C_DECLS

typedef struct ucs_async_context ucs_async_context_t;

Expand Down Expand Up @@ -121,5 +122,6 @@ void ucs_async_poll(ucs_async_context_t *async);

void __ucs_async_poll_missed(ucs_async_context_t *async);

END_C_DECLS

#endif
2 changes: 0 additions & 2 deletions src/ucs/config/global_opts.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ ucs_global_opts_t ucs_global_opts = {
.stats_dest = "",
.tuning_path = "",
.memtrack_dest = "",
.stats_dest = "",
.stats_trigger = "exit",
.memtrack_dest = "",
.profile_mode = 0,
.profile_file = "",
.stats_filter = { NULL, 0 },
Expand Down
4 changes: 4 additions & 0 deletions src/ucs/config/global_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

#include <ucs/stats/stats_fwd.h>
#include <ucs/type/status.h>
#include <ucs/sys/compiler_def.h>
#include <stddef.h>
#include <stdio.h>

BEGIN_C_DECLS


/**
Expand Down Expand Up @@ -108,4 +110,6 @@ ucs_status_t ucs_global_opts_clone(void *dst);
void ucs_global_opts_release();
void ucs_global_opts_print(FILE *stream, ucs_config_print_flags_t print_flags);

END_C_DECLS

#endif
4 changes: 4 additions & 0 deletions src/ucs/config/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@

#include <ucs/type/status.h>
#include <ucs/sys/math.h>
#include <ucs/sys/compiler_def.h>
#include <stdio.h>


#define UCS_CONFIG_PREFIX "UCX_"
#define UCS_CONFIG_ARRAY_MAX 128

BEGIN_C_DECLS

/*
* Configuration varaibles syntax:
Expand Down Expand Up @@ -326,4 +328,6 @@ size_t ucs_config_memunits_get(size_t config_size, size_t auto_size,
int ucs_config_names_search(ucs_config_names_array_t config_names,
const char *str);

END_C_DECLS

#endif
4 changes: 4 additions & 0 deletions src/ucs/datastruct/callbackq.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <ucs/async/async_fwd.h>
#include <ucs/datastruct/list_types.h>
#include <stdint.h>
#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

/*
*
Expand Down Expand Up @@ -236,6 +239,7 @@ void ucs_callbackq_add_slow_path(ucs_callbackq_t *cbq,
void ucs_callbackq_remove_slow_path(ucs_callbackq_t *cbq,
ucs_callbackq_slow_elem_t* elem);

END_C_DECLS

/**
* Remove all slow path elements with a given callback function from the list.
Expand Down
4 changes: 4 additions & 0 deletions src/ucs/datastruct/mpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <ucs/debug/log.h>
#include <ucs/debug/memtrack.h>
#include <ucs/type/status.h>
#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS


typedef struct ucs_mpool_chunk ucs_mpool_chunk_t;
Expand Down Expand Up @@ -235,5 +238,6 @@ void ucs_mpool_chunk_munmap(ucs_mpool_t *mp, void *chunk);
ucs_status_t ucs_mpool_hugetlb_malloc(ucs_mpool_t *mp, size_t *size_p, void **chunk_p);
void ucs_mpool_hugetlb_free(ucs_mpool_t *mp, void *chunk);

END_C_DECLS

#endif /* MPOOL_H_ */
3 changes: 3 additions & 0 deletions src/ucs/debug/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <ucs/config/global_opts.h>
#include <stdint.h>

BEGIN_C_DECLS

#define ucs_log_enabled(_level) \
ucs_unlikely(((_level) <= UCS_MAX_LOG_LEVEL) && ((_level) <= (ucs_global_opts.log_level)))
Expand Down Expand Up @@ -144,5 +145,7 @@ const char *ucs_log_dump_hex(const void* data, size_t length, char *buf, size_t
void ucs_log_push_handler(ucs_log_func_t handler);
void ucs_log_pop_handler();

END_C_DECLS

#endif

4 changes: 4 additions & 0 deletions src/ucs/debug/memtrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
# include "config.h"
#endif

#include <ucs/sys/compiler_def.h>

#include <sys/types.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>

BEGIN_C_DECLS

enum {
UCS_MEMTRACK_STAT_ALLOCATION_COUNT,
Expand Down Expand Up @@ -158,5 +161,6 @@ char *ucs_strdup(const char *src, const char *name);

#endif /* ENABLE_MEMTRACK */

END_C_DECLS

#endif
4 changes: 2 additions & 2 deletions src/ucs/debug/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ static void ucs_profile_file_write_data(int fd, void *data, size_t size)
{
ssize_t written = write(fd, data, size);
if (written < 0) {
ucs_warn("failed to write %Zu bytes to profiling file: %m", size);
ucs_warn("failed to write %zu bytes to profiling file: %m", size);
} else if (size != written) {
ucs_warn("wrote only %Zd of %Zu bytes to profiling file: %m",
ucs_warn("wrote only %zd of %zu bytes to profiling file: %m",
written, size);
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/ucs/stats/client_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,36 +333,36 @@ ucs_stats_server_entity_update(ucs_stats_server_h server, stats_entity_t *entity
frag_hole_t *hole, *new_hole;
void *frag_start, *frag_end, *hole_end;

ucs_debug("From %s:%d - timestamp %"PRIu64", %Zu..%Zu / %Zu",
ucs_debug("From %s:%d - timestamp %"PRIu64", %zu..%zu / %zu",
inet_ntoa(entity->in_addr.sin_addr), ntohs(entity->in_addr.sin_port),
timestamp, frag_offset, frag_offset + frag_size, total_size);

if (timestamp < entity->timestamp) {
ucs_debug("Dropping - old timestamp");
return 0;
} else if (timestamp > entity->timestamp) {
ucs_debug("New timestamp, resetting buffer with size %Zu", total_size);
ucs_debug("New timestamp, resetting buffer with size %zu", total_size);
entity->timestamp = timestamp;
ucs_stats_server_entity_reset_buffer(entity, total_size);
} else {
/* Make sure all packets in this timestamp have the same 'total_size' */
if (entity->buffer_size != total_size) {
ucs_error("Total size in the packet is %Zu, but expected is %Zu",
ucs_error("Total size in the packet is %zu, but expected is %zu",
total_size, entity->buffer_size);
}
}

hole = find_frag_hole(entity, frag_size, frag_offset);
if (hole == NULL) {
ucs_error("cannot fill fragment (offset %Zu size %Zu)", frag_offset, frag_size);
ucs_error("cannot fill fragment (offset %zu size %zu)", frag_offset, frag_size);
return UCS_ERR_MESSAGE_TRUNCATED;
}

frag_start = entity->inprogress_buffer + frag_offset;
frag_end = entity->inprogress_buffer + frag_offset + frag_size;
hole_end = (void*)hole + hole->size;

ucs_debug("inserting into a hole of %Zu..%Zu",
ucs_debug("inserting into a hole of %zu..%zu",
(void*)hole - entity->inprogress_buffer,
hole_end - entity->inprogress_buffer);

Expand Down Expand Up @@ -414,7 +414,7 @@ ucs_stats_server_update_context(ucs_stats_server_h server, struct sockaddr_in *s

/* Validate fragment size */
if (pkt_len != pkt->frag_size + sizeof(ucs_stats_packet_hdr_t)) {
ucs_error("Invalid receive size: expected %Zu, got %Zu",
ucs_error("Invalid receive size: expected %zu, got %zu",
pkt->frag_size + sizeof(ucs_stats_packet_hdr_t), pkt_len);
return UCS_ERR_MESSAGE_TRUNCATED;
}
Expand Down
Loading

0 comments on commit afad266

Please sign in to comment.