Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mxnet_option(USE_NCCL "Use NVidia NCCL with CUDA" OFF)
mxnet_option(USE_OPENCV "Build with OpenCV support" ON)
mxnet_option(USE_OPENMP "Build with Openmp support" ON)
mxnet_option(USE_CUDNN "Build with cudnn support" ON) # one could set CUDNN_ROOT for search path
mxnet_option(USE_SSE "Build with x86 SSE instruction support" ON)
mxnet_option(USE_SSE "Build with x86 SSE instruction support" ON IF NOT ARM)
mxnet_option(USE_F16C "Build with x86 F16C instruction support" ON) # autodetects support if ON
mxnet_option(USE_LAPACK "Build with lapack support" ON)
mxnet_option(USE_MKL_IF_AVAILABLE "Use MKL if found" ON)
Expand Down Expand Up @@ -360,7 +360,7 @@ if(USE_OPENMP)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
endif()
elseif(UNIX)
elseif(UNIX AND NOT ANDROID)
list(APPEND mxnet_LINKER_LIBS pthread)
endif()

Expand Down
10 changes: 10 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,16 @@ try {
}
}
}
},
'Android / ARM64':{
node('mxnetlinux-cpu') {
ws('workspace/android64') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
docker_run('android_arm64', 'build_android_arm64', false)
}
}
}
}
} // End of stage('Build')

Expand Down
36 changes: 21 additions & 15 deletions ci/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,63 +221,69 @@ def script_name() -> str:
help="go in a shell inside the container",
action='store_true')

parser.add_argument("--docker-registry",
help="Dockerhub registry name to retrieve cache from",
parser.add_argument("-d", "--docker-registry",
help="Dockerhub registry name to retrieve cache from. Default is 'mxnetci'",
default='mxnetci',
type=str)

parser.add_argument("-c", "--cache", action="store_true",
help="Enable docker registry cache")

parser.add_argument("command",
help="command to run in the container",
nargs='*', action='append', type=str)

args = parser.parse_args()
docker_registry = args.docker_registry
def use_cache():
return args.cache or 'JOB_NAME' in os.environ # we are in Jenkins

command = list(chain(*args.command))
docker_binary = get_docker_binary(args.nvidiadocker)
shared_memory_size = args.shared_memory_size

print("into container: {}".format(args.into_container))
if args.list:
list_platforms()
elif args.platform:
platform = args.platform
tag = get_docker_tag(platform=platform, registry=docker_registry)
load_docker_cache(tag=tag, docker_registry=args.docker_registry)
build_docker(platform, docker_binary, registry=docker_registry)
tag = get_docker_tag(platform=platform, registry=args.docker_registry)
if use_cache():
load_docker_cache(tag=tag, docker_registry=args.docker_registry)
build_docker(platform, docker_binary, registry=args.docker_registry)
if args.build_only:
logging.warning("Container was just built. Exiting due to build-only.")
return 0

if command:
container_run(platform=platform, docker_binary=docker_binary, shared_memory_size=shared_memory_size,
command=command, docker_registry=docker_registry)
command=command, docker_registry=args.docker_registry)
elif args.print_docker_run:
print(container_run(platform=platform, docker_binary=docker_binary, shared_memory_size=shared_memory_size,
command=[], dry_run=True, docker_registry=docker_registry))
command=[], dry_run=True, docker_registry=args.docker_registry))
elif args.into_container:
container_run(platform=platform, docker_binary=docker_binary, shared_memory_size=shared_memory_size,
command=[], dry_run=False, into_container=True, docker_registry=docker_registry)
command=[], dry_run=False, into_container=True, docker_registry=args.docker_registry)
else:
cmd = ["/work/mxnet/ci/docker/runtime_functions.sh", "build_{}".format(platform)]
logging.info("No command specified, trying default build: %s", ' '.join(cmd))
container_run(platform=platform, docker_binary=docker_binary, shared_memory_size=shared_memory_size,
command=cmd, docker_registry=docker_registry)
command=cmd, docker_registry=args.docker_registry)

