-
Notifications
You must be signed in to change notification settings - Fork 14
/
configure.ac
4084 lines (3706 loc) · 161 KB
/
configure.ac
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
AC_PREREQ([2.71])
# The version is set in elpa.spec, to have a single point of reference
AC_INIT([elpa],m4_esyscmd_s([awk '/^ *Version:/ {print $2;}' elpa.spec]), [elpa-library@mpcdf.mpg.de])
AC_SUBST([PACKAGE_VERSION])
AC_CONFIG_SRCDIR([src/elpa.F90])
AM_INIT_AUTOMAKE([foreign -Wall subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AM_SILENT_RULES([yes])
# ABI version
#
# Set the libtool library version, see LIBRARY_INTERFACE
#
# See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
#
# [c:r:a]
#
# c: The currently implement interface
# r: The revision number of the current interface, that is the number
# of released source-code changes for the current interface
# a: The "age" is the number of interfaces prior to c that are also supported
# by the current interface, as they are ABI compatible (e.g. only new symbols
# were added by the new interface)
#
# Note that this number translates into the library file name like this:
# c:r:a ---> libelpa.so.(c-a).a.r
AC_SUBST([ELPA_SO_VERSION], [22:0:3])
# AC_DEFINE_SUBST(NAME, VALUE, DESCRIPTION)
# -----------------------------------------
AC_DEFUN([AC_DEFINE_SUBST], [
AC_DEFINE([$1], [$2], [$3])
AC_SUBST([$1], ['$2'])
])
AX_BUILD_DATE_EPOCH(ELPA_BUILDTIME)
# API Version
AC_DEFINE([EARLIEST_API_VERSION], [20170403], [Earliest supported ELPA API version])
print_earliest_api_version=20170403
AC_DEFINE_SUBST(CURRENT_API_VERSION, 20241105, "Current ELPA API version")
print_current_api_version=20241105
# Autotune Version
AC_DEFINE([EARLIEST_AUTOTUNE_VERSION], [20171201], [Earliest ELPA API version, which supports autotuning])
print_earliest_autotune_version=20171201
AC_DEFINE([CURRENT_AUTOTUNE_VERSION], [20241105], [Current ELPA autotune version])
print_current_autotune_version=20241105
AC_DEFINE([CURRENT_AUTOTUNE_VERSION], [20241105], [Current ELPA autotune version])
AC_DEFINE_SUBST(CURRENT_AUTOTUNE_VERSION, 20241105, "Current ELPA autotune version")
AC_DEFINE_UNQUOTED([ELPA_BUILDTIME], [$ELPA_BUILDTIME], ["Time of build"])
AX_COMPARE_VERSION([$ELPA_BUILDTIME], [gt], [1732082353],[old_elpa_version=yes],[old_elpa_version=no])
AX_CHECK_GNU_MAKE()
if test x$_cv_gnu_make_command = x ; then
AC_MSG_ERROR([Need GNU Make])
fi
AC_MSG_CHECKING(whether in C interface the error argument should be optional)
AC_ARG_ENABLE([optional-argument-in-C-API],
AS_HELP_STRING([--enable-optional-argument-in-C-API],
[do not build C API with error argument as optional, default no]),
[
if test x"$enableval" = x"yes"; then
optional_c_error_argument=yes
else
optional_c_error_argument=no
fi
],
[optional_c_error_argument=no])
AC_MSG_RESULT([${optional_c_error_argument}])
AM_CONDITIONAL([OPTIONAL_C_ERROR_ARGUMENT],[test x"$optional_c_error_argument" = x"yes"])
if test x"${optional_c_error_argument}" = x"yes"; then
AC_DEFINE([OPTIONAL_C_ERROR_ARGUMENT], [1], [enable error argument in C-API to be optional])
fi
# gnu-make fortran module dependencies
m4_include([fdep/fortran_dependencies.m4])
FDEP_F90_GNU_MAKE_DEPS
dnl OpenMP
m4_include([m4/ax_elpa_openmp.m4])
AC_MSG_CHECKING(whether --enable-openmp is specified)
AC_ARG_ENABLE([openmp],
AS_HELP_STRING([--enable-openmp],
[use OpenMP threading, default no.]),
[
if test x"$enableval" = x"yes"; then
enable_openmp=yes
else
enable_openmp=no
fi
],
[enable_openmp=no])
AC_MSG_RESULT([${enable_openmp}])
AM_CONDITIONAL([WITH_OPENMP_TRADITIONAL],[test x"$enable_openmp" = x"yes"])
if test x"${enable_openmp}" = x"yes"; then
AC_DEFINE([WITH_OPENMP_TRADITIONAL], [1], [use OpenMP threading])
fi
dnl mpi
correct_mpi_argument=no
with_mpi_specified=no
AC_ARG_WITH([mpi],
[AS_HELP_STRING([--with-mpi=[[yes|no]]],
[compile with MPI. Default: yes])],
[
with_mpi_specified=yes
if test x"$withval" = x"auto"; then
correct_mpi_argument=yes
fi
if test x"$withval" = x"yes"; then
correct_mpi_argument=yes
fi
if test x"$withval" = x"no"; then
correct_mpi_argument=yes
fi],
[with_mpi=yes])
if test x"$with_mpi_specified" = x"yes"; then
if test x"$correct_mpi_argument" = x"no"; then
AC_MSG_ERROR([if --with-mpi is specified, it must be either --with-mpi=yes, or --with-mpi=no])
fi
fi
AM_CONDITIONAL([WITH_MPI],[test x"$with_mpi" = x"yes"])
if test x"${with_mpi}" = x"yes"; then
AC_DEFINE([WITH_MPI], [1], [use MPI])
fi
dnl CXX
AC_LANG_PUSH([C++])
AC_PROG_CXX
ac_success="no"
check_for_c11="no"
AX_CXX_COMPILE_STDCXX_17
AC_LANG_POP([C++])
if test x"${ac_success}" = x"no"; then
check_for_c11="yes"
fi
AC_LANG_PUSH([C++])
if test x"${check_for_c11}" = x"yes"; then
cxx11_standard=no
AX_CHECK_COMPILE_FLAG([-std=gnu++11], [
cxx11_standard=yes
], [
echo "C++ compiler cannot compile -std=gnu++11 code"
echo "testing -std=c++11.."
])
if test x"$cxx11_standard" = x"yes"; then
CXXFLAGS+=" -std=gnu++11"
fi
if test x"$cxx11_standard" = x"no"; then
AX_CHECK_COMPILE_FLAG([-std=c++11], [
cxx11_standard=yes
], [
echo "C++ compiler cannot compile -std=c++11 code"
echo "testing -c++11.."
])
if test x"$cxx11_standard" = x"yes"; then
CXXFLAGS+=" -std=c++11"
fi
fi
if test x"$cxx11_standard" = x"no"; then
AX_CHECK_COMPILE_FLAG([-c++11], [
cxx11_standard=yes
], [
echo "C++ compiler cannot compile -c++11 code"
echo "C++ compiler cannot compile C++11 code"
exit -1
])
if test x"$cxx11_standard" = x"yes"; then
CXXFLAGS+=" -c++11"
fi
fi
AC_LANG_POP([C++])
fi
dnl C
AC_LANG_PUSH([C])
AX_PROG_CC_MPI([test x"$with_mpi" = x"yes"],[found_mpi_c=yes],[found_mpi_c=no])
if test x"$with_mpi" = x"yes"; then
if test x"$found_mpi_c" = x"no"; then
AC_MSG_ERROR([Could not compile an MPI C program])
fi
fi
if test x"${enable_openmp}" = x"yes"; then
AX_ELPA_OPENMP
if test "$ac_cv_prog_cc_openmp" = unsupported; then
AC_MSG_ERROR([Could not compile a C program with OpenMP, adjust CFLAGS])
fi
CFLAGS="$OPENMP_CFLAGS $CFLAGS"
fi
if test x"${check_for_c11}" = x"yes"; then
c11_standard=no
AX_CHECK_COMPILE_FLAG([-std=gnu11], [
c11_standard=yes
], [
echo "C compiler cannot compile -std=gnu11 code"
echo "testing -std=c11.."
])
if test x"$c11_standard" = x"yes"; then
CFLAGS+=" -std=gnu11"
fi
if test x"$c11_standard" = x"no"; then
AX_CHECK_COMPILE_FLAG([-std=c11], [
c11_standard=yes
], [
echo "C compiler cannot compile -std=c11 code"
echo "testing -c11.."
])
if test x"$c11_standard" = x"yes"; then
CFLAGS+=" -std=c11"
fi
fi
fi
if test x"$c11_standard" = x"no"; then
AX_CHECK_COMPILE_FLAG([-c11], [
c11_standard=yes
], [
echo "C compiler cannot compile -c11 code"
echo "C compiler cannot compile C11 code"
exit -1
])
if test x"$c11_standard" = x"yes"; then
CFLAGS+=" -c11"
fi
fi
AX_EXT
dnl heterogenous-cluster-support
AC_MSG_CHECKING(whether heterogenous-cluster-support should be enabled)
AC_ARG_ENABLE([heterogenous-cluster-support],
AS_HELP_STRING([--enable-heterogenous-cluster-support],
[allow ELPA to automatically switch to a kernel supported on all CPUs of a cluster (only works for Intel CPUs at the moment), default no. Activate only if necessary has a performance penalty! This feature is experimental! (default: disabled)]),
[
if test x"$enableval" = x"yes"; then
enable_heterogenous_cluster_support=yes
else
enable_heterogenous_cluster_support=no
fi
],
[enable_heterogenous_cluster_support="no"])
AC_MSG_RESULT([$enable_heterogenous_cluster_support])
if test x"${enable_heterogenous_cluster_support}" = x"yes"; then
AC_DEFINE([HAVE_HETEROGENOUS_CLUSTER_SUPPORT], [1], [automatically support clusters with different Intel CPUs])
fi
AM_CONDITIONAL([HAVE_HETEROGENOUS_CLUSTER_SUPPORT],[test x"$enable_heterogenous_cluster_support" = x"yes"])
dnl 64bit integer support for BLACS/LAPACK/SCALAPACK support
dnl first long int
AC_CHECK_SIZEOF([long int])
size_of_long_int="${ac_cv_sizeof_long_int}"
dnl then 64bit blas
AC_MSG_CHECKING(whether 64bit integers should be used for math libraries (BLAS/LAPACK/SCALAPACK))
AC_ARG_ENABLE([64bit-integer-math-support],
AS_HELP_STRING([--enable-64bit-integer-math-support],
[allows to link against the 64bit integer versions of the math libraries BLAS, LAPACK, and SCALAPACK (default: no)]),
[
if test x"$enableval" = x"yes"; then
enable_64bit_integer_math_support=yes
else
enable_64bit_integer_math_support=no
fi
],
[enable_64bit_integer_math_support="no"])
AC_MSG_RESULT([$enable_64bit_integer_math_support])
if test x"${enable_64bit_integer_math_support}" = x"yes"; then
dnl at least INTEL MPI does _NOT_ support 64BIT integer mode for C thus disable C tests in this Case
if test x"${enable_c_tests}" = x"yes"; then
AC_MSG_ERROR([You cannot both define 64bit integer support and C tests. Reconfigure!])
fi
dnl check whether long int is the correct data-type in C
if test x"${size_of_long_int}" = x"8"; then
echo "Found C data-type \"long int\" with 8 bytes"
else
AC_MSG_ERROR([The C data-type "long int" is only ${size_of_long_int} bytes; Needed is 8 bytes])
fi
AC_DEFINE([HAVE_64BIT_INTEGER_MATH_SUPPORT], [1], [allow to link against the 64bit integer versions of math libraries])
fi
AM_CONDITIONAL([HAVE_64BIT_INTEGER_MATH_SUPPORT],[test x"$enable_64bit_integer_math_support" = x"yes"])
dnl then 64bit blas
AC_MSG_CHECKING(whether 64bit integers should be used for the MPI library)
AC_ARG_ENABLE([64bit-integer-mpi-support],
AS_HELP_STRING([--enable-64bit-integer-mpi-support],
[allows to link against the 64bit integer versions of the MPI library (default: no)]),
[
if test x"$enableval" = x"yes"; then
enable_64bit_integer_mpi_support=yes
else
enable_64bit_integer_mpi_support=no
fi
],
[enable_64bit_integer_mpi_support="no"])
AC_MSG_RESULT([$enable_64bit_integer_mpi_support])
if test x"${enable_64bit_integer_mpi_support}" = x"yes"; then
AC_DEFINE([HAVE_64BIT_INTEGER_MPI_SUPPORT], [1], [allow to link against the 64bit integer versions of the MPI library])
fi
AM_CONDITIONAL([HAVE_64BIT_INTEGER_MPI_SUPPORT],[test x"$enable_64bit_integer_mpi_support" = x"yes"])
AC_MSG_CHECKING(whether C compiler can use _Generic )
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
int main(int argc, char **argv) {
#define elpa_set(e, name, value, error) _Generic((value), \
int: \
elpa_set_integer, \
\
double: \
elpa_set_double \
)(e, name, value, error)
return 0;
}
])],
[can_compile_generic=yes],
[can_compile_generic=no]
)
AC_MSG_RESULT([${can_compile_generic}])
if test x"$can_compile_generic" != x"yes"; then
AC_MSG_ERROR([C compiler cannot handle _Generic statement! Upgrade or change C compiler])
fi
AC_DEFINE([HAVE_VSX_SSE],[1],[Altivec VSX intrinsics are supported on this CPU])
AC_PROG_INSTALL
AM_PROG_AR
AM_PROG_AS
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_CPP
AC_LANG_POP([C])
# Fortran
AC_LANG_PUSH([Fortran])
m4_include([m4/ax_prog_fc_mpi.m4])
AX_PROG_FC_MPI([test x"$with_mpi" = x"yes"],[found_mpi_f=yes],[found_mpi_f=no])
if test x"$with_mpi" = x"yes"; then
if test x"$found_mpi_f" = x"no"; then
AC_MSG_ERROR([Could not compile an MPI Fortran program])
fi
fi
AC_FC_SRCEXT([F90])
AC_FC_FREEFORM
AC_FC_MODULE_FLAG
AC_FC_MODULE_OUTPUT_FLAG
AC_FC_LIBRARY_LDFLAGS
AC_MSG_CHECKING(whether Fortran compiler infers interfaces )
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
program test
implicit none
integer :: a
real*8 :: b
call foo(a)
call foo(b)
end program
])],
[FC_does_infer_interfaces=no],
[FC_does_infer_interfaces=yes]
)
AC_MSG_RESULT([${FC_does_infer_interfaces}])
if test x"${FC_does_infer_interfaces}" = x"yes"; then
# two problems
# 1. some MPIs (at least Intel) do not provide all
# interfaces, which will fail
# in case of MPI and not all interfaces -> switch of
# argument checking or fail
# 2. no MPI case: switch of PACK_REAL_TO_COMPLEX
if test x"${with_mpi}" = x"yes"; then
AC_MSG_CHECKING(whether MPI module defines all interfaces )
# check whether MPI module defines all interfaces; not the case for Intel MPI!
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
program test_mpi_interfaces
use mpi
implicit none
integer :: rank
integer :: buf(10)
integer :: ierr
real*8 :: a(2)
complex*16 :: b(2)
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)
if (rank == 0) then
buf(:) = 42;
end if
!! this is OK
!call MPI_Bcast(buf, 10, MPI_INT, 0, MPI_COMM_WORLD, ierr)
!! Oops, wrong order here:
!call MPI_Bcast(10, buf, MPI_INT, 0, MPI_COMM_WORLD, ierr)
! if the correct interfaces exists in the MPI module
! this must work. If not and the compiler infers interfaces
! this will fail
call MPI_Bcast(a, 2, MPI_REAL8, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(b, 2, MPI_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD, ierr)
call MPI_Finalize(ierr)
end program
])],
[MPImodule_has_interfaces=yes],
[MPImodule_has_interfaces=no]
)
AC_MSG_RESULT([${MPImodule_has_interfaces}])
AC_ARG_ENABLE([mpi-module],
AS_HELP_STRING([--disable-mpi-module],
[do not use the Fortran MPI module, but get instead interfaces by 'include "mpif.h' (default: --enable-mpi-module)]),
[
if test x"$enableval" = x"yes"; then
enable_mpi_module_tmp=yes
else
enable_mpi_module_tmp=no
fi
],
[enable_mpi_module_tmp=yes])
if test x"${enable_mpi_module_tmp}" = x"no"; then
MPImodule_has_interfaces=no
fi
if test x"${MPImodule_has_interfaces}" = x"no"; then
AC_MSG_CHECKING(whether we can cure missing interfaces by allowing argument mismatch )
#check whether we can cure this by disabling argument checking
FCFLAGS_SAVE2="$FCFLAGS"
FCFLAGS="$FCFLAGS -fallow-argument-mismatch"
# test again
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
program test
implicit none
integer :: a
real*8 :: b
call foo(a)
call foo(b)
end program
])],
[FC_infer_interfaces_cured=yes],
[FC_infer_interfaces_cured=no]
)
AC_MSG_RESULT([${FC_infer_interfaces_cured}])
if test x"${FC_infer_interfaces_cured}" = x"no"; then
FCFLAGS = "$FCFLAGS_SAVE2"
AC_MSG_ERROR([Fortran compiler infers interfaces; but MPI module does not supply all of them])
fi
fi
#else
# # no MPI case switch of PACK_REAL_TO_COMPLEX
# # i.e. do _not_ define it
fi
else
AC_DEFINE([PACK_REAL_TO_COMPLEX], [1], [In some kernels pack real to complex])
fi
if test x"${enable_openmp}" = x"yes"; then
AX_ELPA_OPENMP
if test "$ac_cv_prog_fc_openmp" = unsupported; then
AC_MSG_ERROR([Could not compile a Fortran program with OpenMP, adjust FCFLAGS])
fi
FCFLAGS="$OPENMP_FCFLAGS $FCFLAGS"
fi
#AC_LANG_POP([Fortran])
want_mpi_launcher="no"
AC_MSG_CHECKING(whether mpi-launcher should be detected automatically)
AC_ARG_ENABLE(detect-mpi-launcher,
[AS_HELP_STRING([--enable-detect-mpi-launcher (default: enabled)],
[automatically detect mpi launcher])],
[want_mpi_launcher="$enableval"],
[want_mpi_launcher="yes"])
AC_MSG_RESULT([${want_mpi_launcher}])
AC_MSG_CHECKING(whether a specific MPI launcher should be used)
AC_ARG_ENABLE([mpi-launcher],
[AS_HELP_STRING([--enable-mpi-launcher=[[mpiexec|mpiexec.hydra|mpirun|srun]]],
[use specified MPI launcher])],
[if test x"$enableval" = x"mpiexec"; then
MPI_BINARY=mpiexec
use_mpi_launcher=yes
fi
if test x"$enableval" = x"mpiexec.hydra"; then
MPI_BINARY=mpiexec.hydra
use_mpi_launcher=yes
fi
if test x"$enableval" = x"mpirun"; then
MPI_BINARY=mpirun
use_mpi_launcher=yes
fi
if test x"$enableval" = x"srun"; then
MPI_BINARY=srun
use_mpi_launcher=yes
fi
if test x"$enableval" = x"yes"; then
AC_MSG_ERROR([Wrong value! Must be either "mpiexec" or "mpiexec.hydra" or "mpirun" or "srun"])
fi
if test x"$enableval" = x"no"; then
use_mpi_launcher=no
fi
],
[use_mpi_launcher=no])
AC_MSG_RESULT([${use_mpi_launcher}])
if test x"$want_mpi_launcher" = x"yes"; then
if test x"$use_mpi_launcher" = x"yes"; then
AC_MSG_ERROR([You cannot specify a MPI launcher and ask for automatic detection. Disable one or the other option ])
fi
fi
dnl check which MPI binray invokes a MPI job
if test x"$with_mpi" = x"yes"; then
if test x"$want_mpi_launcher" = x"yes"; then
AC_CHECK_PROGS([MPI_BINARY], [mpiexec.hydra mpiexec mpirun poe srun runjob aprun poe], [no])
if test x"$MPI_BINARY" = x"no"; then
AC_MSG_ERROR([Could not find either of the MPI binaries: mpiexec.hydra, mpiexec, mpirun, poe, runjob, srun, aprun])
fi
fi
fi
dnl build with the possibilty to redirect stdout and stderr
dnl per MPI task in a file
AC_MSG_CHECKING(whether stdout/stderr file redirect should be enabled)
AC_ARG_ENABLE([redirect],
[AS_HELP_STRING([--enable-redirect],
[for test programs, allow redirection of stdout/stderr per MPI taks in a file (useful for timing), default no.])],
[
if test x"$enableval" = x"yes"; then
enable_redirect=yes
else
enable_redirect=no
fi
],
[enable_redirect=no])
AC_MSG_RESULT([${enable_redirect}])
dnl check whether single precision is requested
AC_MSG_CHECKING(whether ELPA library should contain also single precision functions)
AC_ARG_ENABLE(single-precision,
[AS_HELP_STRING([--enable-single-precision],
[build with single precision (default: yes)])],
[want_single_precision="$enableval"],
[want_single_precision="yes"])
AC_MSG_RESULT([${want_single_precision}])
dnl redirect
if test x"${enable_redirect}" = x"yes"; then
AC_DEFINE([HAVE_REDIRECT], [1], [Redirect stdout and stderr of test programs per MPI tasks to a file])
fi
AM_CONDITIONAL([HAVE_REDIRECT],[test x"$enable_redirect" = x"yes"])
dnl build with ftimings support
AC_ARG_ENABLE([timings],
[AS_HELP_STRING([--disable-timings],
[more detailed timing, default yes])],
[
if test x"$enableval" = x"yes"; then
enable_timings=yes
else
enable_timings=no
fi
],
[enable_timings=yes])
if test x"${enable_timings}" = x"yes"; then
AC_DEFINE([HAVE_DETAILED_TIMINGS], [1], [Enable more timing])
fi
AM_CONDITIONAL([HAVE_DETAILED_TIMINGS], [test x"$enable_timings" = x"yes"])
AC_ARG_ENABLE([affinity-checking],
[AS_HELP_STRING([--disable-affinity-checking],
[allow ELPA to check process and threading affinity, default yes])],
[
if test x"$enableval" = x"yes"; then
enable_affinity_checking_=yes
else
enable_affinity_checking=no
fi
],
[enable_affinity_checking=yes])
if test x"${enable_affinity_checking}" = x"yes"; then
AC_DEFINE([HAVE_AFFINITY_CHECKING], [1], [Enable affinity checking])
fi
AM_CONDITIONAL([HAVE_AFFINITY_CHECKING], [test x"$enable_affinity_checking" = x"yes"])
dnl PAPI for ftimings
AC_LANG_PUSH([C])
AC_ARG_WITH([papi],
[AS_HELP_STRING([--with-papi],
[Use PAPI to also measure flop count in the detailed timing (--enable-timing), disabled by default])],
[
if test x"$withval" = x"yes"; then
with_papi=yes
else
with_papi=no
fi
],
[with_papi="no"])
if test x"${enable_timings}" = x"yes"; then
if test x"$with_papi" = x"yes" ; then
AC_SEARCH_LIBS([PAPI_library_init], [papi], [papi_found=yes], [papi_found=no])
if test x"$papi_found" = x"no" ; then
AC_MSG_ERROR(["Could not find usable PAPI installation, please install or adjust CFLAGS, LDFLAGS"])
fi
AC_DEFINE([HAVE_LIBPAPI], [1], [Use the PAPI library])
fi
fi
AC_LANG_POP([C])
dnl Likwid
AC_LANG_PUSH([Fortran])
AC_ARG_WITH([likwid],
[AS_HELP_STRING([--with-likwid=[[yes|no(default)|PATH]]],
[Use Likwid to measure performance in some parts of the library])],
[with_likwid="$withval"],
[with_likwid="no"])
if test x"$with_likwid" != x"no" ; then
if test -d $with_likwid/lib ; then
LDFLAGS="-L$with_likwid/lib $LDFLAGS"
fi
if test -d $with_likwid/lib64 ; then
LDFLAGS="-L$with_likwid/lib64 $LDFLAGS"
fi
if test -d $with_likwid/include ; then
FCFLAGS="-I$with_likwid/include $FCFLAGS"
fi
AC_SEARCH_LIBS([likwid_markerInit], [likwid], [liblikwid_found="yes"], [liblikwid_found="no"])
if test x"$liblikwid_found" = x"no" ; then
AC_MSG_ERROR([Could not find a usable likwid library, please adjust LDFLAGS])
fi
AC_MSG_CHECKING([whether we can use the likwid module in a Fortran program])
AC_COMPILE_IFELSE([
program foo
use likwid
implicit none
call likwid_markerInit()
call likwid_markerThreadInit()
call likwid_markerStartRegion("foobar")
call likwid_markerStopRegion("foobar")
call likwid_markerClose()
end
],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not compile a Fortran program using the likwid module, adjust FCFLAGS])])
AC_DEFINE([HAVE_LIKWID], [1], [Use likwid])
fi
AC_LANG_POP([Fortran])
save_FCFLAGS=$FCFLAGS
save_LDFLAGS=$LDFLAGS
AC_ARG_VAR([SCALAPACK_LDFLAGS],[Extra LDFLAGS necessary to link a program with Scalapack])
AC_ARG_VAR([SCALAPACK_FCFLAGS],[Extra FCFLAGS necessary to compile a Fortran program with Scalapack])
FCFLAGS="$FCFLAGS $SCALAPACK_FCFLAGS"
LDFLAGS="$LDFLAGS $SCALAPACK_LDFLAGS"
dnl check whether fortran error_unit is defined
AC_MSG_CHECKING([whether Fortran module iso_fortran_env is available])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
program test_error_unit
use iso_fortran_env, only : error_unit
implicit none
write(error_unit,*) "error_unit is defined"
end program
])],
[can_use_iso_fortran_env=yes],
[can_use_iso_fortran_env=no]
)
AC_MSG_RESULT([${can_use_iso_fortran_env}])
if test x"${can_use_iso_fortran_env}" = x"yes" ; then
AC_DEFINE([HAVE_ISO_FORTRAN_ENV],[1],[can use module iso_fortran_env])
fi
dnl check whether one can link with specified MKL (desired method)
AC_MSG_CHECKING([whether we can compile a Fortran program using MKL])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
program test_mkl
use mkl_service
character*198 :: string
call mkl_get_version_string(string)
write(*,'(a)') string
end program
])],
[can_compile_with_mkl=yes],
[can_compile_with_mkl=no]
)
AC_MSG_RESULT([${can_compile_with_mkl}])
if test x"$can_compile_with_mkl" = x"yes" ; then
AC_MSG_CHECKING([whether we can link a Fortran program with MKL])
AC_LINK_IFELSE([AC_LANG_SOURCE([
program test_mkl
use mkl_service
character*198 :: string
call mkl_get_version_string(string)
write(*,'(a)') string
end program
])],
[have_mkl=yes],
[have_mkl=no]
)
AC_MSG_RESULT([${have_mkl}])
fi
#AC_LANG_POP([Fortran])
dnl if not mkl, check all the necessary individually
if test x"${have_mkl}" = x"yes" ; then
WITH_MKL=1
else
dnl first check blas
AC_SEARCH_LIBS([dgemm],[flexiblas openblas satlas blas],[have_blas=yes],[have_blas=no])
AC_MSG_CHECKING([whether we can link a program with a blas lib])
AC_MSG_RESULT([${have_blas}])
if test x"${have_blas}" = x"no" ; then
AC_MSG_ERROR([could not link with blas: specify path])
fi
dnl now lapack
AC_SEARCH_LIBS([dlarrv],[lapack],[have_lapack=yes],[have_lapack=no])
AC_MSG_CHECKING([whether we can link a program with a lapack lib])
AC_MSG_RESULT([${have_lapack}])
if test x"${have_lapack}" = x"no" ; then
AC_MSG_ERROR([could not link with lapack: specify path])
fi
if test x"${with_mpi}" = x"yes"; then
dnl test whether scalapack already contains blacs
scalapack_libs="mpiscalapack scalapack scalapack-openmpi"
old_LIBS="$LIBS"
for lib in ${scalapack_libs}; do
LIBS="-l${lib} ${old_LIBS}"
AC_MSG_CHECKING([whether -l${lib} already contains a BLACS implementation])
AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([blacs_gridinit])],[blacs_in_scalapack=yes],[blacs_in_scalapack=no])
AC_MSG_RESULT([${blacs_in_scalapack}])
if test x"${blacs_in_scalapack}" = x"yes"; then
break
fi
done
if test x"${blacs_in_scalapack}" = x"no"; then
LIBS="${old_LIBS}"
dnl Test for stand-alone blacs
AC_SEARCH_LIBS([bi_f77_init],[mpiblacsF77init],[],[],[-lmpiblacs])
dnl for debian
AC_SEARCH_LIBS([blacs_gridinit],[blacs-openmpi],[have_blacs=yes],[have_blacs=no],[-lblacsCinit-openmpi -lscalapack-openmpi])
if test x"${have_blacs}" = x"no"; then
unset ac_cv_search_blacs_gridinit
fi
AC_SEARCH_LIBS([blacs_gridinit],[mpiblacs blacs],[have_blacs=yes],[have_blacs=no])
if test x"${have_blacs}" = x"no"; then
AC_MSG_ERROR([No usable BLACS found. If installed in a non-standard place, please specify suitable LDFLAGS and FCFLAGS as arguments to configure])
fi
fi
AC_SEARCH_LIBS([pdtran],[$scalapack_libs],[have_scalapack=yes],[have_scalapack=no])
if test x"${have_scalapack}" = x"no" ; then
AC_MSG_ERROR([could not link with scalapack: specify path])
fi
fi
AC_LANG_PUSH([Fortran])
dnl check whether we can link alltogehter
AC_MSG_CHECKING([whether we can link a Fortran program with all blacs/scalapack])
AC_LINK_IFELSE([AC_LANG_SOURCE([
program dgemm_test
integer , parameter:: M = 4, N = 3, K = 2
real :: A(M,K), B(K,N), C(M,N)
call dgemm('N','N',M,N,K,1.0,A,M,B,K,0.0,C,M)
end program dgemm_test
])],
[can_link_with_blacs_scalapack=yes],
[can_link_with_blacs_scalapack=no]
)
AC_MSG_RESULT([${can_link_with_blacs_scalapack}])
if test x"${can_link_with_blacs_scalapack}" = x"yes" ; then
WITH_BLACS=1
else
AC_MSG_ERROR([We can neither link with MKL or another Scalpack. Please specify SCALAPACK_LDFLAGS and SCALAPACK_FCFLAGS!])
fi
fi
dnl important: reset them again!
FCFLAGS=$save_FCFLAGS
LDFLAGS=$save_LDFLAGS
dnl check for intrinsic fortran function of 2003 standard
AC_MSG_CHECKING([whether we can use the intrinsic Fortran function "get_environment_variable"])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
program test_get_environment
character(len=256) :: homedir
call get_environment_variable("HOME",homedir)
end program
])],
[fortran_can_check_environment=yes],
[fortran_can_check_environment=no]
)
AC_MSG_RESULT([${fortran_can_check_environment}])
if test x"${fortran_can_check_environment}" = x"yes" ; then
AC_DEFINE([HAVE_ENVIRONMENT_CHECKING],[1],[Fortran can query environment variables])
fi
AC_LANG_POP([Fortran])
dnl check whether BAND_TO_FULL_BLOCKING is set
AC_MSG_CHECKING(whether BAND_TO_FLULL_BLOCKING is requested)
AC_ARG_ENABLE(band-to-full-blocking,[AS_HELP_STRING([--disable-band-to-full-blocking],
[build ELPA2 with blocking in band_to_full (default: enabled)])],
[
if test x"$enableval" = x"yes"; then
enable_band_to_full_blocking=yes
else
enable_band_to_full_blocking=no
fi
],
[enable_band_to_full_blocking="yes"])
AC_MSG_RESULT([${enable_band_to_full_blocking}])
AM_CONDITIONAL([BAND_TO_FULL_BLOCKING],[test x"$enable_band_to_full_blocking" = x"yes"])
if test x"${enable_band_to_full_blocking}" = x"yes"; then
AC_DEFINE([BAND_TO_FULL_BLOCKING], [1], [use blocking in trans_ev_band_to_full])
fi
AC_ARG_WITH([cuda-path],[AS_HELP_STRING([--with-cuda-path=PATH],[prefix where CUDA is installed @<:@default=auto@:>@])],
[CUDA_INSTALL_PATH=$withval], [with_cuda=auto])
AC_ARG_WITH([cuda-sdk-path],[AS_HELP_STRING([--with-cuda-sdk-path=PATH],[prefix where CUDA SDK is installed @<:@default=auto@:>@])],
[CUDA_SDK_INSTALL_PATH=$withval],[with_cuda_sdk=auto])
dnl setup nvcc flags and use them in later tests
user_sets_nvidia_gpu_compute_capability="no"
AC_MSG_CHECKING(whether a Nvidia GPU compute capability is specified)
AC_ARG_WITH([NVIDIA-GPU-compute-capability],
[AS_HELP_STRING([--with-NVIDIA-GPU-compute-capability=VALUE],
[use compute capability VALUE for NVIDIA GPU version, default: "sm_35"])],
[user_sets_nvidia_gpu_compute_capability="yes"],[cuda_compute_capability="sm_35"])
AC_MSG_RESULT([${user_sets_nvidia_gpu_compute_capability}])
dnl sanity check whether compute capability setting by user is reasonable
if test x"${user_sets_nvidia_gpu_compute_capability}" = x"yes" ; then
dnl the user must set a value which starts with "sm_"
value=$(echo $withval | cut -c1-3)
if test x"${value}" = x"sm_" ; then
cuda_compute_capability=$withval
else
AC_MSG_ERROR([Unknown Nvidia GPU compute capability set: ${withval}])
fi
fi
nvidia_a100_support=no
if test x"$cuda_compute_capability" = x"sm_80" ; then
nvidia_a100_support=yes
AC_DEFINE([WITH_NVIDIA_GPU_SM80_COMPUTE_CAPABILITY],[1],[the NVIDIA GPU kernels for A100 can be used])
fi
AM_CONDITIONAL([WITH_NVIDIA_GPU_SM80_COMPUTE_CAPABILITY],[test x"${nvidia_a100_support}" = x"yes"])
AC_LANG_PUSH([Fortran])
dnl Test possibility of 'use mpi', if requested
if test x"${with_mpi}" = x"yes" ; then
AC_ARG_ENABLE([mpi-module],
AS_HELP_STRING([--disable-mpi-module],
[do not use the Fortran MPI module, get interfaces by 'include "mpif.h']),
[
if test x"$enableval" = x"yes"; then
enable_mpi_module=yes
else
enable_mpi_module=no
fi
],
[enable_mpi_module=yes])
if test x"${enable_mpi_module}" = x"yes" ; then
AC_MSG_CHECKING(whether Fortran mpi module can be used)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
program test_mpi_module
use mpi
real :: time
time = MPI_WTime()
end program
])],
[can_use_fortran_mpi_module=yes],
[can_use_fortran_mpi_module=no]
)
AC_MSG_RESULT([${can_use_fortran_mpi_module}])
if test x"${can_use_fortran_mpi_module}" = x"yes" ; then
AC_DEFINE([HAVE_MPI_MODULE],[1],[can use the Fortran mpi module])
else
AC_MSG_ERROR([Could not compile a Fortran program with an 'use mpi' statement. You can try again with --disable-mpi-module])
fi
fi
fi
if test x"$with_mpi" = x"yes" && test x"$enable_openmp" = x"yes"; then
AC_MSG_CHECKING(whether the threading support of the MPI library should be checked during RUNTIME)
AC_ARG_ENABLE([runtime-threading-support-checks],
AS_HELP_STRING([--disable-runtime-threading-support-checks],
[do not check at runtime the required threading support of the MPI library. DISABLE ONLY AT YOUR OWN RISK! (default: on)]),
[
if test x"$enableval" = x"yes"; then
enable_runtime_threading_support_checks=yes
else
enable_runtime_threading_support_checks=no
fi
],
[enable_runtime_threading_support_checks=yes])
AC_MSG_RESULT([${enable_runtime_threading_support_checks}])
if test x"${enable_runtime_threading_support_checks}" = x"yes" ; then
AC_DEFINE([THREADING_SUPPORT_CHECK],[1],[can check at runtime the threading support level of MPI])
fi
AC_MSG_CHECKING(whether ELPA is allowed to limit the number of OpenMP threads at runtime)
AC_ARG_ENABLE([allow-thread-limiting],
AS_HELP_STRING([--enable-allow-thread-limiting],
[do a runtime check whether threading support of the MPI library is sufficient. If not ELPA will limit the number of OpenMP threads to 1 during the run (default: enabled)]),
[
if test x"$enableval" = x"yes"; then
enable_allow_thread_limiting=yes
else
enable_allow_thread_limiting=no
fi
],
[enable_allow_thread_limiting=yes])
AC_MSG_RESULT([${enable_allow_thread_limiting}])
if test x"${enable_allow_thread_limiting}" = x"yes" ; then
AC_DEFINE([ALLOW_THREAD_LIMITING],[1],[ELPA can at runtime limit the number of OpenMP threads to 1 if needed])
fi
#consistency check
if test x"${enable_allow_thread_limiting}" = x"yes" && test x"${enable_runtime_threading_support_checks}" = x"no"; then
AC_MSG_ERROR([You cannot set --enable-allow-thread-limiting and --disable-runtime-threading-support-checks at the same time. Thread limiting needs runtime support checks!])
fi
if test x"${enable_allow_thread_limiting}" = x"no" && test x"${enable_runtime_threading_support_checks}" = x"yes"; then
AC_MSG_NOTICE([You set --disable-allow-thread-limiting and --enable-runtime-threading-support-checks. If ELPA detects during a run that])
AC_MSG_NOTICE([your MPI library does not provide a sufficient level of threading support, ELPA will only _print_ a warning and continue])
AC_MSG_NOTICE([This might lead to undefined behavior, includig wrong results])
fi
AC_ARG_WITH([threading-support-check-during-build],[AS_HELP_STRING([--with-threading-support-check-during-build],[Do checks at build time whether the MPI threading level support is sufficient. (default: on)])],