diff --git a/README.md b/README.md index 5801f82..209a95d 100644 --- a/README.md +++ b/README.md @@ -44,3 +44,10 @@ When working with test packages, pay particular attention to the variables at th Scalable configuration management of clusters is most easily done using the libgenders options to control the ldmsd systemd service. An example of this is given in [gendersTutorial.md](gendersTutorial.md). + +## Packaging for versions 4 of OVIS +The optional object store sosdb uses python/numpy/cython for easy access to data arrays in python. +The default RHEL 7 Numpy (1.7) and Cython (0.19) are incompatible with sosdb usage. +While personal builds can be performed with any modern batteries-include python distribution instead of Redhat's, +rpm builds require known rpms for cython and numpy, so these are provided in the toss3.numpy and toss3.cython directories. +The numpy and cython rpm spec files and generated rpms for python 2.7 will also work in plain RHEL 7 environments. diff --git a/toss3.cython/README.md b/toss3.cython/README.md new file mode 100644 index 0000000..71897ef --- /dev/null +++ b/toss3.cython/README.md @@ -0,0 +1,19 @@ +This is an rpm recipe for use with TOSS Linux version 3. + +It provides a module to add cython 0.28.5 +support via /opt/cython to the stock python 2.7 in /usr. + +To install, create the typical rpmbuild environment and (after installing the TOSS 3 cython in /opt): +``` + wget https://github.com/cython/cython/archive/0.28.5/cython-0.28.5.tar.gz + cp toss-python2-Cython.spec ~/rpmbuild/SPECS + cp cython-0.28.5.tar.gz ~/rpmbuild/SOURCES + cp module.toss-cython ~/rpmbuild/SOURCES + cd ~/rpmbuild/SPECS + rpmbuild -ba toss-python2-numpy.spec +``` +When successful, you can yum install the resulting rpm. +In the TOSS 3 modules environment, +``` + module load cython +``` diff --git a/toss3.cython/module.toss-cython b/toss3.cython/module.toss-cython new file mode 100644 index 0000000..5336c2f --- /dev/null +++ b/toss3.cython/module.toss-cython @@ -0,0 +1,20 @@ +#%Module1.0 +# vi:set filetype=tcl: +# + +# global control file +if { [file exists $env(MODULESHOME)/etc/control] } { + source $env(MODULESHOME)/etc/control +} + +# local variables +set name cython +set version 0.28.5 +set prefix /opt/$name/$version +set bindir $prefix/bin +set libdir $prefix/lib64 + +prepend-path PATH $bindir +prepend-path LD_LIBRARY_PATH $libdir +prepend-path PYTHONPATH $libdir/python2.7/site-packages + diff --git a/toss3.cython/toss-python2-Cython.spec b/toss3.cython/toss-python2-Cython.spec new file mode 100644 index 0000000..9bedc6b --- /dev/null +++ b/toss3.cython/toss-python2-Cython.spec @@ -0,0 +1,83 @@ +%global srcname cython +%global upname Cython + +%define pkgname python2-%{srcname} + +Name: %{pkgname} +Version: 0.28.5 +Release: 1%{?dist} +Summary: Language for writing Python extension modules + +License: ASL 2.0 +URL: http://www.cython.org +Source0: https://github.com/cython/cython/archive/%{version}/%{srcname}-%{version}.tar.gz +Source1: module.toss-cython + +BuildRequires: gcc + +# override /usr in installation, but Prefix isn't working for this. +%define cy_root /opt/cython/%{version} +%define cy_bin %{cy_root}/bin +%define cy_sitepackages %{cy_root}/%{_lib}/python%{python2_version}/site-packages +%define cy_sitelib %{cy_root}/%{_lib}/python%{python2_version}/site-packages +%define moddir /opt/modules/modulefiles/cython/%{version} + + +%global _description \ +This is a development version of Pyrex, a language\ +for writing Python extension modules. + +%description %{_description} + +# % package +Summary: %{summary} +Obsoletes: python2-Cython < 0.28.5 +BuildRequires: python-devel +BuildRequires: python-setuptools +Prefix: / + +%description -n %{pkgname} %{_description} +Python 2 cython 0.28 for TOSS 3. + +%prep +mkdir -p %{buildroot}%{cy_root} +%autosetup -n %{srcname}-%{version} -p1 + +%build +%py2_build + +%install +mkdir -p %{buildroot}/%{moddir} +%{__install} -m 755 %{_sourcedir}/module.toss-cython %{buildroot}/%{moddir} + +# % py2_install ; redefining the macro didn't work, so inline it here +CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install --prefix=%{cy_root} -O1 --skip-build --root %{buildroot} + +# support forward compatibility with rhel 8 +for bin in cython cythonize cygdb; do + (cd %{buildroot}%{cy_bin}; ln -s ${bin} ${bin}-%{python2_version}) + (cd %{buildroot}%{cy_bin}; ln -s ${bin}-%{python2_version} ${bin}-2) +done +rm -rf %{buildroot}%{cy_root}%{cy_sitelib}/setuptools/tests + +%files -n %{pkgname} +%license LICENSE.txt +%doc *.txt Demos Doc Tools +%{moddir}/* +%{cy_bin}/cython +%{cy_bin}/cython-2 +%{cy_bin}/cython-%{python2_version} +%{cy_bin}/cygdb +%{cy_bin}/cygdb-2 +%{cy_bin}/cygdb-%{python2_version} +%{cy_bin}/cythonize +%{cy_bin}/cythonize-2 +%{cy_bin}/cythonize-%{python2_version} +%{cy_sitepackages}/%{upname}-*.egg-info/ +%{cy_sitepackages}/%{upname}/ +%{cy_sitepackages}/pyximport/ +%{cy_sitepackages}/%{srcname}.py* + +%changelog +* Thu Jun 20 2019 Ben Allan +Cython 0.28.5 for TOSS3 system python diff --git a/toss3.numpy/README.md b/toss3.numpy/README.md new file mode 100644 index 0000000..48a2b21 --- /dev/null +++ b/toss3.numpy/README.md @@ -0,0 +1,23 @@ +This is an rpm recipe for use with TOSS linux version 3. + +It provides a module to add numpy 1.14 (less f2py) +support via /opt/numpy to the stock python 2.7 in /usr. + +It requires Cython 0.28.5 for TOSS also be installed. + +To install, create the typical rpmbuild environment and (after installing the toss3 cython in /opt): +``` + wget https://github.com/numpy/numpy/releases/download/v1.14.6/numpy-1.14.6.tar.gz + cp toss-python2-numpy.spec ~/rpmbuild/SPECS + cp numpy-1.14.6.tar.gz ~/rpmbuild/SOURCES + cp module.toss-numpy ~/rpmbuild/SOURCES + cd ~/rpmbuild/SPECS + rpmbuild -ba toss-python2-numpy.spec +``` +When successful, you can yum install the resulting rpm. + +In the TOSS 3 modules environment, +``` + module load cython + module load numpy +``` diff --git a/toss3.numpy/module.toss-numpy b/toss3.numpy/module.toss-numpy new file mode 100644 index 0000000..06b08f3 --- /dev/null +++ b/toss3.numpy/module.toss-numpy @@ -0,0 +1,18 @@ +#%Module1.0 +# vi:set filetype=tcl: +# + +# global control file +if { [file exists $env(MODULESHOME)/etc/control] } { + source $env(MODULESHOME)/etc/control +} + +# local variables +set name numpy +set version 1.14.6 +set prefix /opt/$name/$version +set libdir $prefix/lib64 + +prepend-path PYTHONPATH $libdir/python2.7/site-packages +prereq cython + diff --git a/toss3.numpy/toss-python2-numpy.spec b/toss3.numpy/toss-python2-numpy.spec new file mode 100644 index 0000000..070cf7d --- /dev/null +++ b/toss3.numpy/toss-python2-numpy.spec @@ -0,0 +1,115 @@ +Name: numpy +Version: 1.14.6 +Release: 1%{?dist} +Epoch: 1 +Summary: A fast multidimensional array facility for Python + +# override /usr in installation, but Prefix isn't working for this with python macros +# we need the path to include cython from the required package, or numpy may use the system cython +# incorrectly. +%define cy_root /opt/cython/%{version} +%define cy_bin %{cy_root}/bin +%define cy_sitepackages %{cy_root}/%{_lib}/python%{python2_version}/site-packages + +%define moddir /opt/modules/modulefiles/numpy/%{version}/ +%define numpy_root /opt/numpy/%{version} +%define numpy_sitepackages %{numpy_root}/%{_lib}/python%{python2_version}/site-packages +%define moddir /opt/modules/modulefiles/numpy/%{version}/ + +# Everything is BSD except for class SafeEval in numpy/lib/utils.py which is Python +License: BSD and Python +URL: http://www.numpy.org/ +Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz +Source1: module.toss-numpy + +BuildRequires: python-devel python-setuptools python2-cython gcc +BuildRequires: lapack-devel +BuildRequires: atlas-devel + +%description +NumPy is a general-purpose array-processing package designed to +efficiently manipulate large multi-dimensional arrays of arbitrary +records without sacrificing too much speed for small multi-dimensional +arrays. NumPy is built on the Numeric code base and adds features +introduced by numarray as well as an extended C-API and the ability to +create arrays of arbitrary type. + +There are also basic facilities for discrete fourier transform, +basic linear algebra and random number generation. + +%package -n python2-numpy +Summary: A fast multidimensional array facility for Python + +%description -n python2-numpy +NumPy is a general-purpose array-processing package designed to +efficiently manipulate large multi-dimensional arrays of arbitrary +records without sacrificing too much speed for small multi-dimensional +arrays. NumPy is built on the Numeric code base and adds features +introduced by numarray as well as an extended C-API and the ability to +create arrays of arbitrary type. + +There are also basic facilities for discrete fourier transform, +basic linear algebra and random number generation. + +%prep +%setup -q -n %{name}-%{version}%{?relc} + +# workaround for rhbz#849713 +# http://mail.scipy.org/pipermail/numpy-discussion/2012-July/063530.html +rm numpy/distutils/command/__init__.py && touch numpy/distutils/command/__init__.py + + +%build +env ATLAS=%{_libdir} \ + PATH=%{cy_bin}:$PATH \ + PYTHONPATH=%{cy_sitepackages}:$PYTHONPATH \ + FFTW=%{_libdir} BLAS=%{_libdir} \ + BLAS=%{_libdir} \ + LAPACK=%{_libdir} CFLAGS="%{optflags}" \ + %{__python2} setup.py build + +%install +mkdir -p %{buildroot}/%{moddir} +%{__install} -m 755 %{_sourcedir}/module.toss-numpy %{buildroot}/%{moddir}/py%{python2_version} + +env ATLAS=%{_libdir} \ + PATH=%{cy_bin}:$PATH \ + PYTHONPATH=%{cy_sitepackages}:$PYTHONPATH \ + FFTW=%{_libdir} BLAS=%{_libdir} \ + LAPACK=%{_libdir} CFLAGS="%{optflags}" \ + %{__python2} setup.py install --prefix=%{numpy_root} --root %{buildroot} + +rm -rf %{buildroot}/%{numpy_sitepackages}/numpy/f2py +rm -rf %{buildroot}/%{numpy_root}/bin + +%check +pushd doc &> /dev/null +PATH="%{buildroot}%{_bindir}:${PATH}" PYTHONPATH="%{buildroot}%{numpy_sitepackages}:%{cy_sitepackages}" %{__python2} -c "import pkg_resources, numpy ; numpy.test(verbose=2)" \ +# don't remove this comment +popd &> /dev/null + +%files -n python2-numpy +%license LICENSE.txt +%doc THANKS.txt site.cfg.example +%dir %{numpy_sitepackages}/%{name} +%{moddir}/* +%{numpy_sitepackages}/%{name}/*.py* +%{numpy_sitepackages}/%{name}/core +%{numpy_sitepackages}/%{name}/distutils +%{numpy_sitepackages}/%{name}/doc +%{numpy_sitepackages}/%{name}/fft +%{numpy_sitepackages}/%{name}/lib +%{numpy_sitepackages}/%{name}/linalg +%{numpy_sitepackages}/%{name}/ma +%{numpy_sitepackages}/%{name}/random +%{numpy_sitepackages}/%{name}/testing +%{numpy_sitepackages}/%{name}/tests +%{numpy_sitepackages}/%{name}/compat +%{numpy_sitepackages}/%{name}/matrixlib +%{numpy_sitepackages}/%{name}/polynomial +%{numpy_sitepackages}/%{name}-*.egg-info +%exclude %{numpy_sitepackages}/%{name}/LICENSE.txt + +%changelog +* Fri Jun 21 2019 Ben Allan - 1.14.6-1 +- package modern numpy for toss3 system python as module diff --git a/toss3/firerpms b/toss3/firerpms index 11af0f0..779cd9f 100755 --- a/toss3/firerpms +++ b/toss3/firerpms @@ -2,7 +2,7 @@ # # packing=toss3 -ovis_branch=v3.4.12 +ovis_branch=v3.4.13 sos_branch=master NetworkRequires=github.com #SOSREPO=gitlab@gitlab.opengridcomputing.com:tom/SOS.git @@ -141,7 +141,8 @@ else git submodule init sos && git submodule update sos && tar cf ../$SOSTAR sos fi -patches="ovis_self.patch" +#patches="ovis_self.patch" +patches= for i in $patches; do patch -p1 < ../patches/$i git commit -a -m "add $packing distribution patches" diff --git a/toss3/ovis.spec.in b/toss3/ovis.spec.in index 5f271ef..f40e6a5 100644 --- a/toss3/ovis.spec.in +++ b/toss3/ovis.spec.in @@ -27,7 +27,7 @@ Summary: OVIS Commands and Libraries Name: ovis Version: @VERSION@ -Release: 2.1%{?dist} +Release: 1.0%{?dist} License: GPLv2 or BSD Group: %{ldms_all} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)