2018-01-21 19:44:53 -08:00
# 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.
2016-02-21 14:12:16 +08:00
ROOTDIR = $( CURDIR)
2018-03-21 23:31:19 -07:00
TPARTYDIR = $( ROOTDIR) /3rdparty
2016-02-21 14:12:16 +08:00
2017-08-29 17:14:01 -07:00
i f e q ( $( OS ) , W i n d o w s _ N T )
UNAME_S := Windows
e l s e
UNAME_S := $( shell uname -s)
2019-01-03 08:38:00 +05:30
UNAME_P := $( shell uname -p)
2017-08-29 17:14:01 -07:00
e n d i f
2015-06-14 17:36:33 -07:00
i f n d e f c o n f i g
i f d e f C X X N E T _ C O N F I G
config = $( CXXNET_CONFIG)
e l s e i f n e q ( "$(wildcard ./config.mk)" , "" )
config = config.mk
2015-08-21 23:49:07 -06:00
e l s e
2015-06-14 17:36:33 -07:00
config = make/config.mk
e n d i f
e n d i f
i f n d e f D M L C _ C O R E
2018-03-25 19:45:24 -07:00
DMLC_CORE = $( TPARTYDIR) /dmlc-core
2015-06-14 17:36:33 -07:00
e n d i f
2017-08-02 16:19:41 -07:00
CORE_INC = $( wildcard $( DMLC_CORE) /include/*/*.h)
2015-06-14 17:36:33 -07:00
2016-09-01 21:17:33 -07:00
i f n d e f N N V M _ P A T H
2018-06-02 17:58:25 -07:00
NNVM_PATH = $( TPARTYDIR) /tvm/nnvm
2016-09-01 21:17:33 -07:00
e n d i f
2017-05-29 23:37:08 -07:00
i f n d e f D L P A C K _ P A T H
2018-03-21 23:31:19 -07:00
DLPACK_PATH = $( ROOTDIR) /3rdparty/dlpack
2017-05-29 23:37:08 -07:00
e n d i f
2017-08-12 21:12:44 +02:00
i f n d e f A M A L G A M A T I O N _ P A T H
AMALGAMATION_PATH = $( ROOTDIR) /amalgamation
e n d i f
2015-09-15 08:53:03 +08:00
i f n e q ( $( USE_OPENMP ) , 1 )
2015-09-04 01:15:31 +08:00
export NO_OPENMP = 1
e n d i f
2015-06-14 17:36:33 -07:00
# use customized config file
i n c l u d e $( config )
2017-02-15 19:54:43 -08:00
2019-01-07 04:04:38 +08:00
i f n d e f U S E _ M K L D N N
2019-01-03 08:38:00 +05:30
i f n e q ( $( UNAME_S ) , D a r w i n )
i f n e q ( $( UNAME_S ) , W i n d o w s )
i f e q ( $( UNAME_P ) , x 8 6 _ 6 4 )
USE_MKLDNN = 1
e n d i f
e n d i f
e n d i f
e n d i f
2018-01-31 21:09:49 -08:00
i f e q ( $( USE_MKL 2017) , 1 )
2018-02-15 14:44:34 -08:00
$( warning "USE_MKL 2017 is deprecated . We will switch to USE_MKLDNN .")
USE_MKLDNN = 1
e n d i f
i f e q ( $( USE_MKLDNN ) , 1 )
2018-10-10 01:38:53 +08:00
MKLDNNROOT = $( ROOTDIR) /3rdparty/mkldnn/build/install
MKLROOT = $( ROOTDIR) /3rdparty/mkldnn/build/install
2018-02-15 14:44:34 -08:00
export USE_MKLML = 1
2017-02-15 19:54:43 -08:00
e n d i f
2018-03-21 23:31:19 -07:00
i n c l u d e $( TPARTYDIR ) / m s h a d o w / m a k e / m s h a d o w . m k
2015-06-14 17:36:33 -07:00
i n c l u d e $( DMLC_CORE ) / m a k e / d m l c . m k
# all tge possible warning tread
2017-03-16 10:49:47 -07:00
WARNFLAGS = -Wall -Wsign-compare
2015-06-14 17:36:33 -07:00
CFLAGS = -DMSHADOW_FORCE_STREAM $( WARNFLAGS)
2015-08-23 21:26:16 +08:00
2016-12-29 03:18:09 +08:00
i f e q ( $( DEV ) , 1 )
CFLAGS += -g -Werror
2017-06-22 15:24:38 -07:00
NVCCFLAGS += -Werror cross-execution-space-call
2016-12-29 03:18:09 +08:00
e n d i f
2015-08-23 21:26:16 +08:00
# CFLAGS for debug
2015-09-19 14:32:28 -07:00
i f e q ( $( DEBUG ) , 1 )
2017-04-30 20:16:56 -07:00
CFLAGS += -g -O0
2015-09-19 14:32:28 -07:00
e l s e
Batch Norm rewrite without mshadow, 1D, 2D, 3D, float16, float32, float64 as well as operator gtest framework (#5936)
* Batch Norm rewrite without mshadow as well as operator gtest framework
* performance testing
* lint fixes
* use CUDNN for this test
* remove superfluous omp define
* Fix file names in comments
* build, run, clean gtest works (although a test is failing)
* CR comments
* Adjust timing tests for more strenuous sample
* Remove temp resource allocation
* DeviceTensor3 added, forEachFast not yet converted
* DeviceTensor3 version working
* DeviceTensor3 working
* .
* Fix for use_global_stats
* fixed bug with testing suite for double (Float64)
* python unit tests working for batchnorm
* python unit tests
* Update documentation for mxnet.initializer.Mixed (#5937)
* Update documentation for SVMOutput. (#5931)
* Update documentation for SVMOutput.
* Update doc for SVMOutput - fix formatting.
* Adding install instruction for Ubuntu-CPU-Python (#5885)
* edit ndarray API docs (#5806)
* edit docs in broadcast_reduce_op
* edit docs in broadcast_reduce_op
* minor change
* lint fix
* fix
* mx.nd.ones
* mx.nd.repeat
* mx.nd.reverse
* add example in repeat
* optimizer update
* fix nanprod
* fix optimizer_op api doc
* fix reduce_op api doc
* fix nd.ones api doc
* mx.nd.repeat doc change
* Update broadcast_reduce_op.h
* Symbol docs fixes (#5930)
* symbol docs minor formatting changes
* deepcopy, infer_shape, infer_shape_partial docs modified
* Few more small fixes
* arithmetic functions fixes
* some more modifications
* changes after review
* small change
* grad function note added
* More API Doc Edits (#5886)
* edit activation doc
* doc l2_normalization
* edit MakeLoss doc
* edit blockgrad doc
* blockgrad fileline fix
* edit MakeLoss doc cont.
* doc change 'tensor' to 'multidimensional array'
* l2normalization doc improve
* makeloss doc improve, blockgrad doc improve
* fix doc in activation, l2_normalization, make_loss
* fix minor grammar
* use .describe to avoid build failure.
* Update documentation for mxnet.image.imdecode (#5957)
* Update documentation for mxnet.image.imdecode
* Update documentation for mxnet.image.imdecode (clarify that we need OpenCV and not the CV2 Python library)
* Fix script by adding path to Dockerfile (#5958)
* Clean install script
* Add test for pip installations
* Remove debug statements & comments
* Make test runnable as script and from framework
* Fix path to Dockerfiles
* Putting failing cases at the end
* Update doc for Custom operator. (#5875)
* Update doc for Custom operator.
* Update doc for Custom operator.
* Fix formating in doc for Custom operator.
* Fix formating in doc for Custom operator.
* Minor change to ndarray.Custom documentation.
* Minor edit in doc for Custom operator.
* Minor change to doc for Custom operator. Data is 'NDArray-or-Symbol'.
* Minor formatting change for Custom operator documentation.
* For Custom operator doc, move example into ndarray_doc.py.
* Minor change in Custom operator documentation
* Improve the doc of pick + Update dmlc-core (#5946)
* Add PickParam to fix the docstring and the initial value for axis
* Update dmlc-core
* Update dmlc-core
* Image docs modified (#5973)
* imageIter doc modified
* edited imageiter
* ADD missing Libri_sample.json, FIX minor bugs in speech_recognition example (#5962)
* [KVStore] Add support for other data types (#5818)
* Fix kvstore type
* Fix lint
* Parse inputs to DataDesc
* Make module support dtype
* Fix lint
* Add default dtype in Comm
* Fix lint
* Revert rename
* [cpp-package] Add C++ basic tutorial and build instruction (#5971)
* Add C++ basic tutorial and build instruction
* Remove binaries
* Fix lint
* Avoid sign-compare
* Update documentation for mxnet.metric.np (#5977)
* Getting rid of identity (#5935)
* Activation ops (#5938)
* [Ops] Add op: 'relu'
* Add op: 'sigmoid'
* Introduce 'kernel_launch_op'
* Add tests and describe; move it to elemwise_unary_op
* Fix GPU version
* Convert caffe AbsVal to mx.symbol.abs in caffe converter (#5984)
* Correction to LSTMCell docstring (#5986)
* [Module] fix input_grads order (#5980)
* fix input_grads order + update dmlc-core
* set label to be optional
* update env_var doc (#5964)
* Adjusting make, Callback removed
* batch norm gpu testing
* Batch Norm rewrite without mshadow as well as operator gtest framework
* performance testing
* lint fixes
* use CUDNN for this test
* remove superfluous omp define
* Fix file names in comments
* build, run, clean gtest works (although a test is failing)
* CR comments
* Adjust timing tests for more strenuous sample
* Remove temp resource allocation
* rearrange source into cc and cu files
* lint fixes
* Trigger build
* Use latest mshadow
* temporarily revert channel position parameter field
* Add more tests for batchnorm
* Add more tests for batchnorm
* test_operator_gpu working for all types
* Compiles after AccReal
* Compiles after AccReal
* All tests working
* All tests working
* build, run, clean gtest works (although a test is failing)
* vc++ requires explicit int type for omp for loop
* Repair cpp-package
* signed/unsigned fixed in cuda file
* lint fixes in tests and cpp-package directories
* more lint
* use IsWriting() helper
* Fall-through for unsupported MKL shapes/types
* Fall-through for unsupported MKL shapes/types
* cleaner mkl_off approach
* Warning only whem MKL is requested
* Warning only whem MKL is requested
* lint
* ..
* python problem fixed
* python problem fixed
* Merge branch 'batchnorm' into batchnorm_pr
# Conflicts:
# src/operator/batch_norm.cc
# src/operator/batch_norm.cu
# tests/cpp/operator/batchnorm_test.cc
* lint fix
* lint fix
* lint fix
* lint fix
* lint fix
* Fix visual c++ compile problem
* .
* .
* All unit tests pass again
* lint fix
* fix strange compile errors in CUDNN batchnorm header
* FInish using flags instead of bools
* lint
* Fix timing pass count for forward pass
* Fix R script install roxygen problem
* code formatting, addition of doc strings is causing IDE to add spaces before the calls
* removed commented
* cr comments
* Change back to compilable code
* For CPU mode, store as invstd
* move testing code around a little
* lint fix
* Use AccReal in some places to avoid fp16 problems
* Fix minor invstd problem in cuda version
* remove unused scale param
* add permutation unit test, handle cudnn doesn't like 3D
* .
* lint
* .
* Remove mkl_off
* lint fix and time cudnn when enabled
2017-05-15 20:27:28 -07:00
CFLAGS += -O3 -DNDEBUG= 1
2015-08-23 21:26:16 +08:00
e n d i f
2018-06-02 17:58:25 -07:00
CFLAGS += -I$( TPARTYDIR) /mshadow/ -I$( TPARTYDIR) /dmlc-core/include -fPIC -I$( NNVM_PATH) /include -I$( DLPACK_PATH) /include -I$( TPARTYDIR) /tvm/include -Iinclude $( MSHADOW_CFLAGS)
2015-06-14 17:36:33 -07:00
LDFLAGS = -pthread $( MSHADOW_LDFLAGS) $( DMLC_LDFLAGS)
2018-08-10 02:38:04 -07:00
2018-09-24 16:30:38 +02:00
i f e q ( $( ENABLE_TESTCOVERAGE ) , 1 )
CFLAGS += --coverage
LDFLAGS += --coverage
e n d i f
2018-08-10 02:38:04 -07:00
i f e q ( $( USE_TENSORRT ) , 1 )
CFLAGS += -I$( ROOTDIR) -I$( TPARTYDIR) -DONNX_NAMESPACE= $( ONNX_NAMESPACE) -DMXNET_USE_TENSORRT= 1
LDFLAGS += -lprotobuf -pthread -lonnx -lonnx_proto -lnvonnxparser -lnvonnxparser_runtime -lnvinfer -lnvinfer_plugin
e n d i f
# -L/usr/local/lib
2015-10-24 15:53:35 -07:00
i f e q ( $( DEBUG ) , 1 )
2017-06-22 15:24:38 -07:00
NVCCFLAGS += -std= c++11 -Xcompiler -D_FORCE_INLINES -g -G -O0 -ccbin $( CXX) $( MSHADOW_NVCCFLAGS)
2015-10-24 15:53:35 -07:00
e l s e
2017-06-22 15:24:38 -07:00
NVCCFLAGS += -std= c++11 -Xcompiler -D_FORCE_INLINES -O3 -ccbin $( CXX) $( MSHADOW_NVCCFLAGS)
2015-10-24 15:53:35 -07:00
e n d i f
2015-06-14 17:36:33 -07:00
2017-09-10 22:22:19 -07:00
# CFLAGS for segfault logger
i f e q ( $( USE_SIGNAL_HANDLER ) , 1 )
CFLAGS += -DMXNET_USE_SIGNAL_HANDLER= 1
e n d i f
2017-03-30 20:13:36 -07:00
# Caffe Plugin
i f d e f C A F F E _ P A T H
2017-08-29 17:14:01 -07:00
CFLAGS += -DMXNET_USE_CAFFE= 1
2017-03-30 20:13:36 -07:00
e n d i f
2015-07-03 17:06:23 -06:00
i f n d e f L I N T _ L A N G
2019-03-07 10:10:02 +08:00
LINT_LANG = "all"
2015-07-03 17:06:23 -06:00
e n d i f
2018-03-16 13:55:27 +08:00
i f e q ( $( USE_MKLDNN ) , 1 )
CFLAGS += -DMXNET_USE_MKLDNN= 1
CFLAGS += -DUSE_MKL= 1
CFLAGS += -I$( ROOTDIR) /src/operator/nn/mkldnn/
ifneq ( $( MKLDNNROOT) , $( MKLROOT) )
CFLAGS += -I$( MKLROOT) /include
LDFLAGS += -L$( MKLROOT) /lib
endif
2018-12-06 17:44:06 +08:00
CFLAGS += -I$( MKLDNNROOT) /include
2018-12-13 16:01:30 -08:00
LDFLAGS += -L$( MKLDNNROOT) /lib -lmkldnn -Wl,-rpath,'$${ORIGIN}'
2018-03-16 13:55:27 +08:00
e n d i f
2015-06-14 17:36:33 -07:00
# setup opencv
2015-10-02 11:52:44 +08:00
i f e q ( $( USE_OPENCV ) , 1 )
2019-03-07 10:10:02 +08:00
CFLAGS += -DMXNET_USE_OPENCV= 1
2019-03-14 16:00:36 +08:00
ifneq ( $( filter-out NONE, $( USE_OPENCV_INC_PATH) ) ,)
2019-03-07 10:10:02 +08:00
CFLAGS += -I$( USE_OPENCV_INC_PATH) /include
2019-03-14 16:00:36 +08:00
ifeq ( $( filter-out NONE, $( USE_OPENCV_LIB_PATH) ) ,)
2019-03-07 10:10:02 +08:00
$( error Please add the path of OpenCV shared library path into `USE_OPENCV_LIB_PATH `, when `USE_OPENCV_INC_PATH ` is not NONE )
e n d i f
LDFLAGS += -L$( USE_OPENCV_LIB_PATH)
ifneq ( $( wildcard $( USE_OPENCV_LIB_PATH) /libopencv_imgcodecs.*) ,)
LDFLAGS += -lopencv_imgcodecs
endif
ifneq ( $( wildcard $( USE_OPENCV_LIB_PATH) /libopencv_highgui.*) ,)
LDFLAGS += -lopencv_highgui
endif
else
ifeq ( " $( shell pkg-config --exists opencv4; echo $$ ?) " , "0" )
OPENCV_LIB = opencv4
else
OPENCV_LIB = opencv
endif
CFLAGS += $( shell pkg-config --cflags $( OPENCV_LIB) )
LDFLAGS += $( shell pkg-config --libs-only-L $( OPENCV_LIB) )
LDFLAGS += $( filter -lopencv_imgcodecs -lopencv_highgui, $( shell pkg-config --libs-only-l $( OPENCV_LIB) ) )
endif
LDFLAGS += -lopencv_imgproc -lopencv_core
2015-09-21 01:55:32 +08:00
BIN += bin/im2rec
2015-06-14 17:36:33 -07:00
e l s e
2019-03-07 10:10:02 +08:00
CFLAGS += -DMXNET_USE_OPENCV= 0
2015-09-04 01:15:31 +08:00
e n d i f
2015-09-13 10:41:34 -07:00
i f e q ( $( USE_OPENMP ) , 1 )
2018-10-16 09:30:39 -07:00
CFLAGS += -fopenmp
2015-06-14 17:36:33 -07:00
e n d i f
2016-11-10 12:19:46 +08:00
i f e q ( $( USE_NNPACK ) , 1 )
CFLAGS += -DMXNET_USE_NNPACK= 1
LDFLAGS += -lnnpack
e n d i f
2017-11-21 06:49:51 -08:00
i f e q ( $( USE_OPERATOR_TUNING ) , 1 )
CFLAGS += -DMXNET_USE_OPERATOR_TUNING= 1
e n d i f
2017-06-18 14:23:29 -07:00
# verify existence of separate lapack library when using blas/openblas/atlas
# switch off lapack support in case it can't be found
# issue covered with this
# - for Ubuntu 14.04 or lower, lapack is not automatically installed with openblas
# - for Ubuntu, installing atlas will not automatically install the atlas provided lapack library
2018-06-18 06:23:55 +08:00
# - for rhel7.2, try installing the package `lapack-static` via yum will dismiss this warning.
2017-06-18 14:23:29 -07:00
# silently switching lapack off instead of letting the build fail because of backward compatibility
2017-06-13 14:13:20 -07:00
i f e q ( $( USE_LAPACK ) , 1 )
2018-02-15 14:44:34 -08:00
i f e q ( $( USE_BLAS ) , $( filter $ ( USE_BLAS ) ,blas openblas atlas mkl ) )
2018-07-03 01:56:54 +08:00
i f e q ( , $( wildcard $ ( USE_LAPACK_PATH ) /liblapack .a ) )
i f e q ( , $( wildcard $ ( USE_LAPACK_PATH ) /liblapack .so ) )
2017-06-18 14:23:29 -07:00
i f e q ( , $( wildcard /lib /liblapack .a ) )
2018-07-03 01:56:54 +08:00
i f e q ( , $( wildcard /lib /liblapack .so ) )
2017-06-18 14:23:29 -07:00
i f e q ( , $( wildcard /usr /lib /liblapack .a ) )
2018-07-03 01:56:54 +08:00
i f e q ( , $( wildcard /usr /lib /liblapack .so ) )
2017-12-09 01:16:03 +00:00
i f e q ( , $( wildcard /usr /lib 64/liblapack .a ) )
2018-07-03 01:56:54 +08:00
i f e q ( , $( wildcard /usr /lib 64/liblapack .so ) )
2017-06-18 14:23:29 -07:00
USE_LAPACK = 0
2018-03-09 23:33:10 +01:00
$( warning "USE_LAPACK disabled because libraries were not found" )
2017-06-18 14:23:29 -07:00
e n d i f
e n d i f
e n d i f
2017-06-13 14:13:20 -07:00
e n d i f
e n d i f
2017-12-09 01:16:03 +00:00
e n d i f
2018-07-03 01:56:54 +08:00
e n d i f
e n d i f
e n d i f
e n d i f
2017-06-18 14:23:29 -07:00
# lapack settings.
i f e q ( $( USE_LAPACK ) , 1 )
i f n e q ( $( USE_LAPACK_PATH ) , )
LDFLAGS += -L$( USE_LAPACK_PATH)
endif
2018-02-15 14:44:34 -08:00
ifeq ( $( USE_BLAS) ,$( filter $( USE_BLAS) ,blas openblas atlas mkl) )
2017-06-18 14:23:29 -07:00
LDFLAGS += -llapack
endif
CFLAGS += -DMXNET_USE_LAPACK
2017-06-13 14:13:20 -07:00
e n d i f
2015-06-14 17:36:33 -07:00
i f e q ( $( USE_CUDNN ) , 1 )
2015-09-09 20:16:18 -06:00
CFLAGS += -DMSHADOW_USE_CUDNN= 1
2015-06-14 17:36:33 -07:00
LDFLAGS += -lcudnn
e n d i f
2019-01-21 16:45:07 +01:00
i f e q ( $( use_blas ) , o p e n )
CFLAGS += -DMXNET_USE_BLAS_OPEN= 1
e l s e i f e q ( $( use_blas ) , a t l a s )
CFLAGS += -DMXNET_USE_BLAS_ATLAS= 1
e l s e i f e q ( $( use_blas ) , m k l )
CFLAGS += -DMXNET_USE_BLAS_MKL= 1
e l s e i f e q ( $( use_blas ) , a p p l e )
CFLAGS += -DMXNET_USE_BLAS_APPLE= 1
e n d i f
2018-05-01 21:18:23 -07:00
# whether to use F16C instruction set extension for fast fp16 compute on CPU
# if cross compiling you may want to explicitly turn it off if target system does not support it
i f n d e f U S E _ F 1 6 C
i f n e q ( $( OS ) , W i n d o w s _ N T )
detected_OS := $( shell uname -s)
ifeq ( $( detected_OS) ,Darwin)
F16C_SUPP = $( shell sysctl -a | grep machdep.cpu.features | grep F16C)
endif
ifeq ( $( detected_OS) ,Linux)
F16C_SUPP = $( shell cat /proc/cpuinfo | grep flags | grep f16c)
endif
ifneq ( $( strip $( F16C_SUPP) ) ,)
USE_F16C = 1
else
USE_F16C = 0
endif
endif
# if OS is Windows, check if your processor and compiler support F16C architecture.
# One way to check if processor supports it is to download the tool
# https://docs.microsoft.com/en-us/sysinternals/downloads/coreinfo.
# If coreinfo -c shows F16C and compiler supports it,
# then you can set USE_F16C=1 explicitly to leverage that capability"
e n d i f
2017-10-13 19:24:38 -07:00
# gperftools malloc library (tcmalloc)
i f e q ( $( USE_GPERFTOOLS ) , 1 )
2018-10-02 20:07:42 +00:00
FIND_LIBFILEEXT = so
i f e q ( $( USE_GPERFTOOLS_STATIC ) , 1 )
FIND_LIBFILEEXT = a
e n d i f
FIND_LIBFILE = $( wildcard $( USE_GPERFTOOLS_PATH) /libtcmalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
2018-10-02 20:07:42 +00:00
FIND_LIBFILE = $( wildcard /lib/libtcmalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
2018-10-02 20:07:42 +00:00
FIND_LIBFILE = $( wildcard /usr/lib/libtcmalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
2018-10-02 20:07:42 +00:00
FIND_LIBFILE = $( wildcard /usr/local/lib/libtcmalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
2018-10-02 20:07:42 +00:00
FIND_LIBFILE = $( wildcard /usr/lib64/libtcmalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
USE_GPERFTOOLS = 0
e n d i f
e n d i f
e n d i f
e n d i f
e n d i f
i f e q ( $( USE_GPERFTOOLS ) , 1 )
CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
LDFLAGS += $( FIND_LIBFILE)
2017-10-13 19:24:38 -07:00
e n d i f
# jemalloc malloc library (if not using gperftools)
2018-09-23 22:11:20 -07:00
e l s e
i f e q ( $( USE_JEMALLOC ) , 1 )
2018-10-02 20:07:42 +00:00
FIND_LIBFILEEXT = so
i f e q ( $( USE_JEMALLOC_STATIC ) , 1 )
FIND_LIBFILEEXT = a
e n d i f
FIND_LIBFILE = $( wildcard $( USE_JEMALLOC_PATH) /libjemalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
2018-10-02 20:07:42 +00:00
FIND_LIBFILE = $( wildcard /lib/libjemalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
2018-10-02 20:07:42 +00:00
FIND_LIBFILE = $( wildcard /usr/lib/libjemalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
2018-10-02 20:07:42 +00:00
FIND_LIBFILE = $( wildcard /usr/local/lib/libjemalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
2018-10-02 20:07:42 +00:00
FIND_LIBFILE = $( wildcard /usr/lib/x86_64-linux-gnu/libjemalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
2018-10-02 20:07:42 +00:00
FIND_LIBFILE = $( wildcard /usr/lib64/libjemalloc.$( FIND_LIBFILEEXT) )
2018-09-23 22:11:20 -07:00
i f e q ( , $( FIND_LIBFILE ) )
USE_JEMALLOC = 0
e n d i f
e n d i f
e n d i f
e n d i f
e n d i f
e n d i f
i f e q ( $( USE_JEMALLOC ) , 1 )
CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc \
-fno-builtin-free -DUSE_JEMALLOC
LDFLAGS += $( FIND_LIBFILE)
e n d i f
e n d i f
2017-10-13 19:24:38 -07:00
e n d i f
2017-03-16 15:01:51 -07:00
2017-10-13 19:24:38 -07:00
# If not using tcmalloc or jemalloc, print a warning (user should consider installing)
i f n e q ( $( USE_GPERFTOOLS ) , 1 )
2018-09-23 22:11:20 -07:00
i f n e q ( $( USE_JEMALLOC ) , 1 )
2017-10-13 19:24:38 -07:00
$(warning WARNING : Significant performance increases can be achieved by installing and \
enabling gperftools or jemalloc development packages )
2018-09-23 22:11:20 -07:00
e n d i f
2017-10-13 19:24:38 -07:00
e n d i f
2017-03-16 15:01:51 -07:00
2015-09-08 23:29:03 +08:00
i f e q ( $( USE_THREADED_ENGINE ) , 1 )
CFLAGS += -DMXNET_USE_THREADED_ENGINE
e n d i f
2015-06-14 17:36:33 -07:00
i f n e q ( $( ADD_CFLAGS ) , N O N E )
CFLAGS += $( ADD_CFLAGS)
e n d i f
i f n e q ( $( ADD_LDFLAGS ) , N O N E )
LDFLAGS += $( ADD_LDFLAGS)
e n d i f
2018-04-10 13:22:54 +00:00
i f e q ( $( NVCC ) , N O N E )
2018-04-25 13:09:58 -07:00
# If NVCC has not been manually defined, use the CUDA_PATH bin dir.
2018-04-10 13:22:54 +00:00
ifneq ( $( USE_CUDA_PATH) , NONE)
NVCC = $( USE_CUDA_PATH) /bin/nvcc
endif
2015-09-22 14:32:47 -04:00
e n d i f
2018-04-25 13:09:58 -07:00
# Guard against displaying nvcc info messages to users not using CUDA.
i f e q ( $( USE_CUDA ) , 1 )
# If NVCC is not at the location specified, use CUDA_PATH instead.
ifeq ( " $( wildcard $( NVCC) ) " ,"" )
ifneq ( $( USE_CUDA_PATH) , NONE)
NVCC = $( USE_CUDA_PATH) /bin/nvcc
$(info INFO : nvcc was not found on your path )
$(info INFO : Using $( NVCC ) as nvcc path )
else
$(warning WARNING : could not find nvcc compiler , the specified path was : $( NVCC ) )
endif
endif
e n d i f
2017-06-07 10:12:32 -07:00
# Sets 'CUDA_ARCH', which determines the GPU architectures supported
# by the compiled kernels. Users can edit the KNOWN_CUDA_ARCHS list below
2017-08-17 21:14:18 -07:00
# to remove archs they don't wish to support to speed compilation, or they can
# pre-set the CUDA_ARCH args in config.mk to a non-null value for full control.
2017-06-07 10:12:32 -07:00
#
# For archs in this list, nvcc will create a fat-binary that will include
# the binaries (SASS) for all architectures supported by the installed version
# of the cuda toolkit, plus the assembly (PTX) for the most recent such architecture.
# If these kernels are then run on a newer-architecture GPU, the binary will
# be JIT-compiled by the updated driver from the included PTX.
i f e q ( $( USE_CUDA ) , 1 )
2017-08-17 21:14:18 -07:00
i f e q ( $( CUDA_ARCH ) , )
2018-11-21 10:48:59 +08:00
KNOWN_CUDA_ARCHS := 30 35 50 52 60 61 70 75
2017-06-07 10:12:32 -07:00
# Run nvcc on a zero-length file to check architecture-level support.
# Create args to include SASS in the fat binary for supported levels.
CUDA_ARCH := $( foreach arch,$( KNOWN_CUDA_ARCHS) , \
2017-08-29 17:14:01 -07:00
$( shell $( NVCC) -arch= sm_$( arch) -E --x cu /dev/null >/dev/null 2>& 1 && \
echo -gencode arch = compute_$( arch) ,code= sm_$( arch) ) )
2017-06-07 10:12:32 -07:00
# Convert a trailing "code=sm_NN" to "code=[sm_NN,compute_NN]" to also
# include the PTX of the most recent arch in the fat-binaries for
# forward compatibility with newer GPUs.
CUDA_ARCH := $( shell echo $( CUDA_ARCH) | sed 's/sm_\([0-9]*\)$$/[sm_\1,compute_\1]/' )
# Add fat binary compression if supported by nvcc.
COMPRESS := --fatbin-options -compress-all
CUDA_ARCH += $( shell $( NVCC) -cuda $( COMPRESS) --x cu /dev/null -o /dev/null >/dev/null 2>& 1 && \
2017-08-29 17:14:01 -07:00
echo $( COMPRESS) )
2017-06-07 10:12:32 -07:00
e n d i f
2017-12-06 19:31:19 +01:00
$(info Running CUDA_ARCH : $( CUDA_ARCH ) )
2017-06-07 10:12:32 -07:00
e n d i f
2015-10-02 22:22:22 -04:00
# ps-lite
2018-03-21 23:31:19 -07:00
PS_PATH = $( ROOTDIR) /3rdparty/ps-lite
2015-10-02 22:22:22 -04:00
DEPS_PATH = $( shell pwd ) /deps
i n c l u d e $( PS_PATH ) / m a k e / p s . m k
i f e q ( $( USE_DIST_KVSTORE ) , 1 )
2015-10-20 22:06:23 +00:00
CFLAGS += -DMXNET_USE_DIST_KVSTORE -I$( PS_PATH) /include -I$( DEPS_PATH) /include
2015-10-02 22:22:22 -04:00
LIB_DEP += $( PS_PATH) /build/libps.a
2015-11-06 21:54:16 -05:00
LDFLAGS += $( PS_LDFLAGS_A)
2015-10-02 22:22:22 -04:00
e n d i f
2017-05-07 22:19:25 -07:00
.PHONY : clean all extra -packages test lint docs clean_all rcpplint rcppexport roxygen \
2016-09-08 19:10:58 -07:00
cython 2 cython 3 cython cyclean
2015-06-14 17:36:33 -07:00
2017-03-30 20:13:36 -07:00
all : lib /libmxnet .a lib /libmxnet .so $( BIN ) extra -packages
2015-06-14 17:36:33 -07:00
2017-11-30 10:56:21 -08:00
SRC = $( wildcard src/*/*/*/*.cc src/*/*/*.cc src/*/*.cc src/*.cc)
2016-01-07 22:52:33 -08:00
OBJ = $( patsubst %.cc, build/%.o, $( SRC) )
2017-11-30 10:56:21 -08:00
CUSRC = $( wildcard src/*/*/*/*.cu src/*/*/*.cu src/*/*.cu src/*.cu)
2016-01-07 22:52:33 -08:00
CUOBJ = $( patsubst %.cu, build/%_gpu.o, $( CUSRC) )
2015-06-14 17:36:33 -07:00
2016-01-12 21:22:09 -08:00
# extra operators
2015-12-23 15:07:58 -08:00
i f n e q ( $( EXTRA_OPERATORS ) , )
2016-11-07 15:10:50 -06:00
EXTRA_SRC = $( wildcard $( patsubst %, %/*.cc, $( EXTRA_OPERATORS) ) $( patsubst %, %/*/*.cc, $( EXTRA_OPERATORS) ) )
2016-08-10 18:33:41 -07:00
EXTRA_OBJ = $( patsubst %.cc, %.o, $( EXTRA_SRC) )
2016-11-07 15:10:50 -06:00
EXTRA_CUSRC = $( wildcard $( patsubst %, %/*.cu, $( EXTRA_OPERATORS) ) $( patsubst %, %/*/*.cu, $( EXTRA_OPERATORS) ) )
2016-08-10 18:33:41 -07:00
EXTRA_CUOBJ = $( patsubst %.cu, %_gpu.o, $( EXTRA_CUSRC) )
2015-12-16 23:38:36 -08:00
e l s e
EXTRA_SRC =
EXTRA_OBJ =
EXTRA_CUSRC =
EXTRA_CUOBJ =
e n d i f
2016-01-07 22:52:33 -08:00
# plugin
2016-01-12 21:22:09 -08:00
PLUGIN_OBJ =
PLUGIN_CUOBJ =
i n c l u d e $( MXNET_PLUGINS )
2016-01-07 22:52:33 -08:00
2019-01-08 17:25:53 -08:00
i f n e q ( $( UNAME_S ) , W i n d o w s )
2016-03-11 23:48:53 +08:00
i f e q ( $( UNAME_S ) , D a r w i n )
2016-09-01 21:17:33 -07:00
WHOLE_ARCH = -all_load
NO_WHOLE_ARCH = -noall_load
2016-05-01 17:00:47 -07:00
else
2016-09-01 21:17:33 -07:00
WHOLE_ARCH = --whole-archive
NO_WHOLE_ARCH = --no-whole-archive
2016-03-11 23:48:53 +08:00
endif
e n d i f
2016-01-12 21:22:09 -08:00
# all dep
2016-09-01 21:17:33 -07:00
LIB_DEP += $( DMLC_CORE) /libdmlc.a $( NNVM_PATH) /lib/libnnvm.a
2016-01-07 22:52:33 -08:00
ALL_DEP = $( OBJ) $( EXTRA_OBJ) $( PLUGIN_OBJ) $( LIB_DEP)
2016-09-01 21:17:33 -07:00
2015-09-05 19:23:50 -06:00
i f e q ( $( USE_CUDA ) , 1 )
2019-03-31 16:38:15 -07:00
CFLAGS += -I$( ROOTDIR) /3rdparty/nvidia_cub
2016-01-07 22:52:33 -08:00
ALL_DEP += $( CUOBJ) $( EXTRA_CUOBJ) $( PLUGIN_CUOBJ)
2018-01-15 15:21:23 -05:00
LDFLAGS += -lcufft
ifeq ( $( ENABLE_CUDA_RTC) , 1)
LDFLAGS += -lcuda -lnvrtc
CFLAGS += -DMXNET_ENABLE_CUDA_RTC= 1
endif
2018-02-27 08:41:28 -08:00
# Make sure to add stubs as fallback in order to be able to build
2017-12-06 19:31:19 +01:00
# without full CUDA install (especially if run without nvidia-docker)
LDFLAGS += -L/usr/local/cuda/lib64/stubs
2017-11-21 06:52:16 -08:00
ifeq ( $( USE_NCCL) , 1)
ifneq ( $( USE_NCCL_PATH) , NONE)
CFLAGS += -I$( USE_NCCL_PATH) /include
LDFLAGS += -L$( USE_NCCL_PATH) /lib
endif
LDFLAGS += -lnccl
CFLAGS += -DMXNET_USE_NCCL= 1
else
CFLAGS += -DMXNET_USE_NCCL= 0
endif
2016-03-11 23:48:53 +08:00
e l s e
2017-11-21 06:52:16 -08:00
CFLAGS += -DMXNET_USE_NCCL= 0
2015-09-05 19:23:50 -06:00
e n d i f
2017-10-14 13:09:21 -07:00
i f e q ( $( USE_LIBJPEG_TURBO ) , 1 )
i f n e q ( $( USE_LIBJPEG_TURBO_PATH ) , N O N E )
CFLAGS += -I$( USE_LIBJPEG_TURBO_PATH) /include
LDFLAGS += -L$( USE_LIBJPEG_TURBO_PATH) /lib
endif
LDFLAGS += -lturbojpeg
CFLAGS += -DMXNET_USE_LIBJPEG_TURBO= 1
e l s e
CFLAGS += -DMXNET_USE_LIBJPEG_TURBO= 0
e n d i f
2019-01-08 11:31:35 -08:00
i f e q ( $( CI ) , 1 )
MAVEN_ARGS := -B
e n d i f
2016-09-01 21:17:33 -07:00
# For quick compile test, used smaller subset
ALLX_DEP = $( ALL_DEP)
2018-06-28 01:32:53 +08:00
build/src/%.o : src /%.cc | mkldnn
2016-01-07 22:52:33 -08:00
@mkdir -p $( @D)
2017-01-01 07:37:40 +08:00
$( CXX) -std= c++11 -c $( CFLAGS) -MMD -c $< -o $@
2016-01-07 22:52:33 -08:00
2018-06-28 01:32:53 +08:00
build/src/%_gpu.o : src /%.cu | mkldnn
2016-01-07 22:52:33 -08:00
@mkdir -p $( @D)
2018-12-14 20:54:51 +01:00
$( NVCC) $( NVCCFLAGS) $( CUDA_ARCH) -Xcompiler " $( CFLAGS) " --generate-dependencies -MT build/src/$* _gpu.o $< >build/src/$* _gpu.d
2016-12-07 15:49:40 +08:00
$( NVCC) -c -o $@ $( NVCCFLAGS) $( CUDA_ARCH) -Xcompiler " $( CFLAGS) " $<
2016-01-07 22:52:33 -08:00
2016-01-12 21:22:09 -08:00
# A nvcc bug cause it to generate "generic/xxx.h" dependencies from torch headers.
# Use CXX to generate dependency instead.
2016-01-07 22:52:33 -08:00
build/plugin/%_gpu.o : plugin /%.cu
2015-09-07 18:12:23 -04:00
@mkdir -p $( @D)
2016-07-08 14:07:45 -07:00
$( CXX) -std= c++11 $( CFLAGS) -MM -MT build/plugin/$* _gpu.o $< >build/plugin/$* _gpu.d
2016-12-07 15:49:40 +08:00
$( NVCC) -c -o $@ $( NVCCFLAGS) $( CUDA_ARCH) -Xcompiler " $( CFLAGS) " $<
2015-06-14 17:36:33 -07:00
2019-03-01 16:26:21 -08:00
build/plugin/%.o : plugin /%.cc | mkldnn
2015-12-16 23:38:36 -08:00
@mkdir -p $( @D)
2017-01-01 07:37:40 +08:00
$( CXX) -std= c++11 -c $( CFLAGS) -MMD -c $< -o $@
2015-12-16 23:38:36 -08:00
2016-08-10 18:33:41 -07:00
%_gpu.o : %.cu
2015-12-16 23:38:36 -08:00
@mkdir -p $( @D)
2018-12-14 20:54:51 +01:00
$( NVCC) $( NVCCFLAGS) $( CUDA_ARCH) -Xcompiler " $( CFLAGS) -Isrc/operator " --generate-dependencies -MT $* _gpu.o $< >$* _gpu.d
2016-12-07 15:49:40 +08:00
$( NVCC) -c -o $@ $( NVCCFLAGS) $( CUDA_ARCH) -Xcompiler " $( CFLAGS) -Isrc/operator " $<
2015-12-16 23:38:36 -08:00
2017-08-02 16:19:41 -07:00
%.o : %.cc $( CORE_INC )
2016-08-10 18:33:41 -07:00
@mkdir -p $( @D)
2017-01-01 07:37:40 +08:00
$( CXX) -std= c++11 -c $( CFLAGS) -MMD -Isrc/operator -c $< -o $@
2016-08-10 18:33:41 -07:00
2018-12-12 20:55:24 -08:00
# Set install path for libmxnet.so on Mac OS
i f e q ( $( UNAME_S ) , D a r w i n )
LDFLAGS += -Wl,-install_name,@rpath/libmxnet.so
e n d i f
2016-01-08 08:09:11 -08:00
# NOTE: to statically link libmxnet.a we need the option
# --Wl,--whole-archive -lmxnet --Wl,--no-whole-archive
2016-09-01 21:17:33 -07:00
lib/libmxnet.a : $( ALLX_DEP )
2015-10-08 23:37:04 -04:00
@mkdir -p $( @D)
2015-09-07 18:12:23 -04:00
ar crv $@ $( filter %.o, $? )
2015-06-14 17:36:33 -07:00
2016-09-01 21:17:33 -07:00
lib/libmxnet.so : $( ALLX_DEP )
2017-08-29 17:14:01 -07:00
@mkdir -p $( @D)
$( CXX) $( CFLAGS) -shared -o $@ $( filter-out %libnnvm.a, $( filter %.o %.a, $^) ) $( LDFLAGS) \
-Wl,${ WHOLE_ARCH } $( filter %libnnvm.a, $^) -Wl,${ NO_WHOLE_ARCH }
2018-03-14 19:20:47 -07:00
i f e q ( $( USE_MKLDNN ) , 1 )
i f e q ( $( UNAME_S ) , D a r w i n )
2018-03-27 13:46:36 -07:00
i n s t a l l _ n a m e _ t o o l - c h a n g e '@rpath/libmklml.dylib' '@loader_path/libmklml.dylib' $@
i n s t a l l _ n a m e _ t o o l - c h a n g e '@rpath/libiomp5.dylib' '@loader_path/libiomp5.dylib' $@
i n s t a l l _ n a m e _ t o o l - c h a n g e '@rpath/libmkldnn.0.dylib' '@loader_path/libmkldnn.0.dylib' $@
2018-03-14 19:20:47 -07:00
e n d i f
e n d i f
2015-06-14 17:36:33 -07:00
2016-07-31 15:57:20 -07:00
$(PS_PATH)/build/libps.a : PSLITE
PSLITE :
2018-06-08 03:12:30 +02:00
$( MAKE) CXX = " $( CXX) " DEPS_PATH = " $( DEPS_PATH) " -C $( PS_PATH) ps
2015-10-02 22:22:22 -04:00
2016-07-31 15:57:20 -07:00
$(DMLC_CORE)/libdmlc.a : DMLCCORE
DMLCCORE :
2017-02-11 23:12:15 -08:00
+ cd $( DMLC_CORE) ; $( MAKE) libdmlc.a USE_SSE = $( USE_SSE) config = $( ROOTDIR) /$( config) ; cd $( ROOTDIR)
2015-06-27 14:57:11 -06:00
2017-05-24 12:09:30 -07:00
NNVM_INC = $( wildcard $( NNVM_PATH) /include/*/*.h)
NNVM_SRC = $( wildcard $( NNVM_PATH) /src/*/*/*.cc $( NNVM_PATH) /src/*/*.cc $( NNVM_PATH) /src/*.cc)
$(NNVM_PATH)/lib/libnnvm.a : $( NNVM_INC ) $( NNVM_SRC )
2017-02-11 23:12:15 -08:00
+ cd $( NNVM_PATH) ; $( MAKE) lib/libnnvm.a DMLC_CORE_PATH = $( DMLC_CORE) ; cd $( ROOTDIR)
2016-09-01 21:17:33 -07:00
bin/im2rec : tools /im 2rec .cc $( ALLX_DEP )
2015-09-21 01:55:32 +08:00
$(BIN) :
2015-10-08 23:37:04 -04:00
@mkdir -p $( @D)
2016-07-08 14:07:45 -07:00
$( CXX) $( CFLAGS) -std= c++11 -o $@ $( filter %.cpp %.o %.c %.a %.cc, $^) $( LDFLAGS)
2015-09-21 01:55:32 +08:00
2017-03-30 20:13:36 -07:00
# CPP Package
i f e q ( $( USE_CPP_PACKAGE ) , 1 )
i n c l u d e c p p - p a c k a g e / c p p - p a c k a g e . m k
e n d i f
2018-06-28 01:32:53 +08:00
i n c l u d e m k l d n n . m k
2015-09-12 16:49:36 -07:00
i n c l u d e t e s t s / c p p / u n i t t e s t . m k
2015-06-14 17:36:33 -07:00
2017-03-30 20:13:36 -07:00
extra-packages : $( EXTRA_PACKAGES )
2015-09-23 20:26:29 +00:00
test : $( TEST )
2015-06-14 17:36:33 -07:00
2017-03-09 23:25:01 -08:00
lint : cpplint rcpplint jnilint pylint
cpplint :
2018-03-25 19:45:24 -07:00
3rdparty/dmlc-core/scripts/lint.py mxnet cpp include src plugin cpp-package tests \
2017-05-03 09:40:17 +02:00
--exclude_path src/operator/contrib/ctc_include
2017-03-09 23:25:01 -08:00
pylint :
2018-08-13 23:10:37 +02:00
pylint --rcfile= $( ROOTDIR) /ci/other/pylintrc --ignore-patterns= " .*\.so $$ ,.*\.dll $$ ,.*\.dylib $$ " python/mxnet tools/caffe_converter/*.py
2015-07-03 17:06:23 -06:00
2017-05-07 22:19:25 -07:00
doc : docs
docs :
2018-03-09 23:33:10 +01:00
make -C docs html
2017-05-07 22:19:25 -07:00
clean_docs :
make -C docs clean
2015-10-08 22:06:04 -04:00
2015-08-21 23:49:07 -06:00
doxygen :
2016-05-07 20:56:04 -07:00
doxygen docs/Doxyfile
2015-07-03 17:06:23 -06:00
2016-09-07 16:08:55 -07:00
# Cython build
2016-09-08 19:10:58 -07:00
cython :
2017-05-23 09:04:37 -07:00
cd python; python setup.py build_ext --inplace --with-cython
2016-09-08 19:10:58 -07:00
2016-09-07 16:08:55 -07:00
cython2 :
2017-05-23 09:04:37 -07:00
cd python; python2 setup.py build_ext --inplace --with-cython
2016-09-07 16:08:55 -07:00
cython3 :
2017-05-23 09:04:37 -07:00
cd python; python3 setup.py build_ext --inplace --with-cython
2016-09-07 16:08:55 -07:00
cyclean :
rm -rf python/mxnet/*/*.so python/mxnet/*/*.cpp
2015-10-15 21:52:22 -07:00
# R related shortcuts
rcpplint :
2018-03-25 19:45:24 -07:00
3rdparty/dmlc-core/scripts/lint.py mxnet-rcpp ${ LINT_LANG } R-package/src
2015-10-15 21:52:22 -07:00
2016-09-30 17:48:29 -04:00
rpkg :
2015-11-04 11:29:47 -05:00
mkdir -p R-package/inst/libs
2017-08-09 06:44:58 +00:00
cp src/io/image_recordio.h R-package/src
2015-11-04 11:29:47 -05:00
cp -rf lib/libmxnet.so R-package/inst/libs
2019-01-30 22:25:29 -08:00
if [ -e "lib/libmkldnn.so.0" ] ; then \
cp -rf lib/libmkldnn.so.0 R-package/inst/libs; \
cp -rf lib/libiomp5.so R-package/inst/libs; \
cp -rf lib/libmklml_intel.so R-package/inst/libs; \
fi
2015-11-04 11:29:47 -05:00
mkdir -p R-package/inst/include
2019-02-15 15:23:01 -05:00
cp -rl include/* R-package/inst/include
2017-06-28 16:01:23 -07:00
Rscript -e "if(!require(devtools)){install.packages('devtools', repo = 'https://cloud.r-project.org/')}"
2019-01-21 20:01:17 +01:00
Rscript -e "if(!require(roxygen2)||packageVersion('roxygen2') < '6.1.1'){install.packages('roxygen2', repo = 'https://cloud.r-project.org/')}"
2017-06-28 16:01:23 -07:00
Rscript -e "library(devtools); library(methods); options(repos=c(CRAN='https://cloud.r-project.org/')); install_deps(pkg='R-package', dependencies = TRUE)"
2018-11-01 23:59:00 +01:00
cp R-package/dummy.NAMESPACE R-package/NAMESPACE
echo "import(Rcpp)" >> R-package/NAMESPACE
2016-09-30 17:48:29 -04:00
R CMD INSTALL R-package
2018-11-01 23:59:00 +01:00
Rscript -e "require(mxnet); mxnet:::mxnet.export('R-package'); warnings()"
rm R-package/NAMESPACE
2019-02-15 15:23:01 -05:00
Rscript -e "devtools::document('R-package');warnings()"
2017-08-31 15:47:13 -04:00
R CMD INSTALL R-package
2015-11-04 11:29:47 -05:00
2017-06-28 16:01:23 -07:00
rpkgtest :
2018-09-13 07:42:37 -07:00
Rscript -e 'require(testthat);res<-test_dir("R-package/tests/testthat");if(!testthat:::all_passed(res)){stop("Test failures", call. = FALSE)}'
2018-11-16 21:29:07 -08:00
Rscript -e 'res<-covr:::package_coverage("R-package");fileConn<-file(paste("r-package_coverage_",toString(runif(1)),".json"));writeLines(covr:::to_codecov(res), fileConn);close(fileConn)'
2017-06-28 16:01:23 -07:00
2017-11-02 00:23:23 +08:00
scalaclean :
2019-01-08 17:25:53 -08:00
( cd $( ROOTDIR) /scala-package && mvn clean)
2018-12-11 15:19:06 -08:00
2016-02-21 14:12:16 +08:00
scalapkg :
2019-01-08 17:25:53 -08:00
( cd $( ROOTDIR) /scala-package && mvn install -DskipTests)
scalainstall :
( cd $( ROOTDIR) /scala-package && mvn install)
2016-02-21 14:12:16 +08:00
2018-07-11 22:19:09 -07:00
scalaunittest :
2019-01-08 17:25:53 -08:00
( cd $( ROOTDIR) /scala-package && mvn install)
2018-07-11 22:19:09 -07:00
scalaintegrationtest :
2019-01-08 17:25:53 -08:00
( cd $( ROOTDIR) /scala-package && mvn integration-test -DskipTests= false )
2018-12-11 15:19:06 -08:00
2016-03-03 23:42:18 +08:00
jnilint :
2019-01-08 17:25:53 -08:00
3rdparty/dmlc-core/scripts/lint.py mxnet-jnicpp cpp scala-package/native/src --exclude_path scala-package/native/src/main/native/org_apache_mxnet_native_c_api.h
2016-03-03 23:42:18 +08:00
2018-11-01 23:59:00 +01:00
rclean :
$( RM) -r R-package/src/image_recordio.h R-package/NAMESPACE R-package/man R-package/R/mxnet_generated.R \
2017-01-04 09:12:49 -08:00
R-package/inst R-package/src/*.o R-package/src/*.so mxnet_*.tar.gz
2018-11-01 23:59:00 +01:00
i f n e q ( $( EXTRA_OPERATORS ) , )
clean : rclean cyclean $( EXTRA_PACKAGES_CLEAN )
2018-12-14 20:54:51 +01:00
$( RM) -r build lib bin deps *~ */*~ */*/*~ */*/*/*~
2019-03-04 13:26:21 -08:00
( cd scala-package && mvn clean) || true
2017-02-11 23:12:15 -08:00
cd $( DMLC_CORE) ; $( MAKE) clean; cd -
cd $( PS_PATH) ; $( MAKE) clean; cd -
cd $( NNVM_PATH) ; $( MAKE) clean; cd -
2017-08-12 21:12:44 +02:00
cd $( AMALGAMATION_PATH) ; $( MAKE) clean; cd -
2016-11-07 15:10:50 -06:00
$( RM) -r $( patsubst %, %/*.d, $( EXTRA_OPERATORS) ) $( patsubst %, %/*/*.d, $( EXTRA_OPERATORS) )
$( RM) -r $( patsubst %, %/*.o, $( EXTRA_OPERATORS) ) $( patsubst %, %/*/*.o, $( EXTRA_OPERATORS) )
2015-12-28 23:13:08 -08:00
e l s e
2018-11-01 23:59:00 +01:00
clean : rclean mkldnn_clean cyclean testclean $( EXTRA_PACKAGES_CLEAN )
$( RM) -r build lib bin *~ */*~ */*/*~ */*/*/*~
2019-03-04 13:26:21 -08:00
( cd scala-package && mvn clean) || true
2017-02-11 23:12:15 -08:00
cd $( DMLC_CORE) ; $( MAKE) clean; cd -
cd $( PS_PATH) ; $( MAKE) clean; cd -
cd $( NNVM_PATH) ; $( MAKE) clean; cd -
2017-08-12 21:12:44 +02:00
cd $( AMALGAMATION_PATH) ; $( MAKE) clean; cd -
2015-12-28 23:13:08 -08:00
e n d i f
2015-09-07 18:12:23 -04:00
2015-12-29 22:16:18 -05:00
clean_all : clean
2015-09-07 18:12:23 -04:00
- i n c l u d e b u i l d / * . d
- i n c l u d e b u i l d / * / * . d
2016-01-09 02:11:39 -08:00
- i n c l u d e b u i l d / * / * / * . d
2016-09-10 23:41:04 -05:00
- i n c l u d e b u i l d / * / * / * / * . d
2015-12-23 15:07:58 -08:00
i f n e q ( $( EXTRA_OPERATORS ) , )
2016-11-07 15:10:50 -06:00
- i n c l u d e $( patsubst %, %/*.d , $ ( EXTRA_OPERATORS ) ) $( patsubst %, %/*/*.d , $ ( EXTRA_OPERATORS ) )
2015-12-23 15:07:58 -08:00
e n d i f