diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9fa8eca --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/hans-gpg-key.asc +SOURCES/openmp-10.0.0.src.tar.xz diff --git a/.libomp.metadata b/.libomp.metadata new file mode 100644 index 0000000..7dbeab9 --- /dev/null +++ b/.libomp.metadata @@ -0,0 +1,2 @@ +32fa4b0193960f05064f2ab31b5a89c7cf48a0b9 SOURCES/hans-gpg-key.asc +f661145e8cb6abab94e4d0e3a8efd37d7c56b463 SOURCES/openmp-10.0.0.src.tar.xz diff --git a/SOURCES/0001-CMake-Make-LIBOMP_HEADERS_INSTALL_PATH-a-cache-varia.patch b/SOURCES/0001-CMake-Make-LIBOMP_HEADERS_INSTALL_PATH-a-cache-varia.patch new file mode 100644 index 0000000..c26e4de --- /dev/null +++ b/SOURCES/0001-CMake-Make-LIBOMP_HEADERS_INSTALL_PATH-a-cache-varia.patch @@ -0,0 +1,29 @@ +From 156a23f5d91c35edd888091b3d6416b755fa134d Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Tue, 16 May 2017 11:52:19 -0400 +Subject: [PATCH] CMake: Make LIBOMP_HEADERS_INSTALL_PATH a cache variable when + bulding standalone + +This way it can be overriden on the command line. +--- + runtime/src/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/runtime/src/CMakeLists.txt b/runtime/src/CMakeLists.txt +index f9e63f4..2bf6796 100644 +--- a/runtime/src/CMakeLists.txt ++++ b/runtime/src/CMakeLists.txt +@@ -282,8 +282,8 @@ add_dependencies(libomp-micro-tests libomp-test-deps) + # Install rules + # We want to install libomp in DESTDIR/CMAKE_INSTALL_PREFIX/lib + # We want to install headers in DESTDIR/CMAKE_INSTALL_PREFIX/include +-if(${OPENMP_STANDALONE_BUILD}) +- set(LIBOMP_HEADERS_INSTALL_PATH include) ++if(${OPENMP_STANDALONE_BUILD}) ++ set(LIBOMP_HEADERS_INSTALL_PATH include CACHE PATH "Install path for OpenMP headers") + else() + string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION}) + set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include") +-- +1.8.3.1 + diff --git a/SOURCES/99b03c1c18.patch b/SOURCES/99b03c1c18.patch new file mode 100644 index 0000000..2de5faf --- /dev/null +++ b/SOURCES/99b03c1c18.patch @@ -0,0 +1,39 @@ +diff --git a/runtime/test/lit.cfg b/runtime/test/lit.cfg +index 8ff668a..8e15a38 100644 +--- a/runtime/test/lit.cfg ++++ b/runtime/test/lit.cfg +@@ -100,6 +100,13 @@ if config.operating_system == 'NetBSD': + if config.operating_system in ['Linux', 'Windows']: + config.available_features.add('affinity') + ++import multiprocessing ++try: ++ if multiprocessing.cpu_count() > 1: ++ config.available_features.add('multicpu') ++except NotImplementedError: ++ pass ++ + # to run with icc INTEL_LICENSE_FILE must be set + if 'INTEL_LICENSE_FILE' in os.environ: + config.environment['INTEL_LICENSE_FILE'] = os.environ['INTEL_LICENSE_FILE'] +diff --git a/runtime/test/ompt/teams/parallel_team.c b/runtime/test/ompt/teams/parallel_team.c +index 15d9b6c..96ce0d5 100644 +--- a/runtime/test/ompt/teams/parallel_team.c ++++ b/runtime/test/ompt/teams/parallel_team.c +@@ -1,5 +1,5 @@ + // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s +-// REQUIRES: ompt ++// REQUIRES: ompt, multicpu + // UNSUPPORTED: gcc + #include "callback.h" + +diff --git a/runtime/test/ompt/teams/serial_teams.c b/runtime/test/ompt/teams/serial_teams.c +index 64d0c89..abd3db5 100644 +--- a/runtime/test/ompt/teams/serial_teams.c ++++ b/runtime/test/ompt/teams/serial_teams.c +@@ -1,5 +1,5 @@ + // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s +-// REQUIRES: ompt ++// REQUIRES: ompt, multicpu + // UNSUPPORTED: gcc + #include "callback.h" diff --git a/SOURCES/lit.fedora.cfg.py b/SOURCES/lit.fedora.cfg.py new file mode 100644 index 0000000..10d1f1f --- /dev/null +++ b/SOURCES/lit.fedora.cfg.py @@ -0,0 +1,15 @@ +import tempfile + +compiler = '%(libomp_compiler)s' % lit_config.params +config.test_filecheck = '%(bindir)s/FileCheck' % lit_config.params +config.omp_header_directory = '%(includedir)s' % lit_config.params +config.libomp_obj_root = tempfile.mkdtemp() +config.library_dir = '%(libdir)s' % lit_config.params +test_root = '%(libomp_test_root)s' % lit_config.params + +# Lit will default to the compiler used to build openmp, which is gcc, but we +# want to run the tests using clang. +config.test_compiler_features = ['clang'] +config.test_c_compiler = 'clang' +config.test_cxx_compiler = 'clang++' +lit_config.load_config(config, '%(libomp_test_root)s/lit.cfg' % lit_config.params) diff --git a/SOURCES/openmp-10.0.0.src.tar.xz.sig b/SOURCES/openmp-10.0.0.src.tar.xz.sig new file mode 100644 index 0000000..283ae21 Binary files /dev/null and b/SOURCES/openmp-10.0.0.src.tar.xz.sig differ diff --git a/SOURCES/run-lit-tests b/SOURCES/run-lit-tests new file mode 100644 index 0000000..f7e908e --- /dev/null +++ b/SOURCES/run-lit-tests @@ -0,0 +1,63 @@ +#!/usr/bin/bash + +set -e + +usage() { + echo "usage: `basename $0` [OPTIONS]" + echo " --threads NUM The number of threads to use for running tests." +} + + +threads_arg='' + +while [ $# -gt 0 ]; do + case $1 in + --threads) + shift + threads_arg="--threads $1" + ;; + --multilib-arch) + shift + ARCH=$1 + ;; + * ) + echo "unknown option: $1" + echo "" + usage + exit 1 + ;; + esac + shift +done + + +set -xe + +if [ -z "$ARCH" ]; then + ARCH=`rpm --eval '%_arch'` +fi + +case $ARCH in + arm) + ;& + i686) + LIB_DIR="/usr/lib/" + ;; + *) + LIB_DIR="/usr/lib64/" + ;; +esac + +BIN_DIR="/usr/bin/" +INCLUDE_DIR="/usr/include/" + +lit $threads_arg -v \ + --config-prefix $ARCH \ + -Dlibomp_compiler=clang \ + -Dbindir=$BIN_DIR \ + -Dlibdir=$LIB_DIR \ + -Dincludedir=$INCLUDE_DIR \ + -Dlibomp_test_root=/usr/share/libomp/src/runtime/test \ + /usr/share/libomp/src/runtime/test + +exit 0 diff --git a/SPECS/libomp.spec b/SPECS/libomp.spec new file mode 100644 index 0000000..71399dc --- /dev/null +++ b/SPECS/libomp.spec @@ -0,0 +1,195 @@ +#%%global rc_ver 6 +%global baserelease 1 +%global libomp_srcdir openmp-%{version}%{?rc_ver:rc%{rc_ver}}.src + + +%ifarch ppc64le +%global libomp_arch ppc64 +%else +%global libomp_arch %{_arch} +%endif + +Name: libomp +Version: 10.0.0 +Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist} +Summary: OpenMP runtime for clang + +License: NCSA +URL: http://openmp.llvm.org +%if 0%{?rc_ver:1} +Source0: https://prereleases.llvm.org/%{version}/rc%{rc_ver}/%{libomp_srcdir}.tar.xz +Source3: https://prereleases.llvm.org/%{version}/rc%{rc_ver}/%{libomp_srcdir}.tar.xz.sig +%else +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{libomp_srcdir}.tar.xz +Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{libomp_srcdir}.tar.xz.sig +%endif +Source1: run-lit-tests +Source2: lit.fedora.cfg.py +Source4: https://prereleases.llvm.org/%{version}/hans-gpg-key.asc + +Patch0: 0001-CMake-Make-LIBOMP_HEADERS_INSTALL_PATH-a-cache-varia.patch +Patch1: 99b03c1c18.patch + +BuildRequires: cmake +BuildRequires: elfutils-libelf-devel +BuildRequires: perl +BuildRequires: perl-Data-Dumper +BuildRequires: perl-Encode +BuildRequires: libffi-devel + +Requires: elfutils-libelf%{?isa} + +# libomp does not support s390x. +ExcludeArch: s390x + +%description +OpenMP runtime for clang. + +%package devel +Summary: OpenMP header files +Requires: clang-devel%{?isa} = %{version} + +%description devel +OpenMP header files. + +%package test +Summary: OpenMP regression tests +Requires: %{name}%{?isa} = %{version} +Requires: %{name}-devel%{?isa} = %{version} +Requires: clang +Requires: llvm +Requires: gcc +Requires: gcc-c++ +Requires: python3-lit + +%description test +OpenMP regression tests + +%prep +%autosetup -n %{libomp_srcdir} -p1 + +%build +mkdir -p _build +cd _build + +%cmake .. \ + -DLIBOMP_INSTALL_ALIASES=OFF \ + -DLIBOMP_HEADERS_INSTALL_PATH:PATH=%{_libdir}/clang/%{version}/include \ +%if 0%{?__isa_bits} == 64 + -DOPENMP_LIBDIR_SUFFIX=64 \ +%else + -DOPENMP_LIBDIR_SUFFIX= \ +%endif + +%make_build + + +%install +%make_install -C _build + +# Test package setup +%global libomp_srcdir %{_datadir}/libomp/src/ +%global libomp_testdir %{libomp_srcdir}/runtime/test/ +%global lit_cfg %{libomp_testdir}/%{_arch}.site.cfg.py +%global lit_fedora_cfg %{_datadir}/libomp/lit.fedora.cfg.py + +install -d %{buildroot}%{libomp_srcdir}/runtime +cp -R runtime/test %{buildroot}%{libomp_srcdir}/runtime +cp -R runtime/src %{buildroot}%{libomp_srcdir}/runtime + +# Generate lit config files. Strip off the last line that initiates the +# test run, so we can customize the configuration. +head -n -1 _build/runtime/test/lit.site.cfg >> %{buildroot}%{lit_cfg} + +# Install custom fedora config file +cp %{SOURCE2} %{buildroot}%{lit_fedora_cfg} + +# Patch lit config files to load custom fedora config +echo "lit_config.load_config(config, '%{lit_fedora_cfg}')" >> %{buildroot}%{lit_cfg} + +# Install test script +install -d %{buildroot}%{_libexecdir}/tests/libomp +install -m 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/tests/libomp + +# Remove static libraries with equivalent shared libraries +rm -rf %{buildroot}%{_libdir}/libarcher_static.a + + +%files +%{_libdir}/libomp.so +%{_libdir}/libomptarget.so +%ifnarch %{arm} +%{_libdir}/libarcher.so +%endif +%ifnarch %{arm} %{ix86} +%{_libdir}/libomptarget.rtl.%{libomp_arch}.so +%endif + +%files devel +%{_libdir}/clang/%{version}/include/omp.h +%ifnarch %{arm} +%{_libdir}/clang/%{version}/include/omp-tools.h +%{_libdir}/clang/%{version}/include/ompt.h +%endif + +%files test +%{_datadir}/libomp +%{_libexecdir}/tests/libomp/ + +%changelog +* Thu Apr 9 2020 sguelton@redhat.com - 10.0.0-1 +- 10.0.0 final + +* Thu Dec 19 2019 Tom Stellard - 9.0.1-1 +- 9.0.1 Release + +* Fri Sep 27 2019 Tom Stellard - 9.0.0-1 +- 9.0.0 Release + +* Thu Aug 1 2019 sguelton@redhat.com - 8.0.1-1 +- 8.0.1 release + +* Thu Jun 13 2019 sguelton@redhat.com - 8.0.1-0.1.rc2 +- 8.0.1rc2 Release + +* Mon Apr 29 2019 sguelton@redhat.com - 8.0.0-1 +- 8.0.0 Release + +* Fri Dec 14 2018 Tom Stellard - 7.0.1-1 +- 7.0.1 Release + +* Wed Dec 12 2018 Tom Stellard - 7.0.1-0.2.rc3 +- Fix test failures on single-core systems + +* Mon Dec 10 2018 Tom Stellard - 7.0.1-0.1.rc3 +- 7.0.1-rc3 Release + +* Tue Nov 27 2018 Tom Stellard - 7.0.0-1 +- 7.0.0 Release + +* Sat Nov 10 2018 Tom Stellard - 6.0.1-3 +- Don't build libomp-test on i686 + +* Mon Oct 01 2018 Tom Stellard - 6.0.1-2 +- Drop scl macros + +* Wed Jul 11 2018 Tom Stellard - 6.0.1-1 +- 6.0.1 Release + +* Mon Jan 15 2018 Tom Stellard - 5.0.1-2 +- Drop ExcludeArch: ppc64 + +* Thu Dec 21 2017 Tom Stellard - 5.0.1-1 +- 5.0.1 Release. + +* Wed Jun 21 2017 Tom Stellard - 4.0.1-1 +- 4.0.1 Release. + +* Wed Jun 07 2017 Tom Stellard - 4.0.0-3 +- Rename libopenmp->libomp + +* Fri May 26 2017 Tom Stellard - 4.0.0-2 +- Disable build on s390x + +* Mon May 15 2017 Tom Stellard - 4.0.0-1 +- Initial version.