Blob Blame History Raw
# Copyright (c) 2015, 2016  Dave Love, University of Liverpool
# MIT licence, per Fedora policy

# Notes:
# rpmlint complains unused-direct-shlib-dependency and
# undefined-non-weak-symbol, but those seem to be deliberate -- see the
# use of --no-as-needed, --as-needed in the build.
# The specific compiler flags used are presumably chosen sensibly for the
# code, and there's no security implication for this.

# ix86 isn't built -- see
# https://github.com/hfp/libxsmm/issues/103#issuecomment-256887962

# The el6 compiler is too old, but we build for el6 in copr from the
# same source.
%if 0%{?el6}
%bcond_without devtoolset
%endif

Name:		libxsmm
Version:	1.6.1
Release:	1%{?dist}
Summary:	Small dense or sparse matrix multiplications and convolutions for x86_64
License:	BSD
URL:		https://github.com/hfp/libxsmm
Source0:	https://github.com/hfp/libxsmm/archive/%version.tar.gz#/libxsmm-%version.tar.gz
# Use RPM_OPT_FLAGS
Patch2:		libxsmm-make.patch
BuildRequires:	gcc-gfortran gcc-c++ python
%if %{with devtoolset}
BuildRequires:	devtoolset-4-gcc-gfortran devtoolset-4-gcc-c++
%endif
ExclusiveArch:	x86_64

# Remove /bin/sh, /bin/bash dependencies from -doc (not actually
# required by packaging guidelines)
%global __requires_exclude /bin/.*sh$
%{?filter_setup:
%filter_from_requires /\/bin\/.*sh$/d
%filter_setup
}


%description
LIBXSMM is a library for small dense and small sparse matrix-matrix
multiplications, as well as for deep learning primitives such as small
convolutions targeting Intel Architecture (x86).  The library
generates code for the following instruction set extensions: Intel
SSE, Intel AVX, Intel AVX2, IMCI (KNCni) for Intel Xeon Phi
coprocessors ("KNC"), and Intel AVX‑512 as found in the Intel Xeon Phi
processor family ("KNL") and future Intel Xeon processors.  Small
convolutions are currently only optimized for Intel AVX‑512.
Historically the library was solely targeting the Intel Many
Integrated Core Architecture "MIC") using intrinsic functions.
Currently, optimized assembly code targets all aforementioned
instruction set extensions (static code generation), and Just‑In‑Time
(JIT) code generation targets Intel AVX and beyond.


%package	devel
Summary:	Development files for %name
Requires:	%name%{?_isa} = %version-%release

%description	devel
The %name-devel package contains libraries and header files for
developing applications that use %name.

%package	doc
Summary:	Documentation for %name
BuildArch:	noarch

%description	doc
Documentation for %name.


%prep
%setup -q
%patch2 -p1 -b .make
# MS-Windows stuff that rpmlint would complain about
find samples -name \*.vcxproj | xargs rm


%build
%if %{with devtoolset}
PATH=/opt/rh/devtoolset-4/root/usr/bin:$PATH
%endif
# OpenMP is only used by libxsmmext, so no need to turn it off.
# SSE=0 avoids -msse3, given the packaging baseline of SSE2.
make %{?_smp_mflags} STATIC=0 SYM=1 SSE=0 LDFLAGS="%{?__global_ldflags}"


%install
# Supply STATIC etc. since this actually builds stuff (a bug?),
# and otherwise we end up with bits built wrongly.
make install PREFIX=%buildroot%_prefix POUTDIR=$(basename %_libdir) \
  STATIC=0 SYM=1 SSE=0 LDFLAGS="%{?__global_ldflags}"
