Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{math}[foss/2022a] MXNet 1.9.1 w/ Python 3.10.4 #18251

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions easybuild/easyconfigs/m/MXNet/MXNet-1.9.1-foss-2022a.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name = 'MXNet'
version = '1.9.1'

homepage = 'https://mxnet.io/'
description = """Flexible and Efficient Library for Deep Learning"""

toolchain = {'name': 'foss', 'version': '2022a'}
toolchainopts = {'cstd': 'c++14', 'opt': True, 'pic': True, 'openmp': True, 'extra_cflags': '-lflexiblas'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be still need extra manual cflags here despite including the patch to their cmakelists to support flexiblas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, won't build without it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then i wonder what good

list(APPEND mshadow_LINKER_LIBS ${BLAS_LIBRARIES})

does in the patch. If anything, I think the easyblock should fix this, or the patch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, this doesn't have to be in patch, removing...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, i don't think there is any advantage to modifying the patch. i'm mostly curious as to where it fails

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Micket I think it's working now as is, but if you want, we could move the -lflexiblas option from extra_cflags in easyconfig to the easyblock somehow, however, I am not sure how to modify toolchainopts in easyblock...if you think it might be better that way, maybe drop me a hint about how to do that?


# MXNet pulls in a bunch of submodules with specific commits
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment to mention source for these commit IDs: https://github.com/apache/mxnet/tree/1.9.1/3rdparty

source_urls = [
'https://github.com/apache/mxnet/archive',
'https://github.com/dmlc/ps-lite/archive/',
'https://github.com/apache/tvm/archive/',
'https://github.com/dmlc/dmlc-core/archive/',
'https://github.com/dmlc/dlpack/archive/',
'https://github.com/google/googletest/archive/',
'https://github.com/kpu/intgemm/archive/',
'https://github.com/NVlabs/cub/archive/',
'https://github.com/onnx/onnx-tensorrt/archive/',
'https://github.com/oneapi-src/oneDNN/archive/',
]
sources = [
'v%(version)s.tar.gz', # MXNet
'34fd45cae457d59850fdcb2066467778d0673f21.tar.gz', # ps-lite
boegel marked this conversation as resolved.
Show resolved Hide resolved
'efdac9439506d1de5eec91ecc795982c78e41909.tar.gz', # tvm
'5df8305fe699d3b503d10c60a231ab0223142407.tar.gz', # dmlc-core
'3efc489b55385936531a06ff83425b719387ec63.tar.gz', # dlpack
'eb9225ce361affe561592e0912320b9db84985d0.tar.gz', # googletest
'8f28282c3bd854922da638024d2659be52e892e9.tar.gz', # intgemm
'0158fa19f28619886232defd412433974af89611.tar.gz', # cub
'2eb74d933f89e1590fdbfc64971a36e5f72df720.tar.gz', # onnx-tensorrt
'5818c40f07bdb6307f9bc64e929836fe036da644.tar.gz', # oneDNN
]
patches = [
'mxnet-1.9.1-add_flexiblas.patch',
]
checksums = [
{'v1.9.1.tar.gz': '9927f986b2c2c8315f2ba675e050ce1f4e24e84c4692e5f0a96248876784a8a7'},
{'34fd45cae457d59850fdcb2066467778d0673f21.tar.gz':
'ec5d5baab8bbf0c3983ad5f18d7f963f15ae7cd4d154ec204b03c1dceccf209b'},
{'efdac9439506d1de5eec91ecc795982c78e41909.tar.gz':
'656c38d66baeab885b0212602148bb55ad3cf7d22f52ded8ece53f88e103a2f5'},
{'5df8305fe699d3b503d10c60a231ab0223142407.tar.gz':
'a8046f752f36005564d2924b4b6f73e1aea3cce7ff10f9e19d99ad6a22a045b2'},
{'3efc489b55385936531a06ff83425b719387ec63.tar.gz':
'b59586ce69bcf3efdbf3cf4803fadfeaae4948044e2b8d89cf912194cf28f233'},
{'eb9225ce361affe561592e0912320b9db84985d0.tar.gz':
'a4cb4b0c3ebb191b798594aca674ad47eee255dcb4c26885cf7f49777703484f'},
{'8f28282c3bd854922da638024d2659be52e892e9.tar.gz':
'bc8bd8015613a13747eb769876385ec53e8c1ea7ae3f8414521dc53b8fcdfc65'},
{'0158fa19f28619886232defd412433974af89611.tar.gz':
'43424c4c17a997d1d730c89ec14688671245de7941e02b388d7d3df6ea53777a'},
{'2eb74d933f89e1590fdbfc64971a36e5f72df720.tar.gz':
'df99819727445c247fb5c21c2fd825ded3269376867457ae84fa6d6f1c0ae331'},
{'5818c40f07bdb6307f9bc64e929836fe036da644.tar.gz':
'aeb8e65bb13d1a3171673ab749d41e8c3a6538371d922a7fa881afef277128ba'},
{'mxnet-1.9.1-add_flexiblas.patch': '92b3a9b9ffd87c3be30efe1b400b4d152ba3fe4e105970bc6c63906dfcb59084'},
]

builddependencies = [
('CMake', '3.23.1'),
]

dependencies = [
('Python', '3.10.4'),
('graphviz-python', '0.20.1'),
('OpenCV', '4.6.0', '-contrib'),
]

moduleclass = 'math'
33 changes: 33 additions & 0 deletions easybuild/easyconfigs/m/MXNet/mxnet-1.9.1-add_flexiblas.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
source: https://github.com/apache/mxnet/pull/21093
diff -ruN mxnet-1.9.1_orig/cmake/ChooseBlas.cmake mxnet-1.9.1/cmake/ChooseBlas.cmake
--- mxnet-1.9.1_orig/cmake/ChooseBlas.cmake 2022-04-22 00:45:57.000000000 +0200
+++ mxnet-1.9.1/cmake/ChooseBlas.cmake 2023-07-10 12:13:14.448174000 +0200
@@ -16,10 +16,11 @@
# under the License.

set(BLAS "Open" CACHE STRING "Selected BLAS library")
-set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL")
+set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL;FlexiBLAS")

if(DEFINED USE_BLAS)
set(BLAS "${USE_BLAS}")
+ message(STATUS "BLAS is set to ${USE_BLAS}")
else()
if(USE_MKL_IF_AVAILABLE)
if(NOT MKL_FOUND)
@@ -31,7 +32,14 @@
endif()
endif()

-if(BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas")
+if(BLAS STREQUAL "FlexiBLAS" OR BLAS STREQUAL "flexiblas")
+ set(BLA_VENDOR FlexiBLAS)
+ find_package(BLAS REQUIRED)
+ include_directories(SYSTEM ${BLAS_INCLUDE_DIR})
+ add_definitions(-DMSHADOW_USE_CBLAS=1)
+ add_definitions(-DMSHADOW_USE_MKL=0)
+ add_definitions(-DMXNET_USE_LAPACK=1)
+elseif(BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas")
find_package(Atlas REQUIRED)
include_directories(SYSTEM ${Atlas_INCLUDE_DIR})
list(APPEND mshadow_LINKER_LIBS ${Atlas_LIBRARIES})
34 changes: 34 additions & 0 deletions easybuild/easyconfigs/m/MXNet/mxnet-fix_blas.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
source: https://github.com/apache/mxnet/pull/21093
diff -ruN mxnet-1.9.1_orig/cmake/ChooseBlas.cmake mxnet-1.9.1/cmake/ChooseBlas.cmake
--- mxnet-1.9.1_orig/cmake/ChooseBlas.cmake 2022-04-22 00:45:57.000000000 +0200
+++ mxnet-1.9.1/cmake/ChooseBlas.cmake 2023-06-21 13:23:41.986229000 +0200
@@ -16,10 +16,11 @@
# under the License.

set(BLAS "Open" CACHE STRING "Selected BLAS library")
-set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL")
+set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL;FlexiBLAS")

if(DEFINED USE_BLAS)
set(BLAS "${USE_BLAS}")
+ message(STATUS "BLAS is set to ${USE_BLAS}")
else()
if(USE_MKL_IF_AVAILABLE)
if(NOT MKL_FOUND)
@@ -31,7 +32,15 @@
endif()
endif()

-if(BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas")
+if(BLAS STREQUAL "FlexiBLAS" OR BLAS STREQUAL "flexiblas")
+ set(BLA_VENDOR FlexiBLAS)
+ find_package(BLAS REQUIRED)
+ include_directories(SYSTEM ${BLAS_INCLUDE_DIR})
+ list(APPEND mshadow_LINKER_LIBS ${BLAS_LIBRARIES})
+ add_definitions(-DMSHADOW_USE_CBLAS=1)
+ add_definitions(-DMSHADOW_USE_MKL=0)
+ add_definitions(-DMXNET_USE_LAPACK=1)
+elseif(BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas")
find_package(Atlas REQUIRED)
include_directories(SYSTEM ${Atlas_INCLUDE_DIR})
list(APPEND mshadow_LINKER_LIBS ${Atlas_LIBRARIES})