Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/m4/sysdep.m4
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ AC_CHECK_HEADERS([malloc_np.h])
AC_CHECK_HEADERS([endian.h, sys/endian.h])


#
# IEEE 754 floating-point helpers (glibc extension, absent on musl/FreeBSD)
#
AC_CHECK_HEADERS([ieee754.h])


#
# Linux-only headers
#
Expand Down
1 change: 1 addition & 0 deletions src/ucs/arch/aarch64/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <string.h>
#include <sys/times.h>
#include <ucs/sys/compiler_def.h>
#include <ucs/sys/ptr_arith.h>
Comment thread
tvegas1 marked this conversation as resolved.
#include <ucs/arch/generic/cpu.h>
#include <ucs/sys/math.h>
#include <ucs/type/status.h>
Expand Down
2 changes: 2 additions & 0 deletions src/ucs/debug/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <dlfcn.h>
#include <link.h>
#include <dirent.h>
#include <signal.h>
Comment thread
tvegas1 marked this conversation as resolved.
#include <stdlib.h>
#ifdef HAVE_DETAILED_BACKTRACE
# include <bfd.h>
#endif /* HAVE_DETAILED_BACKTRACE */
Expand Down
2 changes: 1 addition & 1 deletion src/ucs/debug/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const char *ucs_log_level_names[] = {
static unsigned ucs_log_handlers_count = 0;
static int ucs_log_initialized = 0;
static int __thread ucs_log_current_indent = 0;
static char ucs_log_hostname[HOST_NAME_MAX] = {0};
static char ucs_log_hostname[UCS_HOST_NAME_MAX + 1] = {0};
static int ucs_log_pid = 0;
static FILE *ucs_log_file = NULL;
static char *ucs_log_file_base_name = NULL;
Expand Down
7 changes: 4 additions & 3 deletions src/ucs/memory/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ unsigned ucs_numa_num_configured_cpus()

if (num_cpus == 0) {
max_cpu = ucs_numa_get_max_dirent(UCS_SYS_FS_CPUS_PATH, "cpu",
__CPU_SETSIZE, 0);
UCS_CPU_SETSIZE, 0);
num_cpus = max_cpu + 1;
}

Expand All @@ -124,12 +124,13 @@ unsigned ucs_numa_num_configured_cpus()
ucs_numa_node_t ucs_numa_node_of_cpu(int cpu)
{
/* Used for caching to improve performance */
static ucs_numa_node_t cpu_numa_node[__CPU_SETSIZE] = {0};
static ucs_numa_node_t cpu_numa_node[UCS_CPU_SETSIZE] = {0};
char *core_dir_path;
ucs_numa_node_t node;
ucs_status_t status;

ucs_assert(cpu < __CPU_SETSIZE);
UCS_STATIC_ASSERT(UCS_CPU_SETSIZE >= __CPU_SETSIZE);
ucs_assert(cpu < UCS_CPU_SETSIZE);
Comment thread
tvegas1 marked this conversation as resolved.

if (cpu_numa_node[cpu] == 0) {
status = ucs_string_alloc_formatted_path(&core_dir_path,
Expand Down
1 change: 0 additions & 1 deletion src/ucs/sys/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#define UCS_F_NOOPTIMIZE
#endif


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove line change

/**
* Copy words from _src to _dst.
*
Expand Down
12 changes: 12 additions & 0 deletions src/ucs/sys/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#include <net/if.h>
#include <netdb.h>
#include <dirent.h>
#include <limits.h>
#include <unistd.h>


#include <sys/types.h>
Expand All @@ -63,6 +65,16 @@ typedef cpuset_t ucs_sys_cpuset_t;
#error "Port me"
#endif

#ifdef HOST_NAME_MAX
#define UCS_HOST_NAME_MAX HOST_NAME_MAX
#else
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#elif defined()

#ifdef _POSIX_HOST_NAME_MAX
#define UCS_HOST_NAME_MAX _POSIX_HOST_NAME_MAX
#else
#define UCS_HOST_NAME_MAX 256
#endif
#endif

#define UCS_SYS_FS_SYSTEM_PATH "/sys/devices/system"
#define UCS_SYS_FS_CPUS_PATH UCS_SYS_FS_SYSTEM_PATH "/cpu"

Expand Down
21 changes: 21 additions & 0 deletions src/ucs/type/float8.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,28 @@
#ifndef UCS_TYPE_FLOAT_H
#define UCS_TYPE_FLOAT_H

#ifdef HAVE_IEEE754_H
#include <ieee754.h>
Comment thread
tvegas1 marked this conversation as resolved.
#else
/* Portable fallback for systems without <ieee754.h> (non-glibc, e.g. musl, FreeBSD libc) */
union ieee754_double {
double d;
struct {
#if defined(FLOAT_WORDS_BIGENDIAN)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#if __BYTE_ORDER == __BIG_ENDIAN

unsigned int negative:1;
unsigned int exponent:11;
unsigned int mantissa0:20;
unsigned int mantissa1:32;
#else
unsigned int mantissa1:32;
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
#endif
} ieee;
};
#define IEEE754_DOUBLE_BIAS 0x3ff
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove?

#endif

#include <ucs/sys/preprocessor.h>
#include <ucs/debug/assert.h>
Expand Down
Loading