mkdir -p %buildroot%_libdir
cp -a lib/*.so* %buildroot%_libdir
%if !0%{?el6} || %{with devtoolset}
mkdir -p %buildroot%_fmoddir
mv %buildroot%_includedir/libxsmm.mod %buildroot%_fmoddir
%endif
rm -r %buildroot%_datadir/libxsmm
# Build artefacts
find samples -name .make | xargs rm
cp Makefile.inc samples		# included by the sub-directories
echo "These are set up to be built in the original source tree.
You will have to adjust the make files to use an installed version." >samples/README

# Avoid rpmlint no-ldconfig-symlink
pushd %buildroot%_libdir
for i in *.so.*.*; do
    ln -sf $i $(echo $i | sed "s/\\.[0-9][0-9]*$//")
done
popd


%check
# done as part of the build
#make test


%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%{!?_licensedir:%global license %doc}

%files
%license LICENSE
%_libdir/*.so.*

%files devel
%doc README.md
%_libdir/*.so
%_includedir/*
%_bindir/libxsmm_gemm_generator
%_bindir/libxsmm_conv_generator
# Get the module directory owned.  Currently in Fedora, gfortran owns
# %%_fmoddir, but not %%_fmoddir/..
# In el6, el7, it doesn't own either, but el6's gfortran is too old to be used.
%if ! 0%{?el6} || %{with devtoolset}
%dir %_fmoddir/..
%dir %_fmoddir
%_fmoddir/*.mod
%endif


%files doc
%doc README.md documentation/* samples
%license LICENSE


%changelog
* Wed Dec  7 2016 Dave Love <loveshack@fedoraproject.org> - 1.6.1-1
- New version
- Some ABI incompatibility, but kept major sover as not made stable yet
  and in view of https://github.com/hfp/libxsmm/issues/120

* Wed Nov  9 2016 Dave Love <loveshack@fedoraproject.org> - 1.5.2-2
- Remove -doc dependencies

* Fri Nov  4 2016 Dave Love <loveshack@fedoraproject.org> - 1.5.2-1
- New version

* Thu Nov  3 2016 Dave Love <loveshack@fedoraproject.org> - 1.5.1-2
- Clean samples .make files too
- Use OMP build default
- Define FCFLAGS, LDFLAGS

* Mon Oct 31 2016 Dave Love <loveshack@fedoraproject.org> - 1.5.1-1
- New version, fixing interface bug
- Spec fixes from review
- Add samples to doc

* Wed Oct 26 2016 Dave Love <loveshack@fedoraproject.org> - 1.5-4
- Don't install .mod file directly in _includedir
- Don't build for ix86
- BR python

* Tue Oct 11 2016 Dave Love <loveshack@fedoraproject.org> - 1.5-3
- Install with STATIC=0
- Avoid sse3
- Fix Fortran modules installation and %%_fmoddir ownership

* Wed Oct  5 2016 Dave Love <loveshack@fedoraproject.org> - 1.5-2
- Fix installation of libraries

* Wed Oct  5 2016 Dave Love <loveshack@fedoraproject.org> - 1.5-1
- New version
- Remove %%check (run in %%build)

* Sat Aug 20 2016 Dave Love <loveshack@fedoraproject.org> - 1.4.4-2
- Drop devtoolset on el6 (not needed)

* Thu Aug 18 2016 Dave Love <loveshack@fedoraproject.org> - 1.4.4-1
- New version, with bumped soname
- Drop patch
- Modify install section

* Sat May 21 2016 Dave Love <loveshack@fedoraproject.org> - 1.4.3-1
- New version
- Fix debuginfo

* Mon May  9 2016 Dave Love <loveshack@fedoraproject.org> - 1.4.1-1
- New version
- Link --as-needed

* Mon Apr 25 2016 Dave Love <loveshack@fedoraproject.org> - 1.4-2
- Use PREFETCH=1

* Wed Apr  6 2016 Dave Love <loveshack@fedoraproject.org> - 1.4-1
- New version

* Fri Apr  1 2016 Dave Love <loveshack@fedoraproject.org> - 1.3-2
- Install README.md, and maybe README.EPEL6

* Fri Apr  1 2016 Dave Love <loveshack@fedoraproject.org> - 1.3-1
- New version
- Sanitize spec a bit

* Mon Feb 22 2016 Dave Love <loveshack@fedoraproject.org> - 1.2-1
- New version

* Sun Jan 24 2016 Dave Love <loveshack@fedoraproject.org> - 1.1.1-2
- Install Fortran module in %%_fmoddir

* Wed Dec 30 2015 Dave Love <loveshack@fedoraproject.org> - 1.1.1-1
- New version
- Add check
- BR python
- Make it serial, not openmp, for now
- Add doc subpackage

* Wed Dec  2 2015 Dave Love <loveshack@fedoraproject.org> - 1.0.1-1
- New version

* Wed Oct  7 2015 Dave Love <loveshack@fedoraproject.org> - 0.9.1-1
- Initial packaging