Blame python-steps.spec

67b3300
%global pretty_name STEPS
67b3300
%global module_name steps
67b3300
67b3300
# Switch them off if you want
67b3300
# Best to start with the serial version
67b3300
%bcond_without mpich
67b3300
%bcond_without openmpi
67b3300
9b1fa64
%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9
9b1fa64
%global blaslib flexiblas
9b1fa64
%else
9b1fa64
%global blaslib openblas
9b1fa64
%endif
9b1fa64
67b3300
# Do not currently use system sundials
67b3300
# https://bugzilla.redhat.com/show_bug.cgi?id=1820991
67b3300
%global system_sundials  0
67b3300
67b3300
%global _description %{expand:
67b3300
STEPS is a package for exact stochastic simulation of reaction-diffusion
67b3300
systems in arbitrarily complex 3D geometries. Our core simulation algorithm is
67b3300
an implementation of Gillespie's SSA, extended to deal with diffusion of
67b3300
molecules over the elements of a 3D tetrahedral mesh.
67b3300
67b3300
While it was mainly developed for simulating detailed models of neuronal
67b3300
signaling pathways in dendrites and around synapses, it is a general tool and
67b3300
can be used for studying any biochemical pathway in which spatial gradients and
67b3300
morphology are thought to play a role.
67b3300
67b3300
STEPS also supports accurate and efficient computational of local membrane
67b3300
potentials on tetrahedral meshes, with the addition of voltage-gated channels
67b3300
and currents. Tight integration between the reaction-diffusion calculations and
67b3300
the tetrahedral mesh potentials allows detailed coupling between molecular
67b3300
activity and local electrical excitability.
67b3300
67b3300
We have implemented STEPS as a set of Python modules, which means STEPS users
67b3300
can use Python scripts to control all aspects of setting up the model,
67b3300
generating a mesh, controlling the simulation and generating and analyzing
67b3300
output. The core computational routines are still implemented as C/C++
67b3300
extension modules for maximal speed of execution.
67b3300
67b3300
STEPS 3.0.0 and above provide early parallel solution for stochastic spatial
67b3300
reaction-diffusion and electric field simulation.
67b3300
67b3300
Documentation can be found here:
67b3300
http://steps.sourceforge.net/manual/manual_index.html
67b3300
}
67b3300
67b3300
Name:           python-%{module_name}
67b3300
Version:        3.5.0
67b3300
19379b7
Release:        6%{?dist}
67b3300
Summary:        STochastic Engine for Pathway Simulation
67b3300
67b3300
License:        GPLv2
67b3300
URL:            http://steps.sourceforge.net/
67b3300
Source0:        https://github.com/CNS-OIST/STEPS/archive/%{version}/%{module_name}-%{version}.tar.gz
67b3300
67b3300
# Header only library, needs cc file
67b3300
# https://raw.githubusercontent.com/amrayn/easyloggingpp/master/src/easylogging%2B%2B.cc
67b3300
Source1:        easylogging++.cc
67b3300
# https://raw.githubusercontent.com/amrayn/easyloggingpp/master/src/easylogging%2B%2B.h
67b3300
Source2:        easylogging++.h
67b3300
67b3300
# Patches generated from: https://github.com/sanjayankur31/STEPS/tree/fedora-3.5.0
67b3300
# use system gtest
67b3300
Patch0:         0001-Unbundle-gtest.patch
67b3300
%if "%{system_sundials}" == "1"
67b3300
# Tweak cmake file to stop looking for SUNDIALS_DIR
67b3300
Patch1:         0002-Update-sundials-cmake.patch
67b3300
%endif
67b3300
# Remove flags they set
67b3300
Patch2:         0003-Remove-flags-set-by-project.patch
67b3300
# Remove pysteps flags
67b3300
Patch3:         0004-Remove-pysteps-flags.patch
67b3300
# We'll install manually, much easier and cleaner
67b3300
Patch4:         0005-Disable-pyinstall.patch
67b3300
c9df172
BuildRequires: make
67b3300
BuildRequires:  cmake
67b3300
BuildRequires:  gcc-c++
67b3300
BuildRequires:  git-core
67b3300
BuildRequires:  gtest-devel
67b3300
BuildRequires:  petsc-devel
67b3300
BuildRequires:  python3-devel
67b3300
BuildRequires:  %{py3_dist Cython}
67b3300
BuildRequires:  %{py3_dist numpy}
70558e4
BuildRequires:  %{py3_dist setuptools}
9b1fa64
BuildRequires:  %{blaslib}-devel
67b3300
BuildRequires:  Random123-devel
67b3300
67b3300
%if "%{system_sundials}" == "1"
67b3300
BuildRequires:  sundials2-devel
67b3300
%endif
67b3300
67b3300
67b3300
%description
67b3300
%{_description}
67b3300
67b3300
%package -n python3-%{module_name}
67b3300
Summary:        STochastic Engine for Pathway Simulation
67b3300
Provides:       %{module_name} = %{version}-%{release}
67b3300
67b3300
%description -n python3-%{module_name}
67b3300
%{_description}
67b3300
67b3300
67b3300
%if %{with openmpi}
67b3300
%package -n python3-%{module_name}-openmpi
67b3300
Summary:        %{module_name} built with openmpi
67b3300
BuildRequires:  openmpi-devel
67b3300
BuildRequires:  petsc-openmpi-devel
67b3300
BuildRequires:  rpm-mpi-hooks
67b3300
BuildRequires:  sundials-openmpi-devel
67b3300
Requires:       openmpi
67b3300
67b3300
%description -n python3-%{module_name}-openmpi
67b3300
%{_description}
67b3300
%endif
67b3300
67b3300
%if %{with mpich}
67b3300
%package -n python3-%{module_name}-mpich
67b3300
Summary:        %{module_name} built with mpich
67b3300
BuildRequires:  mpich-devel
67b3300
BuildRequires:  petsc-mpich-devel
67b3300
BuildRequires:  rpm-mpi-hooks
67b3300
BuildRequires:  sundials-mpich-devel
67b3300
Requires:       mpich
67b3300
67b3300
%description -n python3-%{module_name}-mpich
67b3300
%{_description}
67b3300
67b3300
%endif
67b3300
67b3300
%prep
67b3300
%autosetup -n %{pretty_name}-%{version} -S git
67b3300
67b3300
# Easyloggingpp
67b3300
mkdir -pv src/third_party/easyloggingpp/src/
67b3300
cp %{SOURCE1} src/third_party/easyloggingpp/src/ -v
67b3300
cp %{SOURCE2} src/third_party/easyloggingpp/src/ -v
67b3300
67b3300
67b3300
# Correct for sundials2
67b3300
# sed -i.orig 's|^#include.*
67b3300
67b3300
67b3300
# Build directories
67b3300
mkdir build
67b3300
%if %{with openmpi}
67b3300
mkdir build-openmpi
67b3300
%endif
67b3300
67b3300
%if %{with mpich}
67b3300
mkdir build-mpich
67b3300
%endif
67b3300
67b3300
%build
67b3300
# Best to use && so that if anything in the chain fails, the build also fails
67b3300
# straight away
67b3300
%global do_cmake_config %{expand: \
67b3300
echo
67b3300
echo "*** BUILDING %{module_name}-%{version}$MPI_COMPILE_TYPE ***"
67b3300
echo
67b3300
%set_build_flags
67b3300
pushd build$MPI_COMPILE_TYPE  &&
67b3300
    cmake \\\
67b3300
        -DUSE_BUNDLE_EASYLOGGINGPP:BOOLEAN="ON" \\\
67b3300
        -DUSE_BUNDLE_RANDOM123:BOOLEAN="OFF" \\\
67b3300
%if "%{system_sundials}" == "1"
67b3300
        -DUSE_BUNDLE_SUNDIALS:BOOLEAN="OFF" \\\
67b3300
        -DSUNDIALS_DIR:PATH=%{_datadir} \\\
67b3300
        -DSUNDIALS_INCLUDE_DIR:PATH=%{_includedir}/sundials2 \\\
67b3300
        -DSUNDIALS_LIBRARY_DIR:PATH=%{_libdir} \\\
67b3300
%endif
67b3300
        -DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
67b3300
        -DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
67b3300
        -DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
67b3300
        -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\
67b3300
        -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
67b3300
        -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
67b3300
        -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
67b3300
        -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\
67b3300
        -DPYTHON_INSTALL_PREFIX:PATH=$MPI_PYTHON3_SITEARCH \\\
67b3300
        -DCMAKE_SKIP_RPATH:BOOL=ON \\\
67b3300
        -DUSE_MPI:BOOL=$MPI_YES \\\
67b3300
        -DUSE_PETSC:BOOL=False \\\
9b1fa64
        -DBLAS_LIBRARIES=-l%{blaslib} \\\
67b3300
        -DCMAKE_INSTALL_PREFIX:PATH=$MPI_HOME \\\
67b3300
        -DBUILD_SHARED_LIBS:BOOL=ON \\\
67b3300
%if "%{_lib}" == "lib64"
67b3300
        -DLIB_SUFFIX=64 ../ &&
67b3300
%else
67b3300
        -DLIB_SUFFIX=""  ../ &&
67b3300
%endif
67b3300
popd || exit -1;
67b3300
}
67b3300
67b3300
%global do_make_build %{expand: \
67b3300
make %{?_smp_mflags} -C build$MPI_COMPILE_TYPE &&
67b3300
pushd pysteps &&
67b3300
    CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" %{__python3}  ../build$MPI_COMPILE_TYPE/pysteps/cmake_setup.py build --executable="/usr/bin/python3 -s" --build-base=../build$MPI_COMPILE_TYPE/pysteps/build/  &&
67b3300
popd || exit -1
67b3300
}
67b3300
67b3300
# Build serial version, dummy arguments
67b3300
export MPI_COMPILE_TYPE=""
67b3300
export MPI_COMPILER=serial
67b3300
export MPI_SUFFIX=""
67b3300
export MPI_HOME=%{_prefix}
67b3300
export MPI_BIN=%{_bindir}
67b3300
export MPI_PYTHON3_SITEARCH=%{python3_sitearch}
67b3300
export MPI_YES="False"
67b3300
%{do_cmake_config}
67b3300
%{do_make_build}
67b3300
67b3300
67b3300
67b3300
# Build mpich version
67b3300
%if %{with mpich}
67b3300
%{_mpich_load}
67b3300
export CC=mpicc
67b3300
export CXX=mpicxx
67b3300
export FC=mpif90
67b3300
export F77=mpif77
67b3300
export MPI_YES="True"
67b3300
export MPI_COMPILE_TYPE="-mpich"
67b3300
%{do_cmake_config}
67b3300
%{do_make_build}
67b3300
67b3300
%{_mpich_unload}
67b3300
%endif
67b3300
67b3300
# Build OpenMPI version
67b3300
%if %{with openmpi}
67b3300
%{_openmpi_load}
67b3300
export CC=mpicc
67b3300
export CXX=mpicxx
67b3300
export FC=mpif90
67b3300
export F77=mpif77
67b3300
export MPI_YES="True"
67b3300
export MPI_COMPILE_TYPE="-openmpi"
67b3300
%{do_cmake_config}
67b3300
%{do_make_build}
67b3300
67b3300
%{_openmpi_unload}
67b3300
%endif
67b3300
67b3300
%install
67b3300
# Install everything
67b3300
%global do_install %{expand: \
67b3300
echo
67b3300
echo "*** INSTALLING %{module_name}-%{version}$MPI_COMPILE_TYPE ***"
67b3300
echo
67b3300
    make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" CPPROG="cp -p" -C build$MPI_COMPILE_TYPE || exit -1
67b3300
    pushd pysteps &&
67b3300
        CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" %{__python3}  ../build$MPI_COMPILE_TYPE/pysteps/cmake_setup.py build --executable="/usr/bin/python3 -s" --build-base=../build$MPI_COMPILE_TYPE/pysteps/build/ install --install-lib=$MPI_PYTHON3_SITEARCH -O1 --skip-build --root $RPM_BUILD_ROOT &&
67b3300
    popd || exit -1
67b3300
}
67b3300
67b3300
# install serial version
67b3300
export MPI_COMPILE_TYPE=""
67b3300
export MPI_SUFFIX=""
67b3300
export MPI_HOME=%{_prefix}
67b3300
export MPI_BIN=%{_bindir}
67b3300
export MPI_YES="False"
67b3300
export MPI_COMPILE_TYPE=""
67b3300
export MPI_PYTHON3_SITEARCH="%{python3_sitearch}"
67b3300
%{do_install}
67b3300
67b3300
# Install MPICH version
67b3300
%if %{with mpich}
67b3300
%{_mpich_load}
67b3300
export MPI_YES="True"
67b3300
export MPI_COMPILE_TYPE="-mpich"
67b3300
%{do_install}
67b3300
%{_mpich_unload}
67b3300
%endif
67b3300
67b3300
# Install OpenMPI version
67b3300
%if %{with openmpi}
67b3300
%{_openmpi_load}
67b3300
export MPI_YES="True"
67b3300
export MPI_COMPILE_TYPE="-openmpi"
67b3300
%{do_install}
67b3300
%{_openmpi_unload}
67b3300
%endif
67b3300
67b3300
67b3300
%files -n python3-%{module_name}
67b3300
%license LICENSE.md
67b3300
%{python3_sitearch}/%{module_name}
67b3300
%{python3_sitearch}/%{module_name}-%{version}-py%{python3_version}.egg-info
67b3300
67b3300
%if %{with mpich}
67b3300
%files -n python3-%{module_name}-mpich
67b3300
%license LICENSE.md
67b3300
%{python3_sitearch}/mpich/%{module_name}
67b3300
%{python3_sitearch}/mpich/%{module_name}-%{version}-py%{python3_version}.egg-info
67b3300
%endif
67b3300
67b3300
%if %{with openmpi}
67b3300
%files -n python3-%{module_name}-openmpi
67b3300
%license LICENSE.md
67b3300
%{python3_sitearch}/openmpi/%{module_name}
67b3300
%{python3_sitearch}/openmpi/%{module_name}-%{version}-py%{python3_version}.egg-info
67b3300
%endif
67b3300
67b3300
%changelog
19379b7
* Tue Oct 06 2020 Antonio Trande <sagitter@fedoraproject.org> - 3.5.0-6
19379b7
- Rebuild for sundials-5.4.0
19379b7
9b1fa64
* Thu Aug 27 2020 Iñaki Úcar <iucar@fedoraproject.org> - 3.5.0-5
9b1fa64
- https://fedoraproject.org/wiki/Changes/FlexiBLAS_as_BLAS/LAPACK_manager
9b1fa64
b3c431f
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.0-4
b3c431f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
b3c431f
70558e4
* Thu Jun 25 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 3.5.0-3
70558e4
- Explicitly BR setuptools
70558e4
59ea599
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 3.5.0-2
59ea599
- Rebuilt for Python 3.9
59ea599
67b3300
* Sat Apr 04 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 3.5.0-1
67b3300
- Initial rpmbuild