File memkind-1.1.1+dev9gff9ce2a.spec of Package memkind-dev

Summary: User Extensible Heap Manager
Name: memkind
Version: 1.1.1+dev9gff9ce2a
Release: 1
License: BSD-2-Clause
Group: System Environment/Libraries
URL: http://memkind.github.io/memkind
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: automake libtool gcc-c++ unzip
%if %{defined suse_version}
BuildRequires: libnuma-devel
%else
BuildRequires: numactl-devel
%endif

Prefix: %{_prefix}
Prefix: %{_unitdir}
Obsoletes: memkind

%define namespace memkind

%if %{defined suse_version}
%define docdir %{_defaultdocdir}/%{namespace}
%else
%define docdir %{_defaultdocdir}/%{namespace}-%{version}
%endif

# x86_64 is the only arch memkind will build due to its
# current dependency on SSE4.2 CRC32 instruction which
# is used to compute thread local storage arena mappings
# with polynomial accumulations via GCC's intrinsic _mm_crc32_u64
# For further info check:
# - /lib/gcc/<target>/<version>/include/smmintrin.h
# - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36095
# - http://en.wikipedia.org/wiki/SSE4
ExclusiveArch: x86_64

# default values if version is a tagged release on github
%{!?commit: %define commit %{version}}
%{!?buildsubdir: %define buildsubdir %{namespace}-%{commit}}
Source0: https://github.com/%{namespace}/%{namespace}/archive/v%{commit}/%{buildsubdir}.tar.gz

%description
The memkind library is an user extensible heap manager built on top of
jemalloc which enables control of memory characteristics and a
partitioning of the heap between kinds of memory. The kinds of memory
are defined by operating system memory policies that have been applied
to virtual address ranges. Memory characteristics supported by
memkind without user extension include control of NUMA and page size
features. The jemalloc non-standard interface has been extended to
enable specialized arenas to make requests for virtual memory from the
operating system through the memkind partition interface. Through the
other memkind interfaces the user can control and extend memory
partition features and allocate memory while selecting enabled
features. This software is being made available for early evaluation.
Feedback on design or implementation is greatly appreciated.

%package devel
Summary: Memkind User Extensible Heap Manager development lib and tools
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Obsoletes: memkind-devel

%description devel
Install header files and development aids to link memkind library into
applications.

%package tests
Summary: Extention to libnuma for kinds of memory - validation
Group: Validation/Libraries
Requires: %{name} = %{version}-%{release}

%description tests
memkind functional tests

%prep
%setup -q -a 0 -n memkind-%{version}

%build

# It is required that we configure and build the jemalloc subdirectory
# before we configure and start building the top level memkind directory.
# To ensure the memkind build step is able to discover the output
# of the jemalloc build we must create an 'obj' directory, and build
# from within that directory.
cd %{_builddir}/%{buildsubdir}/jemalloc/
echo %{version} > %{_builddir}/%{buildsubdir}/jemalloc/VERSION
test -f configure || %{__autoconf}
mkdir %{_builddir}/%{buildsubdir}/jemalloc/obj
ln -s %{_builddir}/%{buildsubdir}/jemalloc/configure %{_builddir}/%{buildsubdir}/jemalloc/obj/
cd %{_builddir}/%{buildsubdir}/jemalloc/obj
../configure --enable-autogen --with-jemalloc-prefix=jemk_ --enable-memkind --enable-cc-silence --prefix=%{_prefix} --includedir=%{_includedir} --libdir=%{_libdir} --bindir=%{_bindir} --docdir=%{_docdir} --mandir=%{_mandir}
%{__make} %{?_smp_mflags} 

# Build memkind lib and tools
cd %{_builddir}/%{buildsubdir}
echo %{version} > %{_builddir}/%{buildsubdir}/VERSION
test -f configure || ./autogen.sh
./configure --prefix=%{_prefix} --libdir=%{_libdir} --includedir=%{_includedir} --sbindir=%{_sbindir} --enable-cxx11 --mandir=%{_mandir} --docdir=%{_docdir}/%{namespace}
%{__make} %{?_smp_mflags} libgtest.a 
%{__make} %{?_smp_mflags} checkprogs 


