Doubts for cross-compiling mxnet for jetson nano and TX2

Hi MXNET community

I am trying to cross compile mxnet from sourec for jetson nano and TX2. I have followed the steps listed on http://mxnet.incubator.apache.org/versions/master/install/install-jetson.html But i had to make some changes to teh steps in order to compile. The changes are as follows:

  1. Cloning the v1.4.x branch instead of origin as the steps indicate installing numpy 1.15.2 which later contradicts with version required during installing python bindings
  2. I think thers’s a typo in the step that suggests changing make file, “-gencode arch=compute-63, code=sm_62”. I kept getting errors regarding compute-63 arch as its not supported. I was able to get rid of this error by changing “-gencode arch=compute-63, code=sm_62” to " -gencode arch=compute_53,code=sm_53 -gencode arch=compute_62,code=sm_62"

I was able to cross compile but couldn’t get python3 script involving mxnet to run. It gives an error related to not able to find libmxnet.so (OSError: path/to/libmxnet.so No such file or directory)

I did clone the same repo, install all the dependencies, updated PATH and LD_LIBRARY variables on jetson nano.

Please anyone who experienced similar issues or have cross compiled please leave suggestion.

Thanks
AJ

PS: Just to confirm distributed training is not supported in pre-built python wheels ???

Hi AJ,

You have to add the libmxnet.so file yourself to the wheel file. In the GIT repo of mxnet, there is a helper script with a function to do this. Look at this file /ci/docker/runtime_functions.sh, function is called build_wheel():

If you follow these steps in the console, you’re wheel file will have the missing library file.

To be complete, here are the steps below:

    export MXNET_LIBRARY_PATH=${BUILD_DIR}/libmxnet.so

    cd ${PYTHON_DIR}
    python setup.py bdist_wheel --universal

    # repackage

    # Fix pathing issues in the wheel.  We need to move libmxnet.so from the data folder to the
    # mxnet folder, then repackage the wheel.
    WHEEL=`readlink -f dist/*.whl`
    TMPDIR=`mktemp -d`
    unzip -d ${TMPDIR} ${WHEEL}
    rm ${WHEEL}
    cd ${TMPDIR}
    mv *.data/data/mxnet/libmxnet.so mxnet
    zip -r ${WHEEL} .
    cp ${WHEEL} ${BUILD_DIR}
    rm -rf ${TMPDIR}

Blake