Opencv and openblas .so files in distributed tranining mode

The distributed training mode would require the shared files from opencv and openblas to be installed on all nodes and be available using the LD_LIBRARY_PATH

This is something I am trying to avoid, because it doesn’t look like a good solution to me. What would you guys suggest alternatively?

Would distributing the .so files using the --files option in spark submit and loading at runtime from the code be a good idea.
What do you guys suggest to be able to run the distributed version across different nodes with yarn.

One solution would be to statically link these libraries in the MXNet library.
The blas library (intelmkl) for example comes with the pip installation of MXNet.
OpenCV comes statically link with as well.
Are you building from source?

ldd =>  (0x00007ffe42173000) => /usr/local/cuda/lib64/ (0x00007fc781a0b000) => /usr/local/cuda/lib64/ (0x00007fc77df96000) => /usr/local/cuda/lib64/ (0x00007fc77a058000) => /usr/local/cuda/lib64/ (0x00007fc772bf2000) => /home/ubuntu/anaconda3/lib/python3.6/site-packages/mxnet/./ (0x00007fc76af8f000) => /home/ubuntu/anaconda3/lib/python3.6/site-packages/mxnet/./ (0x00007fc76abb3000) => /lib/x86_64-linux-gnu/ (0x00007fc76a9ab000) => /home/ubuntu/anaconda3/lib/python3.6/site-packages/mxnet/./ (0x00007fc769f87000) => /lib/x86_64-linux-gnu/ (0x00007fc769d83000) => /home/ubuntu/anaconda3/lib/python3.6/site-packages/mxnet/./ (0x00007fc769a5c000) => /usr/local/cuda/lib64/ (0x00007fc764402000) => /usr/lib/x86_64-linux-gnu/ (0x00007fc764080000) => /lib/x86_64-linux-gnu/ (0x00007fc763d77000) => /lib/x86_64-linux-gnu/ (0x00007fc763b61000) => /lib/x86_64-linux-gnu/ (0x00007fc763944000) => /lib/x86_64-linux-gnu/ (0x00007fc76357a000)
	/lib64/ (0x00007fc7acdc4000) => /home/ubuntu/anaconda3/lib/python3.6/site-packages/mxnet/./ (0x00007fc76333a000)

Yes I am building from source.
I’ve used the following flags to try to build the static library

CC='gcc -static-libstdc++'
ADD_LDFLAGS+= $(pkg-config --libs --static opencv) $(pkg-config --libs --static openblas)
ADD_CFLAGS+= -Wall $(pkg-config --cflags opencv) $(pkg-config --cflags openblas) 

However I don’t think the output file is statically linked.
Here’s the output of the ldd command on

ldd =>  (0x00007ffcf9fbd000) => /usr/local/lib/ (0x00007f0e8db1d000) => /lib64/ (0x00007f0e8d90d000) => /usr/local/lib/ (0x00007f0e8d631000) => /usr/local/lib/ (0x00007f0e8d33f000) => /usr/local/lib/ (0x00007f0e8ce7f000) => /usr/local/lib/ (0x00007f0e8cbd0000) => /usr/local/lib/ (0x00007f0e8c959000) => /usr/local/lib/ (0x00007f0e8c4fe000) => /usr/local/lib/ (0x00007f0e8c00f000) => /usr/local/lib/ (0x00007f0e8bced000) => /usr/local/lib/ (0x00007f0e8ba66000) => /usr/local/lib/ (0x00007f0e8b829000) => /usr/local/lib/ (0x00007f0e8b5a6000) => /usr/local/lib/ (0x00007f0e8b1c2000) => /usr/local/lib/ (0x00007f0e8afa3000) => /usr/local/lib/ (0x00007f0e8ad39000) => /usr/local/lib/ (0x00007f0e8aafb000) => /usr/local/lib/ (0x00007f0e8a89e000) => /usr/local/lib/ (0x00007f0e8a65f000) => /lib64/ (0x00007f0e8a441000) => /lib64/ (0x00007f0e8a1bd000) => /lib64/ (0x00007f0e89fb9000) => /usr/local/lib64/ (0x00007f0e89caf000) => /usr/local/lib64/ (0x00007f0e89aa1000) => /usr/local/lib64/ (0x00007f0e8988b000) => /lib64/ (0x00007f0e894f6000)
    /lib64/ (0x000055f2f4112000)

Here’s the Dockerfile to show you the exact set up steps that I’m doing.

What do I need to change to get the statically linked library?

@adwivedi Have a look at this script that shows how to build the static library that we use to release on pip