forked from microsoft/CNTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·1247 lines (1147 loc) · 34.4 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
#
configure=$0
build_top=$PWD
cuda_path=
cuda_check=include/cuda.h
enable_cuda=
enable_python=
enable_java=
# NCCL communication library
have_nccl=no
nccl_path=
nccl_check=include/nccl.h
# CNTK Custom MKL Version
cntk_custom_mkl_version=3
have_mkl=no
mkl_path=
mkl_check=$cntk_custom_mkl_version/include/mkl.h
# Experimental OpenBLAS support.
have_openblas=no
openblas_path=
openblas_check=include/openblas_config.h
# Boost library
boost_path=
boost_check=include/boost/test/unit_test.hpp
# Protocol buffers library
protobuf_path=
protobuf_check=lib/libprotobuf.a
# MPI library
mpi_path=
mpi_check=include/mpi.h
# Cuda-aware MPI
# OPENMPI can auto-detect but not MVAPICH2
cuda_gdr=no
default_cuda_gdr=$cuda_gdr
have_kaldi=no
kaldi_path=
kaldi_check=src/kaldi.mk
have_buildtype=no
buildtype=
default_buildtype=release
have_gdk_include=no
gdk_include_path=
gdk_include_check=nvml.h
have_gdk_nvml_lib=no
gdk_nvml_lib_path=
gdk_nvml_lib_check=libnvidia-ml.so
have_cub=no
cub_path=
cub_check=cub/cub.cuh
have_cudnn=no
cudnn_path=
cudnn_check=cuda/include/cudnn.h
have_opencv=no
opencv_path=
opencv_check=include/opencv2/opencv.hpp
have_libzip=no
libzip_path=
libzip_check=include/zip.h
have_swig=no
swig_path=
swig_check=bin/swig
swig_required_version=3.0.10
py_check=bin/python
py_versions=
declare -A py_paths
jdk_check=include/jni.h
default_jdk="jvm/java-7-openjdk-amd64"
mathlib=
have_mpi=yes
default_use_mpi=$have_mpi
default_use_1bitsgd=no
enable_1bitsgd=$default_use_1bitsgd
default_use_code_coverage=no
enable_code_coverage=$default_use_code_coverage
default_use_asgd=yes
enable_asgd=$default_use_asgd
# List from best to worst choice
default_path_list="/usr /usr/local /opt /opt/local /lib /usr/lib"
# List from best to worst choice
default_mkls="CNTKCustomMKL"
default_openblas=""
default_boost="boost-1.60.0"
default_cudas="cuda-8.0 cuda-7.5"
default_nccls="nccl"
default_kaldis="kaldi-trunk kaldi-c024e8aa"
default_gdk_includes="include/nvidia/gdk"
default_gdk_nvml_libs="src/gdk/nvml/lib"
default_cubs="cub-1.4.1"
default_cudnns="cudnn-6.0 cudnn-5.1 cudnn-5.0"
default_opencvs="opencv-3.1.0 opencv-3.0.0"
default_protobuf="protobuf-3.1.0"
default_libzips="libzip-1.1.2"
default_swig="swig-3.0.10"
default_mpi="mpi"
function default_paths ()
{
echo $build_top $HOME $default_path_list
}
# $1 is directory
# $2 is file that must be present
function check_dir ()
{
if test -e $1/$2
then
echo yes
else
echo no
fi
}
# $1 is the list of tails to search, ordered by preference
# $2 is some file that must exist in $1
function find_dir ()
{
# Loop over list of tails to search, including empty (just default_path + search file)
for tail in $1 ''
do
for head in $(default_paths)
do
[ -n "$tail" ] && search_path="$head/$tail" || search_path=$head
if test x$(check_dir "$search_path" $2) = xyes
then
echo $search_path
return 0
fi
done
done
}
function find_mkl ()
{
find_dir "$default_mkls" "$mkl_check"
}
function find_openblas ()
{
find_dir "$default_openblas" "$openblas_check"
}
function find_boost ()
{
find_dir "$default_boost" "$boost_check"
}
function find_protobuf ()
{
find_dir "$default_protobuf" "$protobuf_check"
}
function find_nccl ()
{
find_dir "$default_nccls" "$nccl_check"
}
function find_cuda ()
{
find_dir "$default_cudas" "$cuda_check"
}
function find_kaldi ()
{
find_dir "$default_kaldis" "$kaldi_check"
}
function find_gdk_include ()
{
find_dir "$default_gdk_includes" "$gdk_include_check"
}
function find_gdk_nvml_lib ()
{
find_dir "$default_gdk_nvml_libs" "$gdk_nvml_lib_check"
}
function find_cub ()
{
find_dir "$default_cubs" "$cub_check"
}
function find_cudnn ()
{
find_dir "$default_cudnns" "$cudnn_check"
}
function find_opencv ()
{
find_dir "$default_opencvs" "$opencv_check"
}
function find_libzip ()
{
find_dir "$default_libzips" "$libzip_check"
}
function find_mpi ()
{
find_dir "$default_mpi" "$mpi_check"
}
function is_hardlinked ()
{
r=no
if test -e $1 && test -e $2
then
r=yes
[ "`stat -c '%i' $1`" != "`stat -c '%i' $2`" ] && r=no
fi
echo $r
}
function check_version ()
{
local expected_version=$1
local actual_version=$2
[ -z "$actual_version" ] && return 1
[ "$( printf "%s\n" $actual_version $expected_version | sort -V | head -1)" = "$expected_version" ]
return $?
}
function default_use_cuda ()
{
if test x$(find_cuda) = x || test x$(find_gdk_include) = x || test x$(find_gdk_nvml_lib) = x || test x$(find_cudnn) = x || test x$(find_cub) = x
then
echo no
else
echo yes
fi
}
enable_cuda=$(default_use_cuda)
# TODO allow to pick up from path?
function check_swig ()
{
local swig_dir="$1"
local swig_bin="$swig_dir/$swig_check"
# Check that binary is executable and we can retrieve the version
test -x "$swig_bin" || return $?
"$swig_bin" -version 2>&1 1>/dev/null || return $?
local actual_version=$("$swig_bin" -version | grep '^SWIG Version ' | head -1 | grep -o '[0-9.]*')
if check_version "$swig_required_version" "$actual_version"
then
echo "$swig_dir"
return 0
else
return 1
fi
}
function find_swig ()
{
check_swig "$(find_dir "$default_swig" "$swig_check")"
}
function check_python ()
{
# Required version: exact match against major and minor version
local required_version="$1"
local py_dir="$2"
local py_bin="$py_dir/$py_check"
[ -x "$py_bin" ] || return 1
local py_version=$("$py_bin" -c "import sys; sys.stdout.write('{0}{1}'.format(sys.version_info.major,sys.version_info.minor))")
[ "$?" = "0" ] && [ -x "$py_bin" ] && [ "$py_version" = "$required_version" ] && {
echo $py_dir
return 0
}
return 1
}
# TODO allow to pick up from path?
function find_python ()
{
local required_version="$1"
local py_dir=$(find_dir "" "$py_check")
check_python "$required_version" "$py_dir"
}
function default_use_python ()
{
# Keeping it default "no" for a little while:
# if test x$(find_swig) = x || test x$(find_python 27)$(find_python 34)$(find_python 35)$(find_python 36) = x
# then
echo no
# else
# echo yes
# fi
}
enable_python=$(default_use_python)
function find_jdk ()
{
echo $(find_dir $default_jdk "$jdk_check")
}
function default_use_java ()
{
jdk_path=$(find_jdk)
if test x$jdk_path = x
then
echo no
else
echo yes
fi
}
enable_java=$(default_use_java)
function show_default ()
{
if test x$1 = x
then
echo "(no default)"
else
echo "(default $1)"
fi
}
function show_help ()
{
echo "Usage: configure [options]"
echo "Options:"
echo " -h|--help this help"
echo " --with-build-top=directory build directory $(show_default $build_top)"
echo " --add directory add directory to library search path"
echo " --1bitsgd[=(yes|no)] use 1Bit SGD $(show_default ${default_use_1bitsgd})"
echo " --asgd[=(yes|no)] use ASGD powered by Multiverso $(show_default $(default_use_asgd))"
echo " --cuda[=(yes|no)] use cuda GPU $(show_default $(default_use_cuda))"
echo " --python[=(yes|no)] with Python bindings $(show_default $(default_use_python))"
echo " --java[=(yes|no)] with Java bindings $(show_default $(default_use_java))"
echo " --with-jdk[=directory] $(show_default $(find_jdk))"
echo " --mpi[=(yes|no)] use MPI communication $(show_default ${default_use_mpi})"
echo " --gdr[=(yes|no)] use GPUDirect RDMA $(show_default ${default_cuda_gdr})"
echo " --with-cuda[=directory] $(show_default $(find_cuda))"
echo " --with-cub[=directory] $(show_default $(find_cub))"
echo " --with-gdk-include[=directory] $(show_default $(find_gdk_include))"
echo " --with-gdk-nvml-lib[=directory] $(show_default $(find_gdk_nvml_lib))"
echo " --with-cudnn[=directory] $(show_default $(find_cudnn))"
echo " --with-nccl[=directory] $(show_default $(find_nccl))"
echo " --with-mkl[=directory] $(show_default $(find_mkl))"
echo " --with-mkl-sequential[=directory] $(show_default $(find_mkl))"
echo " --with-openblas[=directory] (experimental) $(show_default $(find_openblas))"
echo " --with-buildtype=(debug|release) $(show_default $default_buildtype)"
echo " --with-kaldi[=directory] $(show_default $(find_kaldi))"
echo " --with-opencv[=directory] $(show_default $(find_opencv))"
echo " --with-libzip[=directory] $(show_default $(find_libzip))"
echo " --with-code-coverage[=(yes|no)] $(show_default ${default_use_code_coverage})"
echo " --with-boost[=directory] $(show_default $(find_boost))"
echo " --with-protobuf[=directory] $(show_default $(find_protobuf))"
echo " --with-py-versions=(space-separated list of 27, 34, 35, 36)"
echo " --with-py27-path[=directory] $(show_default $(find_python 27))"
echo " --with-py34-path[=directory] $(show_default $(find_python 34))"
echo " --with-py35-path[=directory] $(show_default $(find_python 35))"
echo " --with-py36-path[=directory] $(show_default $(find_python 36))"
echo " --with-swig[=directory] $(show_default $(find_swig))"
echo " --with-mpi[=directory] $(show_default $(find_mpi))"
echo "Libraries search path:"
for head in $(default_paths)
do
echo " $head"
done
}
while [[ $# > 0 ]]
do
key="$1"
case $key in
*=?*) optarg=`expr "X$key" : '[^=]*=\(.*\)'` ;;
*=) optarg= ;;
*) optarg= ;;
esac
case $key in
-h|--help)
show_help
exit 1
;;
--with-build-top*)
if test x$optarg != x
then
build_top=$optarg
mkdir -p $build_top
fi
;;
--add*)
if test x$optarg = x
then
shift ; optarg=$1
fi
default_path_list="$optarg $default_path_list"
;;
--1bitsgd*)
if test x$optarg = xyes || test x$optarg = xno
then
enable_1bitsgd=$optarg
else
echo "Invalid value for --1bitsgd $optarg"
show_help
exit
fi
;;
--with-code-coverage*)
if test x$optarg = xyes || test x$optarg = xno
then
enable_code_coverage=$optarg
else
echo "Invalid value for --with-code-coverage $optarg"
show_help
exit
fi
;;
--asgd*)
if test x$optarg = xyes || test x$optarg = xno
then
enable_asgd=$optarg
else
echo "Invalid value for --asgd $optarg"
show_help
exit
fi
;;
--cuda*)
if test x$optarg = xyes || test x$optarg = xno
then
enable_cuda=$optarg
else
echo "Invalid value for --cuda $optarg"
show_help
exit
fi
;;
--python*)
if test x$optarg = xyes || test x$optarg = xno
then
enable_python=$optarg
else
echo "Invalid value for --python $optarg"
show_help
exit
fi
;;
--with-py-versions*)
enable_python=yes
if test "x$optarg" = "x"
then
echo "Mandatory parameter for --with-py-versions missing. Use '--python no' to disable Python support completely."
show_help
exit 1
else
for ver in $optarg
do
case $ver in
27 | 34 | 35 | 36)
;;
*)
echo "Invalid value for --with-py-versions $optarg: invalid version $ver"
show_help
exit
esac
done
# TODO filter duplicates?
py_versions="$optarg"
fi
;;
--with-py27-path*|--with-py34-path*|--with-py35-path*|--with-py36-path*)
enable_python=yes
py_version=${key:9:2}
if test x$optarg = x
then
py_paths[$py_version]=$(find_python $py_version)
if test x${py_paths[$py_version]} = x
then
echo "Cannot find Python $py_version directory."
echo "Please specify a value for $key"
exit 1
fi
else
if check_python $py_version "$optarg"
then
py_paths[$py_version]=$optarg
else
echo "Invalid Python $py_version directory $optarg"
exit 1
fi
fi
;;
--with-swig*)
have_swig=yes
if test x$optarg = x
then
swig_path=$(find_swig)
if test x$swig_path = x
then
echo "Cannot find SWIG directory."
echo "Please specify a value for --with-swig"
exit 1
fi
else
if check_swig "$optarg"
then
swig_path=$optarg
else
echo "Invalid SWIG directory $optarg"
exit 1
fi
fi
;;
--java*)
if test x$optarg = xyes || test x$optarg = xno
then
enable_java=$optarg
else
echo "Invalid value for --java $optarg"
show_help
exit
fi
;;
--with-jdk*)
enable_java=yes
if test x$optarg = x
then
jdk_path=$(find_jdk)
if test x$jdk_path = x
then
echo "Cannot find JDK directory."
echo "Please specify a value for --with-jdk"
exit 1
fi
else
if test $(check_dir $optarg $jdk_check) = yes
then
jdk_path=$optarg
else
echo "Invalid JDK directory $optarg"
exit 1
fi
fi
;;
--mpi*)
if test x$optarg = xyes || test x$optarg = xno
then
have_mpi=$optarg
else
echo "Invalid value for --mpi $optarg"
show_help
exit
fi
;;
--gdr*)
if test x$optarg = xyes || test x$optarg = xno
then
cuda_gdr=$optarg
else
echo "Invalid value for --gdr $optarg"
show_help
exit
fi
;;
--with-cuda*)
enable_cuda=yes
if test x$optarg = x
then
cuda_path=$(find_cuda)
if test x$cuda_path = x
then
echo "Cannot find cuda directory."
echo "Please specify a value for --with-cuda"
exit 1
fi
else
if test $(check_dir $optarg $cuda_check) = yes
then
cuda_path=$optarg
else
echo "Invalid cuda directory $optarg"
exit 1
fi
fi
;;
--with-cub*)
have_cub=yes
if test x$optarg = x
then
cub_path=$(find_cub)
if test x$cub_path = x
then
echo "Cannot find NVIDIA CUB directory."
echo "Please specify a value for --with-cub"
echo "NVIDIA CUB can be downloaded from https://github.com/NVlabs/cub/archive/1.4.1.zip, extract the archive to /usr/local"
exit 1
fi
else
if test $(check_dir $optarg $cub_check) = yes
then
cub_path=$optarg
else
echo "Invalid CUB directory $optarg"
exit 1
fi
fi
;;
--with-gdk-include*)
have_gdk_include=yes
if test x$optarg = x
then
gdk_include_path=$(find_gdk_include)
if test x$gdk_include_path = x
then
echo "Cannot find GDK include directory."
echo "Please specify a value for --with-gdk-include"
exit 1
fi
else
if test $(check_dir $optarg $gdk_include_check) = yes
then
gdk_include_path=$optarg
else
echo "Invalid GDK include directory $optarg"
exit 1
fi
fi
;;
--with-gdk-nvml-lib*)
have_gdk_nvml_lib=yes
if test x$optarg = x
then
gdk_nvml_lib_path=$(find_gdk_nvml_lib)
if test x$gdk_nvml_lib_path = x
then
echo "Cannot find GDK NVML library directory."
echo "Please specify a value for --with-gdk-nvml-lib"
exit 1
fi
else
if test $(check_dir $optarg $gdk_nvml_lib_check) = yes
then
gdk_nvml_lib_path=$optarg
else
echo "Invalid GDK NVML library directory $optarg"
exit 1
fi
fi
;;
--with-cudnn*)
have_cudnn=yes
if test x$optarg = x
then
cudnn_path=$(find_cudnn)
if test x$cudnn_path = x
then
echo "Cannot find NVIDIA cuDNN directory."
echo "Please specify a value for --with-cudnn"
exit 1
fi
else
if test $(check_dir $optarg $cudnn_check) = yes
then
cudnn_path=$optarg
else
echo "Invalid cuDNN directory $optarg"
exit 1
fi
fi
;;
--with-nccl*)
have_nccl=yes
if test x$optarg = x
then
nccl_path=$(find_nccl)
if test x$nccl_path = x
then
echo "Cannot find NCCL directory."
echo "Please specify a value for --with-nccl"
echo "NCCL can be downloaded from https://github.com/NVIDIA/nccl"
exit 1
fi
else
if test $(check_dir $optarg $nccl_check) = yes
then
nccl_path=$optarg
else
echo "Invalid NCCL directory $optarg"
exit 1
fi
fi
;;
--with-mkl*)
have_mkl=yes
mathlib=mkl
mkl_threading=parallel
case $key in
--with-mkl-sequential*) mkl_threading=sequential ;;
esac
if test x$optarg = x
then
mkl_path=$(find_mkl)
if test x$mkl_path = x
then
echo "Cannot find CNTK custom MKL directory (version $cntk_custom_mkl_version)"
echo "Please specify a value for --with-mkl"
exit 1
fi
else
if test $(check_dir $optarg $mkl_check) = yes
then
mkl_path=$optarg
else
echo "Invalid CNTK custom MKL directory $optarg"
exit 1
fi
fi
;;
--with-openblas*)
have_openblas=yes
mathlib=openblas
if test x$optarg = x
then
openblas_path=$(find_openblas)
if test x$openblas_path = x
then
echo "Cannot find openblas directory"
echo "Please specify a value for --with-openblas"
exit 1
fi
else
if test $(check_dir $optarg $openblas_check) = yes
then
openblas_path=$optarg
else
echo "Invalid openblas directory $optarg"
exit 1
fi
fi
;;
--with-boost*)
if test x$optarg = x
then
boost_path=$(find_boost)
if test x$boost_path = x
then
echo "Cannot find Boost directory"
echo "Please specify a value for --with-boost"
exit 1
fi
else
if test $(check_dir $optarg $boost_check) = yes
then
boost_path=$optarg
else
echo "Invalid Boost directory $optarg"
exit 1
fi
fi
;;
--with-protobuf*)
if test x$optarg = x
then
protobuf_path=$(find_protobuf)
if test x$protobuf_path = x
then
echo "Cannot find Protocol Buffers directory"
echo "Please specify a value for --with-protobuf"
exit 1
fi
else
if test $(check_dir $optarg $protobuf_check) = yes
then
protobuf_path=$optarg
else
echo "Invalid Protocol Buffers directory $optarg"
exit 1
fi
fi
;;
--with-buildtype*)
have_buildtype=yes
case $optarg in
debug|release)
buildtype=$optarg
;;
*)
echo Invalid buildtype $optarg
echo Must be debug or release
exit 1
esac
;;
--with-kaldi*)
have_kaldi=yes
if test x$optarg = x
then
kaldi_path=$(find_kaldi)
if test x$kaldi_path = x
then
echo "Cannot find kaldi directory"
echo "Please specify a value for --with-kaldi"
exit 1
fi
else
if test $(check_dir $optarg $kaldi_check)
then
kaldi_path=$optarg
else
echo "Invalid kaldi directory $optarg"
exit 1
fi
fi
;;
--with-opencv*)
have_opencv=yes
if test x$optarg = x
then
opencv_path=$(find_opencv)
if test x$opencv_path = x
then
echo "Cannot find OpenCV directory."
echo "Please specify a value for --with-opencv"
echo "OpenCV can be downloaded from http://opencv.org/downloads.html, install instructions http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation"
exit 1
fi
else
if test $(check_dir $optarg $opencv_check) = yes
then
opencv_path=$optarg
else
echo "Invalid OpenCV directory $optarg"
exit 1
fi
fi
;;
--with-libzip*)
have_libzip=yes
if test x$optarg = x
then
libzip_path=$(find_libzip)
if test x$libzip_path = x
then
echo "Cannot find libzip directory."
echo "Please specify a value for --with-libzip"
echo "libzip (v.1.1.2 or higher) can be downloaded from http://www.nih.at/libzip/"
exit 1
fi
else
if test $(check_dir $optarg $libzip_check) = yes
then
libzip_path=$optarg
else
echo "Invalid libzip directory $optarg"
exit 1
fi
fi
;;
--with-mpi*)
if test x$optarg = x
then
mpi_path=$(find_mpi)
if test x$mpi_path = x
then
echo "Cannot find mpi directory."
exit 1
fi
else
if test $(check_dir $optarg $mpi_check) = yes
then
mpi_path=$optarg
else
echo "Invalid mpi directory $optarg"
exit 1
fi
fi
;;
*)
echo Invalid option $key
show_help
exit 1
esac
shift
done
if test x$buildtype = x
then
buildtype=$default_buildtype
echo Defaulting to --with-buildtype=release
fi
# If no math library was specified, search for mkl
if test x$have_mkl = xno && test x$have_openblas = xno
then
mkl_path=$(find_mkl)
if test x$mkl_path = x
then
echo "Cannot find a CPU math library."
echo "Please specify --with-mkl, --with-mkl-sequential, --with-openblas with a path."
exit 1
else
mathlib=mkl
fi
fi
# If no cuda library specified, search for one
if test x$enable_cuda = xyes && test x$cuda_path = x
then
cuda_path=$(find_cuda)
if test x$cuda_path = x ; then
echo Cannot locate a cuda directory
echo GPU will be disabled
enable_cuda=no
else
echo Found cuda at $cuda_path
fi
fi
if test $enable_cuda = yes && test x$gdk_include_path = x
then
gdk_include_path=$(find_gdk_include)
if test x$gdk_include_path = x ; then
echo Cannot locate a GDK include directory
echo GPU will be disabled
enable_cuda=no
else
echo Found GDK include at $gdk_include_path
fi
fi
if test $enable_cuda = yes && test x$gdk_nvml_lib_path = x
then
gdk_nvml_lib_path=$(find_gdk_nvml_lib)
if test x$gdk_nvml_lib_path = x ; then
echo Cannot locate a GDK NVML library directory
echo GPU will be disabled
enable_cuda=no
else
echo Found GDK NVML library at $gdk_nvml_lib_path
fi
fi
if test $enable_cuda = yes && test x$cub_path = x
then
cub_path=$(find_cub)
if test x$cub_path = x ; then
echo Cannot locate NVIDIA CUB directory
echo GPU will be disabled
echo NVIDIA CUB can be downloaded from https://github.com/NVlabs/cub/archive/1.4.1.zip, extract the archive to /usr/local
enable_cuda=no
else
echo Found CUB at $cub_path
fi
fi