|
Packit |
345191 |
README for auothbw library
|
|
Packit |
345191 |
Ruchira Sasanka (ruchira DOT sasanka AT intel DOT com)
|
|
Packit |
345191 |
2015 April 8
|
|
Packit |
345191 |
|
|
Packit |
345191 |
PURPOSE
|
|
Packit |
345191 |
-------
|
|
Packit |
345191 |
The autohbw library is used to automatically allocate high-bandwidth (HBW)
|
|
Packit |
345191 |
memory without any modifications to source code of your application.
|
|
Packit |
345191 |
This library intercepts the standard heap allocations (e.g., malloc, calloc)
|
|
Packit |
345191 |
in your program so that it can serve those allocations out of HBW memory.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
There are two libraries installed at the same location as memkind library:
|
|
Packit |
345191 |
1) libautohbw.so -- dynamic library
|
|
Packit |
345191 |
2) libautohbw.a -- static library (provided for static linking)
|
|
Packit |
345191 |
|
|
Packit |
345191 |
USAGE
|
|
Packit |
345191 |
-----
|
|
Packit |
345191 |
To use the dynamic library, insert LD_PRELOAD=libautohbw.so and libmekind.so
|
|
Packit |
345191 |
before your commandline. For instance,
|
|
Packit |
345191 |
|
|
Packit |
345191 |
LD_PRELOAD=libautohbw.so /bin/ls
|
|
Packit |
345191 |
|
|
Packit |
345191 |
executes Unix ls utility with autohbw library. You can execute the
|
|
Packit |
345191 |
above command on the prompt or put it in a shell script. An example of
|
|
Packit |
345191 |
the latter approach is given in ./autohbw_test.sh. Make sure that
|
|
Packit |
345191 |
LD_LIBRARY_PATH environment variable contains the path to libautohbw.so
|
|
Packit |
345191 |
and libmekind.so before you exeute the above command.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
To use the statically linked library, insert -lautohbw -lmemkind
|
|
Packit |
345191 |
on your link line. You will have to provide the library path with -L to
|
|
Packit |
345191 |
point to the above libraries. If you are linking your program statically
|
|
Packit |
345191 |
(e.g., with -static or -fast flags in ifort/icc), you must use the static
|
|
Packit |
345191 |
version of autohbw library (libautohbw.a).
|
|
Packit |
345191 |
|
|
Packit |
345191 |
It is possible to temporarily disable/enable automatic HBM allocations by
|
|
Packit |
345191 |
calling disableAutoHBW() and enableAutoHBW() in your source code. To call
|
|
Packit |
345191 |
these routines, please include autohbw_api.h header file and link with
|
|
Packit |
345191 |
-lautohbw.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Usage with MPI programs
|
|
Packit |
345191 |
-----------------------
|
|
Packit |
345191 |
To use with MPI programs, you need to create a shell script to do the
|
|
Packit |
345191 |
LD_PRELOAD. E.g.,
|
|
Packit |
345191 |
mpirun -n 2 ./autohbw_test.sh
|
|
Packit |
345191 |
|
|
Packit |
345191 |
ENVIRONMENT VARIABLES
|
|
Packit |
345191 |
---------------------
|
|
Packit |
345191 |
The following environment variables control the behavior of the autohbw
|
|
Packit |
345191 |
library:
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AUTO_HBW_SIZE=x[:y]
|
|
Packit |
345191 |
Indicates that any allocation larger than x and smaller than y should be
|
|
Packit |
345191 |
allocated in HBW memory. x and y can be followed by a K, M, or G to
|
|
Packit |
345191 |
indicate the size in Kilo/Memga/Giga bytes (e.g., 4K, 3M, 2G).
|
|
Packit |
345191 |
Examples:
|
|
Packit |
345191 |
AUTO_HBW_SIZE=4K # all allocation larger than 4K allocated in HBW
|
|
Packit |
345191 |
AUTO_HBW_SIZE=1M:5M # allocations between 1M and 5M allocated in HBW
|
|
Packit |
345191 |
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AUTO_HBW_LOG=level
|
|
Packit |
345191 |
Sets the value of logging (printing) level. If level is:
|
|
Packit |
345191 |
-1 = no messages are printed
|
|
Packit |
345191 |
0 = no log messages for allocations are printed but INFO messages
|
|
Packit |
345191 |
are printed
|
|
Packit |
345191 |
1 = a log message is printed for each allocation (Default)
|
|
Packit |
345191 |
2 = a log message is printed for each allocation with a backtrace
|
|
Packit |
345191 |
Redirect this output and use autohbw_get_src_lines.pl to find
|
|
Packit |
345191 |
source lines for each allocation. Your application must be compiled
|
|
Packit |
345191 |
with -g to see source lines.
|
|
Packit |
345191 |
Notes:
|
|
Packit |
345191 |
1. Logging adds extra overhead. Therefore, performance critical runs,
|
|
Packit |
345191 |
logging level should be 0
|
|
Packit |
345191 |
2. The amount of free memory printed with log messages is only
|
|
Packit |
345191 |
approximate -- e.g. pages that are not touched yet are excluded
|
|
Packit |
345191 |
Examples:
|
|
Packit |
345191 |
AUTO_HBW_LOG=1
|
|
Packit |
345191 |
|
|
Packit |
345191 |
|
|
Packit |
345191 |
AUTO_HBW_MEM_TYPE=memory_type
|
|
Packit |
345191 |
Sets the type of memory type that should be automatically allocated. By
|
|
Packit |
345191 |
default, this type is MEMKIND_HBW_PREFERRED, if MCDRAM is found in your
|
|
Packit |
345191 |
system; otherwise, the default is MEMKIND_DEFAULT. The names of memory
|
|
Packit |
345191 |
types are definedin memkind(3) man page. If you are requesting any huge
|
|
Packit |
345191 |
TLB pages, pleasemake sure that the requested type is currently enabled
|
|
Packit |
345191 |
in your OS.
|
|
Packit |
345191 |
Examples:
|
|
Packit |
345191 |
AUTO_HBW_MEM_TYPE=MEMKIND_HBW_PREFERRED (default, if MCDRAM present)
|
|
Packit |
345191 |
AUTO_HBW_MEM_TYPE=MEMKIND_DEFAULT (default, if MCDRAM absent)
|
|
Packit |
345191 |
AUTO_HBW_MEM_TYPE=MEMKIND_HBW_HUGETLB
|
|
Packit |
345191 |
AUTO_HBW_MEM_TYPE=MEMKIND_HUGETLB
|
|
Packit |
345191 |
|