diff options
author | Julian Taylor <juliantaylor108@gmail.com> | 2018-09-14 20:49:10 +0200 |
---|---|---|
committer | Julian Taylor <juliantaylor108@gmail.com> | 2018-09-20 18:42:50 +0200 |
commit | 7180479b7ce3e3b6455da66d0679274671a46bdc (patch) | |
tree | 7c5dcd6dbd2a5e3d3a7d62df9050e9f985512250 /numpy/core/setup_common.py | |
parent | bd75ffb8ccb5cfcf362306ee4149ba7bf5089139 (diff) | |
download | numpy-7180479b7ce3e3b6455da66d0679274671a46bdc.tar.gz |
ENH: mark that large allocations can use huge pages
On distributions with /sys/kernel/mm/transparent_hugepage/enabled set to
madvise we do not automatically get our memory backed by huge pages.
Explicitly madvise these regions so they can use larger pages.
This improves performance of the common large array allocation/free
cycle in numpy as page fault overhead is reduced.
asv continuous -E virtualenv:3.6 --bench bench_io.Copy HEAD^ HEAD
2.64±0.3ms 1.99±0.06ms 0.75 bench_io.Copy.time_memcpy_large_out_of_place('float32')
5.51±0.2ms 3.74±0.3ms 0.68 bench_io.Copy.time_memcpy_large_out_of_place('float64')
4.76±0.02μs 3.02±0.04μs 0.63 bench_io.Copy.time_cont_assign('float32')
5.55±0.1ms 3.31±0.1ms 0.60 bench_io.Copy.time_memcpy_large_out_of_place('complex64')
11.3±0.2ms 6.26±0.2ms 0.56 bench_io.Copy.time_memcpy_large_out_of_place('complex128')
Closes gh-11919
Diffstat (limited to 'numpy/core/setup_common.py')
-rw-r--r-- | numpy/core/setup_common.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index 356482b07..e637dbc20 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -110,7 +110,7 @@ OPTIONAL_STDFUNCS = ["expm1", "log1p", "acosh", "asinh", "atanh", "rint", "trunc", "exp2", "log2", "hypot", "atan2", "pow", "copysign", "nextafter", "ftello", "fseeko", "strtoll", "strtoull", "cbrt", "strtold_l", "fallocate", - "backtrace"] + "backtrace", "madvise"] OPTIONAL_HEADERS = [ @@ -120,6 +120,7 @@ OPTIONAL_HEADERS = [ "features.h", # for glibc version linux "xlocale.h", # see GH#8367 "dlfcn.h", # dladdr + "sys/mman.h", #madvise ] # optional gcc compiler builtins and their call arguments and optional a |