Zha0q1 opened a new pull request #18873: URL: https://github.com/apache/incubator-mxnet/pull/18873
This is a very early work to add support for OpenBLAS 64 where symbols have `64_` suffixes. OpenBLAS 64 is built from source using this script: ``` #!/usr/bin/env bash # This script builds the static library of openblas that can be used as dependency of mxnet. set -ex rm -rf ~/deps mkdir ~/deps DEPS_PATH=~/deps OPENBLAS_VERSION=develop if [[ (! -e $DEPS_PATH/lib/libopenblas.a) || (! -e $DEPS_PATH/lib/libopenblas.so) ]]; then # download and build openblas >&2 echo "Building openblas..." wget \ https://github.com/xianyi/OpenBLAS/archive/${OPENBLAS_VERSION}.zip \ -O ${DEPS_PATH}/openblas.zip unzip -q $DEPS_PATH/openblas.zip -d $DEPS_PATH pushd . cd $DEPS_PATH/OpenBLAS-${OPENBLAS_VERSION} echo -e "DYNAMIC_ARCH=1\nDYNAMIC_OLDER=1\nUSE_OPENMP=1\nINTERFACE64=1\nBINARY=64\nNO_SHARED=0\nNO_LAPACK=0\nSYMBOLSUFFIX=64_" >> Makefile.rule CXX="g++ -fPIC" CC="gcc -fPIC" make -j # make -j PREFIX=$DEPS_PATH install sudo make -j PREFIX=/usr/local install popd fi ``` This PR currently only works with `USE_LAPACK=0`. This build is able to run the following script with no problem. ``` def run_test(): import mxnet as mx from mxnet import nd # large tensor, only works on int 64 BLAS A=mx.nd.ones(shape=(1, 2**31)) nd.linalg.syrk(A) nd.waitall() if __name__ == '__main__': run_test() ``` Using `ldd` command reveals `libmxnet.so` depends on `libopenblas64_.so.0` which is our OpenBLAS 64 build. ``` ubuntu@ip-172-31-6-47:~/blasfix/build$ ldd libmxnet.so linux-vdso.so.1 (0x00007ffd12965000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9f9fe84000) libopenblas64_.so.0 => /usr/local/lib/libopenblas64_.so.0 (0x00007f9f9d7ea000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9f9d5e2000) libomp.so => /home/ubuntu/blasfix/build/3rdparty/openmp/runtime/src/libomp.so (0x00007f9f9d2fc000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9f9d0dd000) libopencv_imgcodecs.so.4.2 => /usr/local/lib/libopencv_imgcodecs.so.4.2 (0x00007f9f9c6f0000) libopencv_imgproc.so.4.2 => /usr/local/lib/libopencv_imgproc.so.4.2 (0x00007f9f9adec000) libopencv_core.so.4.2 => /usr/local/lib/libopencv_core.so.4.2 (0x00007f9f99b07000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9f9977e000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9f993e0000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9f991c8000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9f98dd7000) /lib64/ld-linux-x86-64.so.2 (0x00007f9fa83e7000) libgfortran.so.4 => /usr/lib/x86_64-linux-gnu/libgfortran.so.4 (0x00007f9f989f8000) libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f9f987c9000) libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f9f98561000) libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f9f9832f000) libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f9f980b8000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f9f97e9b000) libopenblas.so.0 => /usr/local/lib/libopenblas.so.0 (0x00007f9f9580a000) libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f9f955ca000) liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f9f953a4000) libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f9f95196000) ``` Checking the symbols: ``` ubuntu@ip-172-31-6-47:~/blasfix$ nm -D build/libmxnet.so | grep blas U cblas_ddot64_ U cblas_dgemm64_ U cblas_dger64_ U cblas_dsyrk64_ U cblas_dtrmm64_ U cblas_dtrsm64_ U cblas_sdot64_ U cblas_sgemm64_ U cblas_sger64_ U cblas_ssyrk64_ U cblas_strmm64_ U cblas_strsm64_ ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
