diff --git a/recipe/bld-libmxnet.bat b/recipe/bld-libmxnet.bat index fb9e79c..2b205a2 100644 --- a/recipe/bld-libmxnet.bat +++ b/recipe/bld-libmxnet.bat @@ -43,7 +43,9 @@ cmake .. ${CMAKE_ARGS} ^ -DBUILD_CPP_EXAMPLES=%BUILD_CPP_PACKAGE% ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ - -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% + -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ + -DUSE_CXX14_IF_AVAILABLE=ON + if errorlevel 1 exit 1 diff --git a/recipe/build-libmxnet.sh b/recipe/build-libmxnet.sh index 9e8f8e0..142bf65 100755 --- a/recipe/build-libmxnet.sh +++ b/recipe/build-libmxnet.sh @@ -41,12 +41,16 @@ case "${target_platform}" in ;; osx-64) anaconda_build_opts+=(-DUSE_OPENCV=ON) + anaconda_build_opts+=(-DCMAKE_MACOSX_RPATH=1) AR=${BUILD_PREFIX}/bin/${AR} RANLIB=${BUILD_PREFIX}/bin/${RANLIB} + # See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk + CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" ;; osx-arm64) anaconda_build_opts+=(-DUSE_OPENCV=ON) anaconda_build_opts+=(-DUSE_SSE=OFF) + anaconda_build_opts+=(-DCMAKE_MACOSX_RPATH=1) AR=${BUILD_PREFIX}/bin/${AR} RANLIB=${BUILD_PREFIX}/bin/${RANLIB} ;; @@ -81,16 +85,20 @@ fi # Isolate the build. # rm -rf Build-${PKG_NAME} # We could clean it up... But there really is no need. +cd ${SRC_DIR} mkdir -p Build-${PKG_NAME} cd Build-${PKG_NAME} || exit 1 +# Generate the build files. +echo "Generating the build files..." cmake .. ${CMAKE_ARGS} \ -GNinja \ -LAH \ -DCMAKE_BUILD_TYPE="Release" \ -DCMAKE_INSTALL_PREFIX=${PREFIX} \ -DCMAKE_INSTALL_LIBDIR="lib" \ + -DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \ -DCMAKE_AR=${AR} \ -DCMAKE_LINKER=${LD} \ -DCMAKE_NM=${NM} \ @@ -110,14 +118,23 @@ cmake .. ${CMAKE_ARGS} \ -DUSE_JEMALLOC="$JEMALLOC_OPT" \ -DBUILD_CPP_EXAMPLES=OFF \ -DBUILD_TESTING=OFF \ + -DUSE_CXX14_IF_AVAILABLE=ON \ \ "${_blas_opts[@]}" \ "${_gpu_opts[@]}" \ "${anaconda_build_opts[@]}" \ -ninja -j${CPU_COUNT} +# Build. +echo "Building..." +echo +echo "=== BUILD ${PKG_NAME} ===" +ninja -v -j${CPU_COUNT} +echo +echo "=== INSTALL ${PKG_NAME} ===" ninja install +echo +echo "=== COMPLETE ${PKG_NAME} ===" # install misses this file if [[ $target_platform != linux-s390x ]]; then @@ -131,3 +148,8 @@ rm -f ${PREFIX}/lib/libmxnet.a # remove cmake cruft rm -rf ${PREFIX}/lib/cmake/dmlc + + +# Error free exit! +echo "Error free exit!" +exit 0 diff --git a/recipe/build-py-mxnet.sh b/recipe/build-py-mxnet.sh index f4b7a27..a175055 100644 --- a/recipe/build-py-mxnet.sh +++ b/recipe/build-py-mxnet.sh @@ -1,4 +1,7 @@ -set -x +#!/usr/bin/env bash +echo "Building ${PKG_NAME}." + +set -ex ENABLE_CYTHON= if [[ $(uname) == Darwin ]]; then @@ -21,3 +24,8 @@ else find ${PREFIX} | grep libmxnet.so | grep -v $PREFIX/lib/libmxnet.so | xargs rm -f ln -sf ../../../libmxnet.so $SP_DIR/mxnet/libmxnet.so fi + + +# Error free exit! +echo "Error free exit!" +exit 0 diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index b37c5c9..0f95b41 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -28,3 +28,8 @@ c_compiler_version: # [ppc64le] - 8 # [ppc64le] cxx_compiler_version: # [ppc64le] - 8 # [ppc64le] + + +# Default osx-64 sdk does not support c++14 adequately. +CONDA_BUILD_SYSROOT: # [osx and x86_64] + - /opt/MacOSX10.12.sdk # [osx and x86_64] diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 2a04aa4..7986b2d 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,24 +1,112 @@ -{% set mxnet_version="1.5.1" %} -{% set hash_value="b182c301eb0232aa84440b5b632b4d357a2d6d711f7e7b56133504283d0d19e7" %} +{% set mxnet_version="1.9.1" %} +{% set hash_value="cef85932e2b3caead235008473d29512b99581c07da3d10703ff5b6c1fb5bd50" %} {% set build_number="0" %} +{% set dlpack_git_hash = "3efc489b55385936531a06ff83425b719387ec63" %} +{% set dlpack_sha_hash = "b59586ce69bcf3efdbf3cf4803fadfeaae4948044e2b8d89cf912194cf28f233" %} + +{% set dmlccore_git_hash = "5df8305fe699d3b503d10c60a231ab0223142407" %} +{% set dmlccore_sha_hash = "a8046f752f36005564d2924b4b6f73e1aea3cce7ff10f9e19d99ad6a22a045b2" %} + +{% set googletest_git_hash = "eb9225ce361affe561592e0912320b9db84985d0" %} +{% set googletest_sha_hash = "a4cb4b0c3ebb191b798594aca674ad47eee255dcb4c26885cf7f49777703484f" %} + +{% set intgemm_git_hash = "8f28282c3bd854922da638024d2659be52e892e9" %} +{% set intgemm_sha_hash = "bc8bd8015613a13747eb769876385ec53e8c1ea7ae3f8414521dc53b8fcdfc65" %} + +{% set nvidia_cub_git_hash = "0158fa19f28619886232defd412433974af89611" %} +{% set nvidia_cub_sha_hash = "43424c4c17a997d1d730c89ec14688671245de7941e02b388d7d3df6ea53777a" %} + +#{% set onednn_git_hash = "58be3660fb57c4c4a3d306730e849237d1271572" %} +#{% set onednn_sha_hash = "0d170c30ea0a35fbe48008e0e7e729d0993720c14f320ce8e73a891ae176eec4" %} + +{% set onnxtensorrt_git_hash = "2eb74d933f89e1590fdbfc64971a36e5f72df720" %} +{% set onnxtensorrt_sha_hash = "df99819727445c247fb5c21c2fd825ded3269376867457ae84fa6d6f1c0ae331" %} + +{% set pslite_git_hash = "34fd45cae457d59850fdcb2066467778d0673f21" %} +{% set pslite_sha_hash = "ec5d5baab8bbf0c3983ad5f18d7f963f15ae7cd4d154ec204b03c1dceccf209b" %} + +{% set tvm_git_hash = "9bd2c7b44208ed992061f8c2688e1137357f1db1" %} +{% set tvm_sha_hash = "68d0c2f14bd00db2dc90fc1a2ed389a3d04d9176c5f96133dfa44b81c28cdd89" %} + + package: name: mxnet-suite version: {{ mxnet_version }} source: - url: https://github.com/apache/incubator-mxnet/releases/download/{{ mxnet_version }}/apache-mxnet-src-{{ mxnet_version }}-incubating.tar.gz - sha256: {{ hash_value }} - patches: - - patches/0001-Relax-constraints-on-requests-make-graphviz-optional.patch - - patches/0001-use-external-mklml-and-mkldnn-libraries.patch # [mxnet_blas_impl == 'mkl'] - - patches/0002-conda-unbundle-libmxnet-DSO.patch - - patches/0002-cpu-fix.patch - -# Right now there is no valid win-64 configuration (no mkl). So skip it. We are mxnet_blas_impl as a workaround for conda. -build: # [mxnet_blas_impl == 'invalid'] - skip: true # [mxnet_blas_impl == 'invalid'] + - url: https://github.com/apache/incubator-mxnet/archive/refs/tags/{{ mxnet_version }}.tar.gz + sha256: {{ hash_value }} + patches: + - patches/0001-cpp-std-14.patch + - patches/0001-make-graphviz-optional.patch + - patches/0002-conda-unbundle-libmxnet-DSO.patch +# - patches/0003-osx-cmake-rpath-fix.patch # prints some cmake values and exits. + # - patches/0002-cpu-fix.patch + + - url: https://github.com/dmlc/dlpack/archive/{{ dlpack_git_hash }}.tar.gz + fn: dlpack_{{ dlpack_git_hash }}.tar.gz + sha256: {{ dlpack_sha_hash }} + folder: 3rdparty/dlpack + patches: + - patches/0011-cpp-std-14.patch + + - url: https://github.com/dmlc/dmlc-core/archive/{{ dmlccore_git_hash }}.tar.gz + fn: dmlc-core_{{ dmlccore_git_hash }}.tar.gz + sha256: {{ dmlccore_sha_hash }} + folder: 3rdparty/dmlc-core + + - url: https://github.com/google/googletest/archive/{{ googletest_git_hash }}.tar.gz + fn: googletest_{{ googletest_git_hash }}.tar.gz + sha256: {{ googletest_sha_hash }} + folder: 3rdparty/googletest +# patches: +# - patches/0031-cpp-std-14.patch + + - url: https://github.com/kpu/intgemm/archive/{{ intgemm_git_hash }}.tar.gz + fn: intgemm_{{ intgemm_git_hash }}.tar.gz + sha256: {{ intgemm_sha_hash }} + folder: 3rdparty/intgemm + patches: + - patches/0041-cpp-std-14.patch + + - url: https://github.com/NVlabs/cub/archive/{{ nvidia_cub_git_hash }}.tar.gz + fn: nvidia_cub_{{ nvidia_cub_git_hash }}.tar.gz + sha256: {{ nvidia_cub_sha_hash }} + folder: 3rdparty/nvidia_cub +# patches: +# - patches/0051-cpp-std-14.patch + +# - url: https://github.com/oneapi-src/oneDNN/archive/{{ onednn_git_hash }}.tar.gz +# fn: onednn_{{ onednn_git_hash }}.tar.gz +# sha256: {{ onednn_sha_hash }} +# folder: 3rdparty/onednn + + - url: https://github.com/onnx/onnx-tensorrt/archive/{{ onnxtensorrt_git_hash }}.tar.gz + fn: onnx-tensorrt_{{ onnxtensorrt_git_hash }}.tar.gz + sha256: {{ onnxtensorrt_sha_hash }} + folder: 3rdparty/onnx-tensorrt + + - url: https://github.com/dmlc/ps-lite/archive/{{ pslite_git_hash }}.tar.gz + fn: ps-lite_{{ pslite_git_hash }}.tar.gz + sha256: {{ pslite_sha_hash }} + folder: 3rdparty/ps-lite +# patches: +# - patches/0081-cpp-std-14.patch + + - url: https://github.com/apache/incubator-tvm/archive/{{ tvm_git_hash }}.tar.gz + fn: tvm_{{ tvm_git_hash }}.tar.gz + sha256: {{ tvm_sha_hash }} + folder: 3rdparty/tvm +# patches: +# - patches/0091-cpp-std-14.patch + + +# THIS IS NOT FOR MAIN!!!!! +build: # [not osx] + skip: True # [not osx] <----- do not allow into main! + requirements: build: @@ -53,6 +141,8 @@ outputs: missing_dso_whitelist: # [linux] - libcuda.so.1 # [linux] - '$RPATH/ld64.so.1' # [s390x] This is missing from the activation script. + run_exports: # [osx] + - {{ pin_subpackage('libmxnet', exact=True) }} # [osx] requirements: build: @@ -61,7 +151,8 @@ outputs: - pkg-config # [not win] - ninja-base - cmake - - python + - python # [not osx] + - python 3.10 # [osx] host: # - jemalloc # [linux] - mkl-dnn # [unix and (mxnet_blas_impl == 'mkl')] @@ -81,6 +172,7 @@ outputs: - {{ pin_compatible('intel-openmp') }} # [mxnet_blas_impl == 'mkl'] - _openmp_mutex # [linux] - opencv >=4.6 # [not s390x] +# - {{ pin_subpackage('libmxnet', exact=True) }} <-------------- This did not help. test: commands: diff --git a/recipe/patches/0001-cpp-std-14.patch b/recipe/patches/0001-cpp-std-14.patch new file mode 100644 index 0000000..ce26199 --- /dev/null +++ b/recipe/patches/0001-cpp-std-14.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7b5a12610..e00d318fe 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,7 +7,7 @@ if(CMAKE_CROSSCOMPILING) + endif() + + project(mxnet C CXX) +-set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS ON) + +@@ -791,7 +791,7 @@ elseif(MSVC) + target_link_libraries(mxnet PUBLIC mshadow) + if(MXNET_FORCE_SHARED_CRT) + target_compile_options( +- mxnet ++ mxnet + PRIVATE "$<$,$>:-Xcompiler=-MDd -Gy /bigobj>") + target_compile_options( + mxnet diff --git a/recipe/patches/0001-make-graphviz-optional.patch b/recipe/patches/0001-make-graphviz-optional.patch new file mode 100644 index 0000000..977321a --- /dev/null +++ b/recipe/patches/0001-make-graphviz-optional.patch @@ -0,0 +1,14 @@ +diff --git a/python/setup.py b/python/setup.py +index dcd84cef1..bf2b7d58a 100644 +--- a/python/setup.py ++++ b/python/setup.py +@@ -30,7 +30,8 @@ if "--inplace" in sys.argv: + else: + from setuptools import setup + from setuptools.extension import Extension +- kwargs = {'install_requires': ['numpy>1.16.0,<2.0.0', 'requests>=2.20.0,<3', 'graphviz<0.9.0,>=0.8.1'], 'zip_safe': False} ++ # Make graphviz optional: ++ kwargs = {'install_requires': ['numpy>1.16.0,<2.0.0', 'requests>=2.20.0,<3'], 'zip_safe': False, 'extras_require': {'graphviz': ['graphviz<0.9.0,>=0.8.1']}} + + with_cython = False + if '--with-cython' in sys.argv: diff --git a/recipe/patches/0003-osx-cmake-rpath-fix.patch b/recipe/patches/0003-osx-cmake-rpath-fix.patch new file mode 100644 index 0000000..299ee04 --- /dev/null +++ b/recipe/patches/0003-osx-cmake-rpath-fix.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7b5a12610..50a3c2063 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,9 @@ + cmake_minimum_required(VERSION 3.13) + ++ ++message( "=========================\n\n CMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH} \n\n CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \n\n CMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} \n\n=================================" ) ++ ++ + # workaround to store CMAKE_CROSSCOMPILING because is getting reset by the project command + if(CMAKE_CROSSCOMPILING) + set(__CMAKE_CROSSCOMPILING ${CMAKE_CROSSCOMPILING}) +@@ -1023,3 +1027,6 @@ if(BUILD_CYTHON_MODULES) + message(FATAL_ERROR "No python interpreter found to build cython modules") + endif() + endif() ++ ++ ++message(FATAL_ERROR "=========================\n\n CMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH} \n\n CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \n\n CMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} \n\n=================================" ) diff --git a/recipe/patches/0011-cpp-std-14.patch b/recipe/patches/0011-cpp-std-14.patch new file mode 100644 index 0000000..908554d --- /dev/null +++ b/recipe/patches/0011-cpp-std-14.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ed6e069..c147535 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -37,9 +37,9 @@ endif(NOT CMAKE_BUILD_TYPE) + # Note: not working on CMake 2.8. We assume that user has + # a compiler with C++11 support. + +-set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED ON) +-message(STATUS "C++11 support has been enabled by default.") ++message(STATUS "C++14 support has been enabled by default.") + + option(BUILD_DOCS "Set to ON to build documentation" OFF) + option(BUILD_MOCK "Build mock executable" ON) diff --git a/recipe/patches/0041-cpp-std-14.patch b/recipe/patches/0041-cpp-std-14.patch new file mode 100644 index 0000000..2003dad --- /dev/null +++ b/recipe/patches/0041-cpp-std-14.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d1885f5..fb497ad 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -8,7 +8,7 @@ if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) + endif() + +-set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD 14) + + if(MSVC) + add_compile_options(/W4 /WX)