# Copyright (c) 2014-2016 Dave Love, Liverpool University # MIT licence, per Fedora policy. # Fixme: # * Document the runtime environment variables Name: libiomp Version: 20160322 Release: 3%{?dist} Summary: Intel OpenMP runtime library License: BSD URL: https://www.openmprtl.org Source0: https://www.openmprtl.org/sites/default/files/libomp_%{version}_oss.tgz # Add library soversion Patch1: libomp_oss-sover.patch # Correct ppc64le linker Patch2: libiomp-pp64.patch # It turns out to be easier to use cmake than to get a versioned # library out of the odd Perl-based build system; gosh. BuildRequires: cmake BuildRequires: gcc-gfortran # These aren't all necessary in el6, at least, but are in recent Fedora BuildRequires: perl(Data::Dumper) perl(Net::Domain) perl(Getopt::Long) %description Intel OpenMP Runtime Library built for GCC. It may be linked instead of libgomp. This may be faster (or slower) than libgomp in some circumstances, it supports the OMPT profiling interface, has more flexible control of affinity, supports OpenMP 4.5 features not in GCC5's runtime, and might have other advantages or disadvantages. This package also provides a compatibility libgomp. %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 gomp Summary: libgomp replacement actually using %name Requires: %name%{?_isa} = %version-%release %description gomp This package provides a libgomp compatibility library (a renamed version of libiomp5) and overrides the real libgomp at runtime by virtue of ld.so configuration. If this is installed, you can still add %_libdir to LD_LIBRARY_PATH to pick up the real libgomp. %prep %setup -q -n libomp_oss %patch1 -p1 %patch2 -p1 %build # There are -Wstrict-aliasing warnings in el6, at least, but presumably # that's known to be OK. # hwloc support seems to require (currently unreleased) hwloc v2 %if 0%{?fedora} >= 24 # fixme: fails after not generating ompt.h %cmake -DLIBOMP_FORTRAN_MODULES=on -DLIBOMP_OMPT_SUPPORT=off . %else %cmake -DLIBOMP_FORTRAN_MODULES=on -DLIBOMP_OMPT_SUPPORT=on . %endif # Parallel build fails with: # Fatal Error: Can't delete temporary module file 'omp_lib_kinds.mod0': No such file or directory make # %{?_smp_mflags} # Make a gomp compatibility library. Ideally I'd do something like # cc -shared -o libgomp.so.1.0.0 -Wl,-soname,libgomp.so.1 -Lsrc -liomp5 # However, I don't know how to deal with the symbol versions ("OMP_1.0", etc.) # that apparently need to be in libgomp itself, so duplicate the library. # This looks like the cleanest way to do it. I don't think it's necessary # to invoke link.txt via cmake (see output from building libiomp5). pushd src sed -i -e 's/libiomp5.so.0.0.1/libgomp.so.1.0.0/g' CMakeFiles/omp.dir/link.txt sh CMakeFiles/omp.dir/link.txt popd %install make install DESTDIR=%buildroot # cmake ignores libdir if [ "%_lib" != lib ]; then mkdir -p %buildroot%_libdir # rpmlint complains without good cause, I think mv %buildroot%_prefix/lib/libiomp* %buildroot%_libdir fi mkdir -p %buildroot%_libdir/libiomp install -m 755 src/libgomp.so.1.0.0 %buildroot%_libdir/libiomp mkdir -p %buildroot%_sysconfdir/ld.so.conf.d echo %_libdir/libiomp >%buildroot%_sysconfdir/ld.so.conf.d/iompgomp.conf cat <README.Fedora Using libiomp5 ============== The %name package provides an OpenMP runtime library that is compatible with GCC, and may be used instead of libgomp, the native runtime. Linking ------- You can link explicitly against libiomp5 with something like gfortran -fopenmp -liomp5 ... Alternatively, you can install the libgomp compatibility package, %name-gomp, and link programs as normal. A re-named version of libiomp5 will be picked up at runtime as libgomp.so.0 since it is cached preferentially for ld.so from %_libdir/libiomp. With the -gomp package installed, you can pick up the genuine libgomp by adding %_libdir to the LD_LIBRARY_PATH environment variable. Runtime control --------------- There is currently no free documentation for the many environment variables controlling the runtime behaviour of the library. However, GOMP_CPU_AFFINITY, GOMP_STACKSIZE, and GOMP_CPU_AFFINITY are obeyed as described in the libgomp info documentation. Also, OMP_CANCELLATION, OMP_DYNAMIC, OMP_MAX_ACTIVE_LEVELS, OMP_NESTED, OMP_NUM_THREADS, OMP_PLACES, OMP_PROC_BIND, OMP_SCHEDULE, OMP_STACKSIZE, OMP_THREAD_LIMIT, and OMP_WAIT_POLICY are per the OpenMP standard. You can define KMP_SETTINGS=true to have the library print the values of the variables it recognizes which are defined or are used as defaults. Non-free documentation for the environment variables is currently mixed in with other stuff under , and the complex KMP_AFFINITY description is currently at . EOF %check make libomp-micro-tests %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %post gomp -p /sbin/ldconfig %postun gomp -p /sbin/ldconfig %{!?_licensedir:%global license %%doc} %files %license LICENSE.txt %doc README.Fedora %_libdir/*.so.* %files devel %_includedir/* %_libdir/*.so %doc doc/Reference.pdf %files gomp %_libdir/libiomp/libgomp.so* %config(noreplace) %_sysconfdir/ld.so.conf.d/iompgomp.conf %changelog * Sun Apr 3 2016 Dave Love - 20160322-3 - Turn off OMPT on f24 * Fri Apr 1 2016 Dave Love - 20160322-2 - Remove arch-dependent BR - Fix result from check-depends.pl on ppc64le * Fri Apr 1 2016 Dave Love - 20160322-1 - New version * Tue Mar 1 2016 Dave Love - 20160217-1 - New version - Don't BR devtoolset on el6 (no longer necessary) * Mon Jan 4 2016 Dave Love - 20151009-1 - Re-name to libiomp from libomp_oss - New version - Add enough perl BRs to satisfy Fedora 23 - Use cmake plus patch to add library soversion - Use %%license - No longer exclude ppc - Build Fortran and OMPT support - Run micro-tests - Move manual back to -devel -- doesn't document environment vars etc. - Add gomp sub-package * Sat Sep 26 2015 Dave Love - 20150701-1 - New version - Drop gcc5 patch * Thu May 28 2015 Dave Love - 20150401-1 - New version - BR and use devtoolset-3 compiler on el6 * Tue Mar 3 2015 Dave Love - 20141212-2 - Move manual to main package for environment variables doc etc. * Thu Feb 26 2015 Dave Love - 20141212-1 - New version * Thu Jul 3 2014 Dave Love - 20131209-1 - Initial packaging