<commit_before>#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
# build and install are separated so changes to build don't invalidate
# the whole docker cache for the image

set -ex

clean_repo() {
    set -ex
    git clean -xfd
    git submodule foreach --recursive git clean -xfd
    git reset --hard
    git submodule foreach --recursive git reset --hard
    git submodule update --init --recursive
}


# Build commands: Every platform in docker/Dockerfile.build.<platform> should have a corresponding
# function here with the same suffix:

build_jetson() {
    set -ex
    pushd .

    #cd /work/mxnet
    #make -j$(nproc) USE_OPENCV=0 USE_BLAS=openblas USE_SSE=0 USE_CUDA=1 USE_CUDNN=1 ENABLE_CUDA_RTC=0 USE_NCCL=0 USE_CUDA_PATH=/usr/local/cuda/
    cd /work/build
    cmake\
        -DUSE_CUDA=OFF\
        -DUSE_OPENCV=OFF\
        -DUSE_OPENMP=ON\
        -DUSE_SIGNAL_HANDLER=ON\
        -DUSE_MKL_IF_AVAILABLE=OFF\
        -DUSE_LAPACK=OFF\
        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
        -G Ninja /work/mxnet
    ninja
    export MXNET_LIBRARY_PATH=`pwd`/libmxnet.so
    cd /work/mxnet/python
    python setup.py bdist_wheel --universal


    # Fix pathing issues in the wheel.  We need to move libmxnet.so from the data folder to the root
    # of the wheel, then repackage the wheel.
    # Create a temp dir to do the work.
    # TODO: move apt call to install
    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 $TMPDIR
    cp $WHEEL /work/build
    rm -rf $TMPDIR
    popd
}

build_armv6() {
    set -ex
    pushd .
    cd /work/build

    # Lapack functionality will be included and statically linked to openblas.
    # But USE_LAPACK needs to be set to OFF, otherwise the main CMakeLists.txt
    # file tries to add -llapack. Lapack functionality though, requires -lgfortran
    # to be linked additionally.

    cmake \
        -DCMAKE_TOOLCHAIN_FILE=$CROSS_ROOT/Toolchain.cmake \
        -DUSE_CUDA=OFF \
        -DUSE_OPENCV=OFF \
        -DUSE_SIGNAL_HANDLER=ON \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DUSE_MKL_IF_AVAILABLE=OFF \
        -DUSE_LAPACK=OFF \
        -Dmxnet_LINKER_LIBS=-lgfortran \
        -G Ninja /work/mxnet
    ninja
    export MXNET_LIBRARY_PATH=`pwd`/libmxnet.so
    cd /work/mxnet/python
    python setup.py bdist_wheel --universal
    cp dist/*.whl /work/build
    popd
}

build_armv7() {
    set -ex
    pushd .
    cd /work/build
    cmake\
        -DUSE_CUDA=OFF\
        -DUSE_OPENCV=OFF\
        -DUSE_OPENMP=OFF\
        -DUSE_SIGNAL_HANDLER=ON\
        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
        -DUSE_MKL_IF_AVAILABLE=OFF\
        -G Ninja /work/mxnet<commit_msg>[MXNET-287] ARMv6 build with 8-10 times bigger file size (#10439)<commit_after>#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
# build and install are separated so changes to build don't invalidate
# the whole docker cache for the image

set -ex

clean_repo() {
    set -ex
    git clean -xfd
    git submodule foreach --recursive git clean -xfd
    git reset --hard
    git submodule foreach --recursive git reset --hard
    git submodule update --init --recursive
}


# Build commands: Every platform in docker/Dockerfile.build.<platform> should have a corresponding
# function here with the same suffix:

build_jetson() {
    set -ex
    pushd .

    #cd /work/mxnet
    #make -j$(nproc) USE_OPENCV=0 USE_BLAS=openblas USE_SSE=0 USE_CUDA=1 USE_CUDNN=1 ENABLE_CUDA_RTC=0 USE_NCCL=0 USE_CUDA_PATH=/usr/local/cuda/
    cd /work/build
    cmake\
        -DUSE_CUDA=OFF\
        -DUSE_OPENCV=OFF\
        -DUSE_OPENMP=ON\
        -DUSE_SIGNAL_HANDLER=ON\
        -DUSE_MKL_IF_AVAILABLE=OFF\
        -DUSE_LAPACK=OFF\
        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
        -G Ninja /work/mxnet
    ninja
    export MXNET_LIBRARY_PATH=`pwd`/libmxnet.so
    cd /work/mxnet/python
    python setup.py bdist_wheel --universal


    # Fix pathing issues in the wheel.  We need to move libmxnet.so from the data folder to the root
    # of the wheel, then repackage the wheel.
    # Create a temp dir to do the work.
    # TODO: move apt call to install
    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 $TMPDIR
    cp $WHEEL /work/build
    rm -rf $TMPDIR
    popd
}

build_armv6() {
    set -ex
    pushd .
    cd /work/build

    # Lapack functionality will be included and statically linked to openblas.
    # But USE_LAPACK needs to be set to OFF, otherwise the main CMakeLists.txt
    # file tries to add -llapack. Lapack functionality though, requires -lgfortran
    # to be linked additionally.

    cmake \
        -DCMAKE_TOOLCHAIN_FILE=$CROSS_ROOT/Toolchain.cmake \
        -DUSE_CUDA=OFF \
        -DUSE_OPENCV=OFF \
        -DUSE_SIGNAL_HANDLER=ON \
        -DCMAKE_BUILD_TYPE=Release \
        -DUSE_MKL_IF_AVAILABLE=OFF \
        -DUSE_LAPACK=OFF \
        -DBUILD_CPP_EXAMPLES=OFF \
        -Dmxnet_LINKER_LIBS=-lgfortran \
        -G Ninja /work/mxnet
    ninja
    export MXNET_LIBRARY_PATH=`pwd`/libmxnet.so
    cd /work/mxnet/python
    python setup.py bdist_wheel --universal
    cp dist/*.whl /work/build
    popd
}

build_armv7() {
    set -ex
    pushd .
    cd /work/build
    cmake\
        -DUSE_CUDA=OFF\
        -DUSE_OPENCV=OFF\
        -DUSE_OPENMP=OFF\
        -DUSE_SIGNAL_HANDLER=ON\
        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
        -DUSE_MKL_IF_AVAILABLE=OFF\
        -G Ninja /work/mxnet
{'fraction_non_alphanumeric': 0.08169014084507042, 'fraction_numerical': 0.0050704225352112674, 'mean_word_length': 2.615580448065173, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6486823', 'n_tokens_mistral': 2480, 'n_tokens_neox': 2399, 'n_words': 737}