elif args.all:
platforms = get_platforms()
logging.info("Building for all architectures: {}".format(platforms))
logging.info("Artifacts will be produced in the build/ directory.")
for platform in platforms:
tag = get_docker_tag(platform=platform, registry=docker_registry)
load_docker_cache(tag=tag, docker_registry=args.docker_registry)
build_docker(platform, docker_binary)
tag = get_docker_tag(platform=platform, registry=args.docker_registry)
if use_cache():
load_docker_cache(tag=tag, docker_registry=args.docker_registry)
build_docker(platform, docker_binary, args.docker_registry)
if args.build_only:
continue
build_platform = "build_{}".format(platform)
cmd = ["/work/mxnet/ci/docker/runtime_functions.sh", build_platform]
shutil.rmtree(buildir(), ignore_errors=True)
container_run(platform=platform, docker_binary=docker_binary, shared_memory_size=shared_memory_size,
command=cmd, docker_registry=docker_registry)
command=cmd, docker_registry=args.docker_registry)
plat_buildir = os.path.join(get_mxnet_root(), build_platform)
shutil.move(buildir(), plat_buildir)
logging.info("Built files left in: %s", plat_buildir)
Expand Down
1 change: 1 addition & 0 deletions ci/docker/Dockerfile.build.android_arm64
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.schema-version="1.0"

ENV ARCH aarch64
ENV ANDROID_NDK_REVISION 15c

ENV CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-clang
ENV CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-clang++
Expand Down
5 changes: 3 additions & 2 deletions ci/docker/install/android_arm64_ndk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

set -ex
pushd .
export ANDROID_NDK_REVISION=15c
# This environment variable comes from the docker file
echo "Downloading android SDK rev ${ANDROID_NDK_REVISION}"
curl -O https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip && \
unzip ./android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip && \
cd android-ndk-r${ANDROID_NDK_REVISION} && \
Expand All @@ -32,4 +33,4 @@ cd android-ndk-r${ANDROID_NDK_REVISION} && \
--api 21 \
--install-dir=${CROSS_ROOT} && \

popd
popd
30 changes: 29 additions & 1 deletion ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ build_arm64() {
cp dist/*.whl /work/build
}

build_android_arm64() {
build_android_armv7() {
set -ex
cd /work/build
cmake\
Expand All @@ -163,6 +163,30 @@ build_android_arm64() {
cp dist/*.whl /work/build
}

build_android_arm64() {
set -ex
cd /work/build
# There are other ways for CMake to cross compile android, like setting the following variables
# below. But right not it doesn't work as expected, we need to find what's the best strategy to
# build with CMake in Android.
# -DCMAKE_ANDROID_NDK=${CROSS_ROOT} \
# -DCMAKE_SYSTEM_VERSION=${ANDROID_NDK_REVISION} \
# -DCMAKE_SYSTEM_NAME=Android \
#
cmake\
-DANDROID=ON \
-DUSE_CUDA=OFF\
-DUSE_SSE=OFF\
-DUSE_LAPACK=OFF\
-DUSE_OPENCV=OFF\
-DUSE_OPENMP=OFF\
-DUSE_SIGNAL_HANDLER=ON\
-DCMAKE_BUILD_TYPE=RelWithDebInfo\
-DUSE_MKL_IF_AVAILABLE=OFF\
-G Ninja /work/mxnet
ninja -v
}

build_centos7_cpu() {
set -ex
cd /work/mxnet
Expand Down Expand Up @@ -270,6 +294,10 @@ build_ubuntu_cpu_mkldnn() {
-j$(nproc)
}

build_ubuntu_gpu() {
build_ubuntu_gpu_cuda91_cudnn7
}

build_ubuntu_gpu_mkldnn() {
set -ex
make \
Expand Down
5 changes: 3 additions & 2 deletions src/operator/random/shuffle_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
* \file shuffle_op.cc
* \brief Operator to shuffle elements of an NDArray
*/
#if (__GNUC__ > 4 && !defined(__clang__major__)) || (__clang_major__ > 4 && __linux__)
#define USE_GNU_PARALLEL_SHUFFLE
#if !defined (__ANDROID__) && ((__GNUC__ > 4 &&\
!defined(__clang__major__)) || (__clang_major__ > 4 && __linux__))
#define USE_GNU_PARALLEL_SHUFFLE
#endif

#include <mxnet/operator_util.h>
Expand Down