%install
cd %{_builddir}/%{buildsubdir}
%{__make} DESTDIR=%{buildroot} install
%{__install} -d %{buildroot}
%{__install} -d %{buildroot}/%{_unitdir}
%{__install} test/.libs/* test/*.sh test/*.ts test/*.so test/*.py %{buildroot}
rm -f %{buildroot}/libautohbw.*
rm -f %{buildroot}/%{_libdir}/lib%{namespace}.{l,}a
rm -f %{buildroot}/%{_libdir}/libautohbw.{l,}a
rm -f %{buildroot}/%{_libdir}/lib{numakind}.*

%pre

%post
/sbin/ldconfig

%preun

%postun
/sbin/ldconfig

%files
%defattr(-,root,root,-)
%license %{_docdir}/%{namespace}/COPYING
%doc %{_docdir}/%{namespace}/README
%doc %{_docdir}/%{namespace}/VERSION
%dir %{_docdir}/%{namespace}
%dir %{_unitdir}
%{_libdir}/lib%{namespace}.so.*
%{_libdir}/libautohbw.so.*
%{_bindir}/%{namespace}-hbw-nodes

%define internal_include memkind/internal

%files devel
%defattr(-,root,root,-)
%{_includedir}
%{_includedir}/hbwmalloc.h
%{_includedir}/hbw_allocator.h
%{_libdir}/lib%{namespace}.so
%{_libdir}/libautohbw.so
%{_includedir}/%{namespace}.h
%{_includedir}/%{internal_include}
%{_includedir}/%{internal_include}/%{namespace}*.h
%{_mandir}/man3/hbwmalloc.3.*
%{_mandir}/man3/hbwallocator.3.*
%{_mandir}/man3/%{namespace}*.3.*


%files tests
%defattr(-,root,root,-)
/all_tests
/environerr_hbw_malloc_test
/mallctlerr_test
/decorator_test
/slts_test
/filter_memkind
/gb_realloc
/hello_hbw
/hello_memkind
/hello_memkind_debug
/stream
/stream_memkind
/memkind_allocated
/autohbw_candidates
/pmem
/allocator_perf_tool_tests
/perf_tool
/memkind-afts.ts
/memkind-afts-ext.ts
/memkind-slts.ts
/memkind-perf.ts
/memkind-perf-ext.ts
/memkind-hbw_detection.ts
/check.sh
/test.sh
/libfopen.so
/libmallctl.so
/libmalloc.so
/libnumadist.so
/libsched.so
/hbw_detection_test.py

%exclude /*.pyo
%exclude /*.pyc

%changelog
* Wed Jul 13 2016 Krzysztof Kulakowski <krzysztof.kulakowski@intel.com> v1.1.1
- Performance improvement for memkind_free() in scenario where NULL
  was passed as kind (reduced by 60%).
- Introduced integration with Travis CI.
- Fixed issue where memory returned from calloc was not filled with zeroes
  when using memkind_pmem kinds.
- Fixed issue where interleave kinds was failing on systems without
  Transparent Huge Pages module configured.
- Resolved several issues that was causing compilation errors on some systems.
- test/test.sh is now able to detect system configuration, and run only those
  tests which requirements are meet.
- Added gtest to repo to avoid downloading it during build proecess.

* Mon May 23 2016 Krzysztof Kulakowski <krzysztof.kulakowski@intel.com> v1.1.0
- Implemented algorithm for detecting high-bandwidth memory on Intel Xeon Phi X200
  without parsing PMTT.
- PMTT-parsing service has been removed.
- memkind struct definition from memkind.h has been replaced by forward
  declaration. Definition has been moved to /internal/memkind_private.h and
  shouldn't be considered as part of library interface anymore.
- Performance improvment for hugetlb kinds (check_available() is no longer
  parsing sysfs every time).
- Performance fix by removing --enable-safe from jemmaloc build flags.
- New tests for validating high-bandwidth memory detection has been added.
- AFTS has been split into two groups: memkind-afts.ts and memkind-afts-ext.ts,
  based on amount of required memory (for details view test/README).

* Thu Mar 03 2016 Artur Koziej <artur.koziej@intel.com> v1.0.0
- hbwmalloc.h released as stable API.
- Introduce API standards: STANDARD API, NON-STANDARD API, EXPERIMENTAL API.
- Introduce memkind versioning API.
- Fix type names in hbwmalloc API.
- Change error codes to POSIX standard ones in hbwmalloc API.
- Move API headers to include directory.
- Move NON-STANDARD API, or EXPERIMENTAL API to include/memkind/internal directory.
- New man page (memkind_interleave.3) describing interleave kind.
- Significant documentation improvement.
- Performance fix for jemalloc - significantly decrease of library initialization time.
- Enforce 2MB alignment in jemalloc due to the Linux kernel bug (munmap() fails for
  huge pages, when the size is not aligned).
- Move to systemd defined service (memkind.service), drop init.d script.
- New rpm layout (memkind and memkind-devel).
- Remove false dependency on OpenMP.
- Extend test base for stress, longevity and initialization performance tests.
- Fix memory leak in ctl_growk().
- Rename namespace: hbwmalloc -> hbw.
- Rename class: hbwmalloc_allocator -> allocator.

* Thu Oct 15 2015 Krzysztof Kulakowski <krzysztof.kulakowski@intel.com> v0.3.0
- Added two new kinds: MEMKIND_INTERLEAVE and MEMKIND_HBW_INTERLEAVE
  (for details please take a look at man/memkind.3)
- Added support for file-backed memory heaps
  (for details please take a look at man/memkind_pmem.3)
- Added autohbw library, that intercepts the standard heap allocations,
  which let use high-bandwidth memory without modifying existing codebase
  (for details please take a look at examples/autohbw_README)
- jemalloc is now, staticly linked, internal component of memkind RPM
  instead of rpm dependency.
- Added memkind_allocated example which demonstrates usage of memkind
  with alignas() alignment specifier introduced in C++11
  (for details please take a look at examples/README)
- Added support for using thread local storage to improve performance in
  multithreaded applications (enabled by configure time option: --enable-tls)
- Added posibility to set number of jemalloc arenas per kind by
  configure time parameter or enviromental variable
  (for details please take a look at MEMKIND_ARENA_NUM_PER_KIND section
  of man/memkind.3).
- Added decorators to the memkind allocation APIs.
  These are weak symbols (pre and post for each API) which can modify
  the input and output of each of the calls.
- Significantly extended test base (new groups of tests: performance,
  multithreaded, PMTT, nagtive, stress).

* Fri Jan 9 2015 Christopher Cantalupo <christopher.m.cantalupo@intel.com> v0.2.0
- Bumped memkind ABI version to 0:1:0.
- Removed memkind_get_kind_for_free() from externally facing API's.  Instead if
  memkind_free() is called with zero passed for the kind then
  memkind_get_kind_for_free() is called internally.
- Moved to single callback memkind_partition_mmap() to simplify
  jemalloc modifications.
- Added hooks for setting file descriptor and offset for mmap enabling
  file-backed memory kinds.
- Added a void pointer called "priv" to memkind structure for storing data for
  user-defined kinds.
- Removed call to sched_getcpu(), now thread id is hashed to determine the arena
  index.
- Added weak symbol hooks for decorating the heap management functions.
- Fixed several issues with init.d/memkind script and spec file scriptlets that
  are exposed by SLES-12.
- Introduced an example library called numakind.
  The numakind library will allocate from the closest NUMA node to a thread as
  measured when that thread makes its first allocation call.
- Fixed error handling in memkind_gbtlb_mmap() that could cause a segfault when
  gigabyte pages are not available.
- Added tests for PMTT parser.
- Removed binary mock PMTT table from source code, replaced it with a hexdump.
- Fixed a number of issues in test scripts which were suppressing errors.
- Removed unnecessary includes from header files.
- Better error checking in example code.
- Documentation update and clean up.

* Thu Nov 13 2014 Christopher Cantalupo <christopher.m.cantalupo@intel.com> v0.1.0
- Increased test code coverage significantly.
- Fixed bug in memkind_error_message() for MEMKIND_ERROR_TOOMANY.
- Removed memkind_arena_free() API since it was redundant with memkind_default_free().
- Static memkind structs are now declared as extern in the headers and defined in the
  source files files rather than being statically defined in the headers.

* Thu Oct 30 2014 Christopher Cantalupo <christopher.m.cantalupo@intel.com> v0.0.9
- Now building with autotools.
- Updated documentation.
- Fixed typo in copyright.
- Fixed test scripts to properly handle return code of each test.
- Added C++03 standard allocator that uses hbw_malloc and hbw_free.
* Tue Sep 30 2014 Christopher Cantalupo <christopher.m.cantalupo@intel.com> v0.0.8
- Added GBTLB functionality, code clean up, documentation updates,
  examples directory.  Examples includes stream modified to use
  memkind interface.  Code coverage still lacking, and documentation
  incomplete.