%global githash 98e6b36 %global gitdate 20210913 Name: mxnet Version: 2.0.0.alpha.rc3 Release: %{gitdate}.git%{githash}%{?dist} Summary: Lightweight, Portable, Flexible Distributed/Mobile Deep Learning License: Apache URL: https://github.com/apache/incubator-mxnet Source0: mxnet.tar.xz Patch0: mxnet-sover.patch Patch1: mxnet-cmake.patch Patch2: mxnet-gcc11.patch Patch3: mxnet-cuda11.patch BuildRequires: python3-setuptools perl-Encode perl-Data-Dumper dmlc-core-devel BuildRequires: gperftools-devel openblas-devel python3-devel onednn-devel tbb-devel BuildRequires: doxygen cmake gcc-c++ lapack-devel gtest-devel libjpeg-turbo-devel ocl-icd-devel BuildRequires: opencv-devel %global have_cuda 1 %global vcu_maj 11 %global vcu_min 4 %global gpu_target_vers "3.5+PTX 5.2 6.1 7.5 8.6" %global __cmake_in_source_build 1 %bcond_without cuda %if %{without cuda} %global have_cuda 0 %endif %if %{have_cuda} %if 0%{?fedora} BuildRequires: cuda-gcc-c++ %endif BuildRequires: cuda-nvcc-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvtx-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-cudart-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvml-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvrtc-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-driver-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvprof-%{vcu_maj}-%{vcu_min} BuildRequires: libcublas-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcufft-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcurand-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcusparse-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcusolver-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libnccl-devel BuildRequires: libcudnn8-devel BuildRequires: libcutensor-devel Requires: cuda-cudart-%{vcu_maj}-%{vcu_min} Requires: cuda-nvrtc-%{vcu_maj}-%{vcu_min} Requires: libcublas-%{vcu_maj}-%{vcu_min} Requires: libcufft-%{vcu_maj}-%{vcu_min} Requires: libcurand-%{vcu_maj}-%{vcu_min} Requires: libcusparse-%{vcu_maj}-%{vcu_min} Requires: libcusolver-%{vcu_maj}-%{vcu_min} %endif %description Open deep learning compiler stack for cpu, gpu and specialized accelerators. %package devel Summary: Development files for mxnet Requires: %{name} = %{version}-%{release} %description devel This package contains development files for mxnet. %package python3 Summary: Python files for mxnet Requires: %{name} = %{version}-%{release} Requires: python3-graphviz %description python3 This package contains python files for mxnet. %prep %setup -q -n %{name} %patch0 -p0 -b .sover~ #%patch1 -p0 -b .cmake~ %patch2 -p0 -b .gcc11~ %patch3 -p0 -b .cuda11~ %build rm -rf include/onednn rm -rf 3rdparty/onednn rm -rf 3rdparty/openmp #rm -rf 3rdparty/dlpack rm -rf 3rdparty/dmlc-core rm -rf 3rdparty/googletest rm -rf 3rdparty/nvidia_cub # graphviz sed -i -e 's|graphviz<0.9.0,>=0.8.1|graphviz>=0.8.1|g' python/setup.py # external gtest sed -i -e '/set(GTEST_ROOT/d' CMakeLists.txt sed -i -e '/add_subdirectory(${GTEST_ROOT})/d' CMakeLists.txt sed -i -e 's|${GTEST_ROOT}/include|${GTEST_ROOT}|g' CMakeLists.txt sed -i -e '/set_target_properties(gtest/d' CMakeLists.txt sed -i -e '/set_target_properties(gtest_main/d' CMakeLists.txt # external mkl-dnn sed -i -e '/add_custom_command(TARGET mxnet/,/)/d' CMakeLists.txt sed -i -e 's/load_onednn()/find_package(DNNL REQUIRED)/' CMakeLists.txt sed -i -e '/set_target_properties(dnnl/d' CMakeLists.txt sed -i -e 's|add_subdirectory(3rdparty/onednn)|find_package(DNNL REQUIRED)|' CMakeLists.txt # shared openblas (openmp variant) sed -i -e 's|libopenblas.a|libopenblaso.so|' cmake/Modules/FindOpenBLAS.cmake # disable test sed -i -e 's|add_subdirectory(tests)|#add_subdirectory(tests)|g' CMakeLists.txt # add flag sed -i -e 's| MSHADOW_INT64_TENSOR_SIZE| 0|' include/mxnet/libinfo.h # relax warn-errors sed -i -e '/-Werror/d' CMakeLists.txt mkdir build pushd build export LD_LIBRARY_PATH="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/%{_lib}/" %cmake .. -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DUSE_INT64_TENSOR_SIZE=OFF \ -DUSE_OPENCV=ON \ -DUSE_OPENMP=ON \ -DUSE_BLAS="Open" \ -DUSE_ONEDNN=ON \ %ifarch x86_64 %{ix86} -DUSE_SSE=ON \ -DUSE_F16C=ON \ -DCMAKE_C_FLAGS="-mf16c" \ %else -DUSE_SSE=OFF \ -DUSE_F16C=OFF \ %endif %if %{have_cuda} -DUSE_CUDA=ON \ -DUSE_NCCL=ON \ -DUSE_CUDNN=ON \ -DUSE_FATBIN_COMPRESSION=ON \ -DCUDA_PROPAGATE_HOST_FLAGS=OFF \ -DMXNET_CUDA_ARCH=%{gpu_target_vers} \ -DCMAKE_CUDA_FLAGS="--compiler-options -fPIC -Wno-deprecated-gpu-targets" \ %if 0%{?fedora} -DCMAKE_CUDA_HOST_COMPILER="%{_bindir}/cuda-gcc" \ %endif -DCMAKE_CUDA_COMPILER="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/bin/nvcc" \ %else -DUSE_CUDA=OFF \ %endif -DUSE_JEMALLOC=OFF \ -DUSE_GPERFTOOLS=OFF \ -DUSE_LIBJPEG_TURBO=OFF \ -DBUILD_CPP_EXAMPLES=OFF \ -DGTEST_ROOT="%{_includedir}/gtest" make %{?_smp_mflags} popd pushd python %{__python3} setup.py build popd %install rm -rf %{buildroot} export LD_LIBRARY_PATH="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/%{_lib}/" pushd python %{__python3} setup.py install --root %{buildroot} popd # includes for d in `find ./include/ -type d`; do mkdir -p %{buildroot}%{_includedir}/$d done for i in `find ./include/ -type f`; do install -p -m 0644 $i %{buildroot}%{_includedir}/$i done # python mkdir -p %{buildroot}/%{_libdir} cp -rl %{buildroot}/usr/lib/* -t %{buildroot}/%{_libdir}/ rm -rf %{buildroot}/usr/lib # libraries cp -rl %{buildroot}/usr/%{name}/* -t %{buildroot}/%{_libdir}/ rm -rf %{buildroot}/usr/%{name} # python3 for f in `find %{buildroot} -name '*.py'`; do sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/python3|' $f done # fix requirement sed -i -e 's|0.9.0|0.15.0|g' %{buildroot}/%{python3_sitearch}/*.egg-info/requires.txt # fix symlink ln -sf %{_libdir}/libmxnet.so %{buildroot}/%{python3_sitearch}/mxnet/libmxnet.so %files %doc README.md CONTRIBUTORS.md %license LICENSE %{_libdir}/lib*.so* %files devel %{_includedir}/* %{_datadir}/* %files python3 %defattr(-,root,root,-) %{python3_sitearch}/* %changelog * Mon Mar 18 2019 Balint Cristian - github build