---
name: "autohbw"
section: "7"
platform: "linux"
package: "libmemkind-dev"
version: "1.14.0-2"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/autohbw"
---

# autohbw(7)

An interposer library for redirecting heap allocations

## NAME

libautohbw.so - An interposer library for redirecting heap allocations

## SYNOPSIS

**LD\_PRELOAD=libautohbw.so** command {arguments ...}

## DESCRIPTION

**AutoHBW** library **(libautohbw.so)** is an interposer library for redirecting heap allocations **(malloc, calloc, realloc, valloc, posix\_memalign, memlign)** to high-bandwidth **(HBW)** memory. Consequently, AutoHBW library can be used to automatically allocate high-bandwidth memory without any modification to source code of an application.

For instance, the following command-line runs existing binary /bin/ls with AutoHBW library, automatically redirecting heap allocations (larger than a given threshold) to high-bandwidth memory.

-

  **LD\_PRELOAD=libautohbw.so** /bin/ls

## ENVIRONMENT

The behavior of AutoHBW library is controlled by the following environment variables.

**AUTO\_HBW\_SIZE=x:\[y\]**\
 Indicates that any allocation larger than *x* and smaller than *y* should be allocated in HBW memory. *x* and *y* can be followed by a K, M, or G to indicate the size in Kilo/Memga/Giga bytes (e.g., 4K, 3M, 2G).\

Examples:

- AUTO\_HBW\_SIZE=4K

  \# allocations larger than 4K allocated in HBW

- AUTO\_HBW\_SIZE=1M:5M

  \# allocations between 1M and 5M allocated in HBW

**AUTO\_HBW\_LOG=level**\
 Sets the value of logging (printing) *level.* If *level* is:\

- \-1

  no messages are printed\

- 0

  no allocations messages are printed but INFO messages are printed\

- 1

  a log message is printed for each allocation (Default)\

- 2

  a log message is printed for each allocation with a backtrace. Redirect this output and use **autohbw\_get\_src\_lines.pl** to find source lines for each allocation. Your application must be compiled with **-g** to see source lines.

Notes:

-

  1\. Logging adds extra overhead. Therefore, for performance critical runs, logging level should be 0

-

  2\. The amount of free memory printed with log messages is only approximate -- e.g. pages that are not touched yet are excluded

Examples:

- AUTO\_HBW\_LOG=1

  **AUTO\_HBW\_MEM\_TYPE=memory\_type**\
 Sets the type of memory type that should be automatically allocated. By default, this type is MEMKIND\_HBW\_PREFERRED, if MCDRAM is found in your system; otherwise, the default is MEMKIND\_DEFAULT. The names of memory types are defined in **[memkind(3)](/memkind/3.md)** man page. **memory\_type** has to be one of **MEMKIND\_DEFAULT, MEMKIND\_HUGETLB, MEMKIND\_INTERLEAVE, MEMKIND\_HBW,** **MEMKIND\_HBW\_PREFERRED, MEMKIND\_HBW\_HUGETLB, MEMKIND\_HBW\_PREFERRED\_HUGETLB,** **MEMKIND\_HBW\_GBTLB (DEPRECATED), MEMKIND\_HBW\_PREFERRED\_GBTLB (DEPRECATED), MEMKIND\_GBTLB (DEPRECATED),** **MEMKIND\_HBW\_INTERLEAVE**

If you are requesting any huge TLB pages, please make sure that the requested type is currently enabled in your OS.

Examples:

- AUTO\_HBW\_MEM\_TYPE=MEMKIND\_HBW\_PREFERRED

  \# (default, if MCDRAM present)

- AUTO\_HBW\_MEM\_TYPE=MEMKIND\_DEFAULT

  \# (default, if MCDRAM absent)

- AUTO\_HBW\_MEM\_TYPE=MEMKIND\_HBW\_HUGETLB

  - AUTO\_HBW\_MEM\_TYPE=MEMKIND\_HUGETLB

  **AUTO\_HBW\_DEBUG=0\|1\|2**\
 Set the debug message printing level. Default is 0. This is mainly for development.

## NOTES

It is possible to temporarily disable/enable automatic HBW allocations by calling disableAutoHBW() and enableAutoHBW() in source code. To call these routines, please include **autohbw\_api.h** header file and link with -lautohbw.

If high-bandwidth memory is not physically present in your system, the environment variable **MEMKIND\_HBW\_NODES** must be set to indicate the high-bandwidth node as indicated in **[memkind(3)](/memkind/3.md).**

## EXAMPLES

The following will run /bin/ls with AutoHBW library. Make sure that paths to both libautohbw.so and libmemkind.so are included in **LD\_LIBRARY\_PATH.**

-

  **LD\_PRELOAD=libautohbw.so** /bin/ls -l

To run with MPI, a shell script must be created, with the correct LD\_PRELOAD command for each rank. For example, if we put **LD\_PRELOAD=libautohbw.so /bin/ls** in a shell script named autohbw\_test.sh, it can be executed with 2 MPI ranks as:\

-

  **mpirun -n 2 ./autohbw\_test.sh**

## COPYRIGHT

Copyright (C) 2014 - 2020 Intel Corporation. All rights reserved.

## SEE ALSO

**[memkind(3)](/memkind/3.md)** [**malloc**(3)](/malloc/3.md), [**numactl**(8)](/numactl/8.md),
