forked from milc-qcd/milc_qcd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
1058 lines (791 loc) · 29.1 KB
/
Makefile
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
# MIMD version 7
# Standard application makefile.
# Replaces Make_vanilla, Make_linux_mpi, Make_linux_qdp, Make_qcdoc_gcc
# Do not use for making libraries
# Copy this file into the application directory and run make there.
#
# This file
MAKEFILE = Makefile
#----------------------------------------------------------------------
# User choices - edit to suit
#----------------------------------------------------------------------
# 1. Machine architecture. Controls optimization flags here and in libraries.
# Can control BINEXT below, a suffix appended to the name of the executable.
ARCH ?= # skx knl knc hsw pow8 pow9
#----------------------------------------------------------------------
# 2. Compiler family
COMPILER ?= gnu # intel, ibm, portland, cray-intel
#----------------------------------------------------------------------
# 3. MPP vs Scalar
# Compiling for a parallel machine? blank for a scalar machine
MPP ?= false
#----------------------------------------------------------------------
# 4. Precision
# 1 = single precision; 2 = double
PRECISION ?= 1
#----------------------------------------------------------------------
# 5. Compiler
# Choices include mpicc cc gcc pgcc g++
ifeq ($(strip ${COMPILER}),intel)
ifeq ($(strip ${MPP}),true)
MY_CC ?= mpiicc
MY_CXX ?= mpiicpc
else
MY_CC ?= icc
MY_CXX ?= icpc
endif
else ifeq ($(strip ${COMPILER}),cray-intel)
ifeq ($(strip ${MPP}),true)
MY_CC ?= cc
MY_CXX ?= CC
else
MY_CC ?= icc
MY_CXX ?= icpc
endif
else ifeq ($(strip ${COMPILER}),gnu)
ifeq ($(strip ${MPP}),true)
MY_CC ?= mpicc
MY_CXX ?= mpiCC
else
MY_CC ?= gcc
MY_CXX ?= g++
endif
else ifeq ($(strip ${COMPILER}),ibm)
ifeq ($(strip ${MPP}),true)
MY_CC ?= mpixlc_r
MY_CXX ?= mpixlcxx_r
else
MY_CC ?= xlc_r
MY_CXX ?= xlc++_r
endif
endif
CC = ${MY_CC}
CXX = ${MY_CXX}
# Override the above definitions
# ifeq ($(strip ${MPP}),true)
# CC = mpiicc
# CXX = mpiicpc
# else
# CC = icc
# CXX = icpc
# endif
#CC = /usr/local/mvapich/bin/mpicc # FNAL
#CXX = /usr/local/mvapich/bin/mpiCC # FNAL
#----------------------------------------------------------------------
# 6. Compiler optimization level
# Choices include -g -O, etc
# Power9 recommendations are -Ofast
OPT ?= -O3
# OpenMP?
OMP ?= #true
#----------------------------------------------------------------------
# 7. Other compiler optimization flags. Uncomment stanza to suit.
#-------------- Gnu C -------------------------------------
ifeq ($(strip ${COMPILER}),gnu)
OCFLAGS += -std=c99
OCXXFLAGS += -std=c++11
ifeq ($(strip ${ARCH}),pow8)
ARCH_FLAG = -mcpu=power8
endif
ifeq ($(strip ${ARCH}),pow9)
ARCH_FLAG = -mcpu=power9 -mtune=power9
endif
ifeq ($(strip ${OMP}),true)
OCFLAGS += -fopenmp
OCXXFLAGS += -fopenmp
LDFLAGS += -fopenmp
endif
# Other Gnu options
#OCFLAGS += -mavx # depends on architecture
# enable all warnings with exceptions
OCFLAGS += -Wall -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas -Wno-unused-function
endif
#------------------------ BlueGene -----------------------------------
ifeq ($(strip ${COMPILER}),ibm)
OCFLAGS = -std=gnu99
OCXXFLAGS += -std=c++11
# consider running with XLSMPOPTS=stack=10M or higher
ifeq ($(strip ${OMP}),true)
OCFLAGS += -qsmp=omp
OCXXFLAGS += -qsmp=omp
LDFLAGS += -qsmp=omp
endif
endif
#-------------- Intel icc/ecc -----------------------------------
ifeq ($(strip ${COMPILER}),intel)
OCFLAGS += -std=c99
OCXXFLAGS += -std=c++11
ifeq ($(strip ${ARCH}),knl)
ARCH_FLAG = -xMIC-AVX512
BINEXT=.knl
else ifeq ($(strip ${ARCH}),knc)
ARCH_FLAG = -mmic
BINEXT=.knc
else ifeq ($(strip ${ARCH}),skx)
ARCH_FLAG = -xCORE-AVX512 -qopt-zmm-usage=high
BINEXT=.skx
else ifeq ($(strip ${ARCH}),hsw)
ARCH_FLAG = -xCORE-AVX2
BINEXT=.hsw
else
ARCH_FLAG = -mavx
BINEXT=
endif
OCFLAGS += ${ARCH_FLAG}
OCXXFLAGS += ${ARCH_FLAG}
LDFLAGS += ${ARCH_FLAG}
OCFLAGS += -parallel-source-info=2 -debug inline-debug-info -qopt-report=5
OCXXFLAGS += -parallel-source-info=2 -debug inline-debug-info -qopt-report=5
ifeq ($(strip ${OMP}),true)
OCFLAGS += -qopenmp
OCXXFLAGS += -qopenmp
LDFLAGS += -qopenmp
endif
endif
#-------------- Cray-Intel -----------------------------------
ifeq ($(strip ${COMPILER}),cray-intel)
OCFLAGS += -std=c99
OCXXFLAGS += -std=c++11
ifeq ($(strip ${ARCH}),knl)
ARCH_FLAG = -xMIC-AVX512
BINEXT=.knl
else ifeq ($(strip ${ARCH}),knc)
ARCH_FLAG = -mmic
BINEXT=.knc
else ifeq ($(strip ${ARCH}),hsw)
ARCH_FLAG = -xCORE-AVX2
BINEXT=.hsw
else
ARCH_FLAG = -mavx
BINEXT=
endif
OCFLAGS += ${ARCH_FLAG}
OCXXFLAGS += ${ARCH_FLAG}
LDFLAGS += ${ARCH_FLAG}
OCFLAGS += -parallel-source-info=2 -debug inline-debug-info -qopt-report=5
OCXXFLAGS += -parallel-source-info=2 -debug inline-debug-info -qopt-report=5
ifeq ($(strip ${OMP}),true)
OCFLAGS += -qopenmp
OCXXFLAGS += -qopenmp
LDFLAGS += -qopenmp
endif
endif
#-------------- Portland Group ----------------------------
#OCFLAGS = -tp p6 -Munroll=c:4,n:4
#OCFLAGS= -mpentiumpro -march=pentiumpro -funroll-all-loops -malign-double -D_REENTRANT # Pentium pro
#----------------------------------------------------------------------
# 8. Choose large file support.
ifeq ($(strip ${COMPILER}),ibm)
CLFS = -D_LARGE_FILES # AIX
else
CLFS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE # Large files gcc only
endif
#----------------------------------------------------------------------
# 9. Installation-specific MPI includes and libraries
# Not needed if using mpicc or on single processor
#----------------- Intel MPI Custom -------------------------------------------
# IMPI = -I/opt/intel/impi/5.1.3.181/compilers_and_libraries_2016.2.181/linux/mpi/intel64/include
# ifeq ($(strip ${ARCH}),knl)
# LMPI = -L/opt/intel/compiler/latest/compilers_and_libraries_2016/linux/mpi/mic/lib
# else ifeq ($(strip ${ARCH}),knc)
# LMPI = -L/opt/intel/compiler/latest/compilers_and_libraries_2016/linux/mpi/mic/lib
# else
# LMPI = -L/opt/intel/compiler/latest/compilers_and_libraries_2016/linux/mpi/intel64/lib
# endif
#----------------- MVICH ----------------------------------------------
#IMPI = -I/uufs/icebox/sys/src/mpich/1.2.0-via/include # MVICH
#LMPI = -L/uufs/icebox/sys/pkg/mpich/1.2.0-via/lib -lmpi -lvipl -lpthread # MVICH
#----------------------------------------------------------------------
# 10. I/O routines
# Both io_nonansi and io_ansi should work on a scalar machine
# Solaris 2.6 gave "bad file number" errors with io_ansi. CD
MACHINE_DEP_IO = io_ansi.o # (io_ansi.o io_nonansi.o io_dcap.o)
# Uncomment if you have and want to support dcache I/O
# (Forces use of io_dcap.o)
# WANTDCAP = true
# The location of the installed dcap libraries. Uncomment and enter if
# it is not already defined as a system environment variable.
# DCAP_DIR = /usr/local/develop/dcache
# Choose the appropriate library path according to the addressing
# size of the machine
# DCAPLIB = lib64 # (lib64 lib)
#----------------------------------------------------------------------
# 11. SciDAC package options
# Edit these "wants"
WANTQOP ?= # true # or blank. Implies HAVEQDP, HAVEQOP, HAVEQMP.
WANTQIO ?= # true # or blank. Implies HAVEQMP.
WANTQMP ?= # true or blank.
# QMP_MPI or QMP_SPI
QMP_BACKEND = QMP_MPI
# Edit these locations for the installed SciDAC packages
# It is assumed that these are the parents of "include" and "lib"
SCIDAC = ${HOME}/scidac/install
TAG=
# Parallel versions
QMPPAR ?= ${SCIDAC}/qmp${TAG}
QIOPAR ?= $(SCIDAC)/qio${TAG}
# Single processor versions
QMPSNG ?= ${SCIDAC}/qmp-single${TAG}
QIOSNG ?= $(SCIDAC)/qio-single${TAG}
QLA ?= ${SCIDAC}/qla${TAG}
# Either version
QDP ?= ${SCIDAC}/qdp${TAG}
QOPQDP ?= ${SCIDAC}/qopqdp${TAG}
QOP = ${QOPQDP}
# Make_template_scidac defines these macros:
# HAVEQOP HAVEQDP HAVEQIO HAVEQMP (Says what we are compiling with)
# LIBSCIDAC INCSCIDAC (The -L and -I compiler and linker lists)
# SCIDAC_LIBRARIES SCIDAC_HEADERS (Lists for make dependencies)
# CSCIDAC (List of compiler macros for SciDAC modules)
include ../Make_template_scidac
#----------------------------------------------------------------------
# 12. Intel MKL for FFTW and LAPACK
ifeq ($(strip ${COMPILER}),intel)
INCFFTW = -mkl
LIBFFTW = -mkl
else ifeq ($(strip ${COMPILER}),cray-intel)
INCFFTW = -mkl
LIBFFTW = -mkl
endif
#----------------------------------------------------------------------
# 12. FFTW3 Options
WANTFFTW = #true # On cori, edison loaded by default, but need "true"
ifeq ($(strip ${WANTFFTW}),true)
FFTW=/usr/local/fftw
ifeq ($(strip ${PRECISION}),1)
FFTW_HEADERS = ${FFTW}/float-mvapich2/include
INCFFTW = -I${FFTW_HEADERS}
LIBFFTW = -L${FFTW}/float-mvapich2/lib
LIBFFTW += -lfftw3f
else
FFTW_HEADERS = ${FFTW}/double-mvapich2/include
INCFFTW = -I${FFTW_HEADERS}
LIBFFTW = -L${FFTW}/double-mvapich2/lib
LIBFFTW += -lfftw3
endif
PACKAGE_HEADERS += ${FFTW_HEADERS}
endif
#----------------------------------------------------------------------
# 13. LAPACK Options (for qopqdp-lapack and arb_overlap )
#LIBLAPACK = -L/opt/ibmcmp/xlf/bg/11.1/lib /soft/apps/LAPACK/liblapack_bgp.a /soft/apps/LIBGOTO/libgoto.a -lxlf90 -lxlsmp # LAPACK on BG/P
# Utah physics and math Redhat-linux
# LIBLAPACK = -L/usr/local/lib64 -llapack-gfortran -lblas-gfortran -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -lgfortran
# Utah physics and math Centos-linux. Must link with gfortran.
# LIBLAPACK = -L/usr/local/lib64 -llapack -lblas
# LDLAPACK = gfortran
# FNAL cluster (Jim's installation of ATLAS)
# LDFLAGS = -Wl,-rpath,"/usr/local/atlas-3.10-lapack-3.4.2/lib" -L/usr/local/atlas-3.10-lapack-3.4.2/lib
# LIBS = $(LDFLAGS) -lprimme -lm -llapack -lptf77blas -lptcblas -latlas -lgfortran -lpthread
# NERSC Cori Haswell
# LIBLAPACK = -L${LIBSCI_BASE_DIR}/INTEL/15.0/haswell/lib -lsci_intel
# NERSC Cori KNL
# LIBLAPACK = -L${LIBSCI_BASE_DIR}/INTEL/15.0/mic_knl/lib -lsci_intel
# NERSC Edison
# LIBLAPACK = -L${LIBSCI_BASE_DIR}/INTEL/15.0/ivybridge/lib -lsci_intel
#----------------------------------------------------------------------
# 14. PRIMME Options (for arb_overlap and ks_eigen). REQUIRES LAPACK AS WELL.
WANTPRIMME = #true
# PRIMME version 2.0
ifeq ($(strip ${WANTPRIMME}),true)
PRIMME_HEADERS = ${HOME}/PRIMME/include
INCPRIMME = -I${PRIMME_HEADERS}
PACKAGE_HEADERS += ${PRIMME_HEADERS}
LIBPRIMME = -L${HOME}/PRIMME/lib -lprimme
endif
#----------------------------------------------------------------------
# 14. ARPACK Options (for ks_eigen). REQUIRES LAPACK AS WELL.
WANTARPACK = #true
ifeq ($(strip ${WANTARPACK}),true)
# LIBARPACK = -L/usr/lib64 -lparpack -larpack -lifcore -llapack -lblas
LIBARPACK = -L/usr/lib64 -larpack
endif
#----------------------------------------------------------------------
# 15. GPU/QUDA Options
WANTQUDA ?= #true
WANT_CL_BCG_GPU ?= #true
WANT_FN_CG_GPU ?= #true
WANT_FL_GPU ?= #true
WANT_FF_GPU ?= #true
WANT_GF_GPU ?= #true
# enabled mixed-precision solvers for QUDA (if set, overrides HALF_MIXED and MAX_MIXED macros)
WANT_MIXED_PRECISION_GPU ?= 0
ifeq ($(strip ${WANTQUDA}),true)
QUDA_HOME ?= ${HOME}/quda
INCQUDA = -I${QUDA_HOME}/include -I${QUDA_HOME}/tests
PACKAGE_HEADERS += ${QUDA_HOME}/include
LIBQUDA = -Wl,-rpath ${QUDA_HOME}/lib -L${QUDA_HOME}/lib -lquda
QUDA_LIBRARIES = ${QUDA_HOME}/lib
CUDA_HOME ?= /usr/local/cuda
INCQUDA += -I${CUDA_HOME}/include
PACKAGE_HEADERS += ${CUDA_HOME}/include
LIBQUDA += -L${CUDA_HOME}/lib64 -lcudart -lcuda -lcublas -lcufft
QUDA_HEADERS = ${QUDA_HOME}/include
# Definitions of compiler macros -- don't change. Could go into a Make_template_QUDA
CGPU += -DHAVE_QUDA
ifeq ($(strip ${WANT_CL_BCG_GPU}),true)
HAVE_CL_GPU = true
CGPU += -DUSE_CL_GPU
endif
ifeq ($(strip ${WANT_FN_CG_GPU}),true)
HAVE_FN_CG_GPU = true
CGPU += -DUSE_CG_GPU
endif
ifeq ($(strip ${WANT_GF_GPU}),true)
HAVE_GF_GPU = true
CGPU += -DUSE_GF_GPU
endif
ifeq ($(strip ${WANT_FL_GPU}),true)
HAVE_FL_GPU = true
CGPU += -DUSE_FL_GPU
endif
ifeq ($(strip ${WANT_FF_GPU}),true)
HAVE_FF_GPU = true
CGPU += -DUSE_FF_GPU
endif
ifeq ($(strip ${WANT_MIXED_PRECISION_GPU}),1)
CGPU += -DHALF_MIXED # use single precision where appropriate
else ifeq ($(strip ${WANT_MIXED_PRECISION_GPU}),2)
CGPU += -DMAX_MIXED # use half precision where appropriate
endif
# Verbosity choices:
# SET_QUDA_SILENT, SET_QUDA_SUMMARIZE, SET_QUDA_VERBOSE, SET_QUDA_DEBUG_VERBOSE
CGPU += -DSET_QUDA_SUMMARIZE
endif
#----------------------------------------------------------------------
# 16. QPhiX Options
WANTQPHIX = #true
WANT_FN_CG_QPHIX = true
WANT_GF_QPHIX = true
QPHIX_HOME = ../QPhiX_MILC/milc-qphix
ifeq ($(strip ${WANTQPHIX}), true)
INCQPHIX = -I${QPHIX_HOME}
PACKAGE_HEADERS += ${QPHIX_HOME}
HAVE_QPHIX = true
CPHI = -DHAVE_QPHIX
QPHIX_HEADERS = ${QPHIX_HOME}
ifeq ($(strip ${MPP}),true)
# MPI versions of QPHIX
ifeq ($(strip ${ARCH}),knl)
LIBQPHIX = -L${QPHIX_HOME} -lqphixmilc_avx512 -lrt
else ifeq ($(strip ${ARCH}),knc)
LIBQPHIX = -L${QPHIX_HOME} -lqphixmilc_mic -lrt
else ifeq ($(strip ${ARCH}),hsw)
LIBQPHIX = -L${QPHIX_HOME} -lqphixmilc_avx2 -lrt
else ifeq ($(strip ${ARCH}),skx)
LIBQPHIX = -L${QPHIX_HOME} -lqphixmilc_skx -lrt
endif
else
# Non-MPI versions
ifeq ($(strip ${ARCH}),knl)
LIBQPHIX = -L${QPHIX_HOME} -lqphixmilc_avx512_single -lrt
else ifeq ($(strip ${ARCH}),knc)
LIBQPHIX = -L${QPHIX_HOME} -lqphixmilc_mic_single -lrt
else ifeq ($(strip ${ARCH}),hsw)
LIBQPHIX = -L${QPHIX_HOME} -lqphixmilc_avx2_single -lrt
else ifeq ($(strip ${ARCH}),skx)
LIBQPHIX = -L${QPHIX_HOME} -lqphixmilc_skx_single -lrt
endif
endif
QPHIX_HEADERS = ${QPHIX_HOME}
PACKAGE_HEADERS += ${QPHIX_HEADERS}
QPHIX_LIBRARIES = ${QPHIX_HOME}
ifeq ($(strip ${WANT_FN_CG_QPHIX}),true)
HAVE_FN_CG_QPHIX = true
CPHI += -DUSE_CG_QPHIX
endif
ifeq ($(strip ${WANT_GF_QPHIX}),true)
HAVE_GF_QPHIX = true
CPHI += -DUSE_GF_QPHIX
endif
endif
#----------------------------------------------------------------------
# 16. Grid Options
WANTGRID = #true
ifeq ($(strip ${WANTGRID}), true)
HAVE_GRID = true
CPHI += -DHAVE_GRID
CPHI += -DGRID_MULTI_CG=GRID_5DCG # Choices: GRID_BLOCKCG GRID_5DCG GRID_MRHSCG
CPHI += -DGRID_SHMEM_MAX=2048
ifeq ($(strip ${MPP}),true)
ifeq ($(strip ${ARCH}),knl)
GRID_ARCH = avx512
else ifeq ($(strip ${ARCH}),skx)
GRID_ARCH = avx512
else ifeq ($(strip ${ARCH}),hsw)
GRID_ARCH = avx2
endif
else
# Scalar version
GRID_ARCH = scalar
endif
GRID_HOME = ../Grid/install-${GRID_ARCH}
GRID_LIBRARIES = ${GRID_HOME}/lib
LIBGRID = -L${GRID_LIBRARIES} -lGrid
GRID_HEADERS = ${GRID_HOME}/include
INCGRID = -I${GRID_HEADERS}
PACKAGE_HEADERS += ${GRID_HEADERS}/Grid
PACKAGE_DEPS += Grid
endif
#----------------------------------------------------------------------
# 16. QPhiXJ (JLab) Options
WANTQPHIXJ = #true
# Choose vectorization parameters.
# Choices 4, 8 (or 1 for scalar)
QPHIXJ_SOALEN=4
ifeq ($(strip ${WANTQPHIXJ}), true)
HAVE_QPHIXJ = true
CPHI += -DHAVE_QPHIXJ
ifeq ($(strip ${MPP}),true)
# QMP versions of QPHIXJ
QPHIXJ_HOME = ../QPhiX_JLab/install
ifeq ($(strip ${ARCH}),knl)
QPHIXJ_ARCH = avx512
else ifeq ($(strip ${ARCH}),hsw)
QPHIXJ_ARCH = avx2
endif
else
# Scalar version
QPHIXJ_ARCH = scalar
QPHIXJ_SOALEN = 1
endif
# NOTE: These are QMP versions of QPHIXJ so requires QMP
QPHIXJ_HOME = ../QPhiX_JLab/install/dslash-${QPHIXJ_ARCH}-s${QPHIXJ_SOALEN}
QPHIXJ_LIBRARIES = ${QPHIXJ_HOME}/lib
LIBQPHIXJ = -L${QPHIXJ_LIBRARIES} -lqphix_solver -lqphix_codegen
QPHIXJ_HEADERS = ${QPHIXJ_HOME}/include
INCQPHIXJ = -I${QPHIXJ_HEADERS}
PACKAGE_HEADERS += ${QPHIXJ_HEADERS}
PACKAGE_DEPS += QPhiX_JLab
endif
#----------------------------------------------------------------------
# 17. Linker (need the C++ linker for QUDA, QPHIX, GRID)
ifeq ($(strip ${LDLAPACK}),)
ifeq ($(strip ${WANTQUDA}),true)
LD = ${CXX}
else ifeq ($(strip ${WANTQPHIX}),true)
LD = ${CXX}
else ifeq ($(strip ${WANTQPHIXJ}),true)
LD = ${CXX}
else ifeq ($(strip ${WANTGRID}),true)
LD = ${CXX}
else
LD = ${CC}
endif
else
LD = ${LDLAPACK}
endif
#----------------------------------------------------------------------
# 18. Extra ld flags
# VTune
# VTUNE_VERSION = 2016u2
# INCVTUNE = -I/opt/intel/vtune/${VTUNE_VERSION}/vtune_amplifier_xe_2016/include
# LIBVTUNE = -L/opt/intel/vtune/${VTUNE_VERSION}/vtune_amplifier_xe_2016/lib64 -l ittnotify
#
# OCFLAGS += -DVTUNE
#----------------------------------------------------------------------
# 19. Inlining choices
# USE INLINE SSE WITH EXTREME CAUTION! IT MAY GIVE WRONG RESULTS.
# SSE ASM and explicit C inlining is available for some of the library
# functions.
# Use SSE for P3 or P4 or Athlon Thunderbird and compilers, such
# as gcc that accept ASM macros
# Both SSE and C inline macros can be invoked selectively by defining
# SSE_INLINE and C_INLINE and changing the function call to the macro
# name.
# To invoke the inline macros globally (where available) without
# changing the code, define, instead, SSE_GLOBAL_INLINE or
# C_GLOBAL_INLINE.
# You may use SSE and C inlining at the same time. The SSE version
# takes precedence when both are available.
# See also the libraries Make_SSE_nasm for building non-inline SSE
# Some compilers don't like -DSSE_INLINE with the debugging -g option.
# Choose nothing or
# [ C_INLINE | C_GLOBAL_INLINE ] [ SSE_INLINE | SSE_GLOBAL_INLINE ]
INLINEOPT = -DC_GLOBAL_INLINE # -DSSE_GLOBAL_INLINE #-DC_INLINE
# There are special single-precision macros for the AMD Opteron
# To get them, uncomment the next line
#INLINEOPT += -DSSEOPTERON
#----------------------------------------------------------------------
# 20. Miscellaneous macros for performance control and metric
# Define them with a -D prefix.
#------------------------------
# Print timing statistics.
# Applications: many
# Use any combination of these
# CGTIME CG Solver
# FFTIME Fermion force
# FLTIME Link fattening
# GFTIME Gauge force
# IOTIME I/O timing
# PRTIME print time (clover_invert2)
# REMAP report remapping time for QDP, QOP in conjunction with above
CTIME = # -DCGTIME -DFFTIME -DFLTIME -DGFTIME -DREMAP -DPRTIME -DIOTIME
#------------------------------
# Profiling
# Applications: QDP
# QDP_PROFILE Generates a report for all QDP routines
CPROF =#
#------------------------------
# Troubleshooting
# Applications: All
# COM_CRC Message passing test. Checksums on all gathers.
#------------------------------
# Debugging and diagnostics
# Applications: all
# CHECK_MALLOC Report malloc/free activity.
# (Then process stdout using check_malloc.pl)
# CG_DEBUG Print debugging information for the inverters.
# CG_OK Print inverter convergence information even when OK
# REMAP_STDIO_APPEND All nodes append to stdout.
# NO_FREOPEN Don't use freopen to remap stdin and stdout
#
# HISQ_SVD_VALUES_INFO Print HISQ SVD diagnostics
# HISQ_SVD_COUNTER Print summary count of SVD uses
# HISQ_FORCE_FILTER_COUNTER Print summary count of force filter applications.
CDEBUG = -DCG_OK -DREMAP_STDIO_APPEND # -DCHECK_MALLOC
#------------------------------
# Backward compatibility
# As of version qopqdp 0.9.0 the normalization convention for the
# staggered inverter changed. If you are using a version of QOPQDP
# with the old convention, define this macro:
CCOMPAT += #-DOLD_QOPQDP_NORM
# Prior to version 7.7.2 the conversion from staggeredd to naive was peculiar.
CCOMPAT += #-DOLD_STAGGERED2NAIVE
#------------------------------
# Layout
# Applications: all
# These are currently selected only by editing Make_template.
# Choices
# layout_hyper_prime.o Standard hypercubic
# layout_timeslices.o Puts full timeslices on each node.
# layout_squares.o Puts 2D slices on each node.
# layout_hyper_tstretch.o Rarely used. Fewer timeslices on last node.
# In case node no is incommensurate with nt
# layout_timeslices_2.o Untested. Supposedly more forgiving.
#------------------------------
# Compute node grid layout
# layout_hyper_prime views the machine as a grid and selects a layout
# that distributes the lattice uniformly across the nodes and
# minimizes the surface to volume ratio. On fixed grid machines
# such as the IBM Bluegene it may be better to control the
# geometry. In that case some of our applications support
# the compiler macro FIX_NODE_GEOM. You must then provide
# and extra list of dimensions in the parameter input file.
# See e.g. ks_imp_rhmc.
CGEOM ?=#-DFIX_NODE_GEOM
#------------------------------
# I/O node grid layout
# For some applications and architectures it is more efficient to
# split large files and have a subset of processors handle the I/O.
# We define the I/O node partitions by hypercubes in the same manner
# as the compute node geometry above. The I/O node geometry must
# be commensurate with the compute node geometry.
# For applications that support it, the I/O node geometry is specified
# by the macro FIX_IONODE_GEOM. Then the parameter input file
# includes a list of dimensions.
CGEOM +=# -DFIX_IONODE_GEOM
#------------------------------
# Improved staggered CG inverter and Dslash
# Applications: ks_imp_dyn ks_imp_rhmc ks_imp_invert_multi ks_hl_spectrum
# Note, some options still require editing Make_template
# Choices
# dslash_fn.o Overlaps computation with backward gathers.
# dslash_fn2.o Does all gathers before computation
# but has fewer FORALLSITES loops
# dslash_fn_dblstore.o Double store version of dslash_fn.o
# Supports GATHER13
# DBLSTORE_FN Copies backward links. Requires more memory.
# You must also call for dslash_fn_dblstore.o for now.
# D_FN_GATHER13 Combine third and next neighbor gathers in Dslash.
# For now, works only with dslash_fn_dblstore.o
# FEWSUMS Fewer CG reduction calls
# If we are using QUDA, the backward links are unused, so we should
# avoid unecessary overhead and use the standard dslash. Note that
# dslash_fn also has hooks in place to offload any dslash_fn_field
# calls to QUDA
ifeq ($(strip ${WANTQUDA}),true)
KSCGSTORE = -DFEWSUMS
else
KSCGSTORE = -DDBLSTORE_FN -DFEWSUMS -DD_FN_GATHER13
endif
#------------------------------
# Staggered fermion force routines
# Applications: ks_imp_dyn ks_imp_rhmc
# These are currently selected only by editing Make_template
# Choices
# fermion_force_asqtad.o Optimized for the Asqtad action
# fermion_force_general.o Takes any quark action
#------------------------------
# Prefetching
# Applications: all
# PREFETCH (Not working yet)
CPREFETCH = #
#------------------------------
# Multimass improved KS CG solvers
# Applications: ks_imp_rhmc ks_measure ks_spectrum
# Choices
# KS_MULTICG=OFFSET The basic multicg solver.
# KS_MULTICG=HYBRID Solve with multicg and polish off with single mass CG.
# KS_MULTICG=FAKE Iterate the single mass solver.
# KS_MULTICG=REVERSE Iterate in reverse order
# KS_MULTICG=REVHYB Same as HYBRID but with vectors in reverse order.
# HALF_MIXED (not QUDA) If PRECISION=2, do multimass solve in single precision
# and single-mass refinements in double
# HALF_MIXED (QUDA) If PRECISION=2, use double-single mixed-precision solvers
# MAX_MIXED (QUDA) Use double-half or single-half mixed-precision solvers
# (for multi-shift, behavior is as HALF_MIXED)
# NO_REFINE No refinements except for masses with nonzero Naik eps
# CPU_REFINE Refine on CPU only (if at all), not GPU
# PRIMME_PRECOND
# POLY_EIGEN
# MATVEC_PRECOND
# CHEBYSHEV_EIGEN
# MULTISOURCE
# MULTIGRID
KSCGMULTI = -DKS_MULTICG=HYBRID # -DNO_REFINE # -DHALF_MIXED
#------------------------------
# Multifermion force routines
# Applications: ks_imp_rhmc
# Choices
# KS_MULTIFF=FNMAT Construct matrix parallel transporters
# and use with sum of outer products of sources
# KS_MULTIFF=FNMATREV Older version of FNMAT. Traverses path
# in reverse order
# KS_MULTIFF=ASVEC Use improved Asqtad, parallel transporting
# groups of source vectors. See VECLENGTH.
# Additional options
# VECLENGTH=n Number of source vectors to process in one group.
# Applies only to the ASVEC option
KSFFMULTI = -DKS_MULTIFF=FNMAT
#------------------------------
# RHMC molecular dynamics algorithm
# Applications: ks_imp_rhmc
# Choices
# (Not needed if the make target has a preset value in Make_template)
# INT_ALG=INT_LEAPFROG
# INT_ALG=INT_OMELYAN
# INT_ALG=INT_2EPS_3TO1
# INT_ALG=INT_2EPS_2TO1
# INT_ALG=INT_2G1F
# INT_ALG=INT_3G1F
# INT_ALG=INT_4MN4FP
# INT_ALG=INT_4MN5FV
# INT_ALG=INT_FOURSTEP
# INT_ALG=INT_PLAY
KSRHMCINT =#
#------------------------------
# Staggered spin-taste operator shift for applications that construct
# nonlocal interpolating operators. By default the shift operator is
# symmetric (forward and backward). This macro makes it one-sided
# (forward).
# The Fat-Naik variants of the nonlocal operators are currently
# constructed only from the forward fat links.
KSSHIFT = # -DONE_SIDED_SHIFT
#------------------------------
# Clover inverter choice
# Applications: clover_invert, clover_invert2
#
# CL_CG=BICG Biconjugate gradient
# CL_CG=CG Standard CG
# CL_CG=MR Minimum residue
# CL_CG=HOP Hopping
# HALF_MIXED Do double-precision inversion with single, or single with half (if supported)
# MAX_MIXED Do double-precision inversion with half-precision (if supported)
# SCALE_PROP Do rescaling for the clover propagator
CLCG = -DCL_CG=BICG
#------------------------------
# Propagator storage
# Applications: clover_invert2
#
# CLOV_LEAN Write intermediate propagators to disk, saving memory
# but increasing run time somewhat
CLMEM = #-DCLOV_LEAN
#----------------------------------------------------------------------
# Extra include paths
INCADD = ${INCFFTW} ${INCPRIMME} ${INCQUDA} ${INCQPHIX} ${INCQPHIXJ} ${INCGRID} ${INCVTUNE}
#----------------------------------------------------------------------
# Extra libraries
LIBADD = ${LIBFFTW} ${LIBPRIMME} ${LIBARPACK} ${LIBLAPACK} ${LIBQUDA} ${LIBQPHIX} ${LIBQPHIXJ} ${LIBGRID} ${LIBVTUNE}
#------------------------------
# Summary
CODETYPE = ${CTIME} ${CPROF} ${CDEBUG} ${CGEOM} ${KSCGSTORE} ${CPREFETCH} \
${KSCGMULTI} ${KSFFMULTI} ${KSRHMCINT} ${KSSHIFT} ${CLCG} ${CLMEM} ${CQOP} \
${CCOMPAT}
#----------------------------------------------------------------------
# MILC library make file in libraries directory.
# CHECK IT FOR FURTHER OPTIONS!
MAKELIBRARIES = Make_vanilla
#----------------------------------------------------------------------
# End of user choices. Please, also, check choices in include/config.h.
#----------------------------------------------------------------------
ifeq ($(strip ${OMP}),true)
OCFLAGS += -DOMP
OCXXFLAGS += -DOMP
endif
ifeq ($(strip ${MPP}),true)
ifeq ($(strip ${HAVEQMP}),true)
COMMTYPE = QMP
COMMPKG = com_qmp.o
else
COMMTYPE = MPI_COMMS
COMMPKG = com_mpi.o
endif
else
ifeq ($(strip ${HAVEQMP}),true)
COMMTYPE = SINGLE
COMMPKG = com_qmp.o
else
COMMTYPE = SINGLE
COMMPKG = com_vanilla.o
endif
endif
ifeq ($(strip ${HAVEQDP}),true)
QDPPREC = -DQDP_PrecisionInt=${PRECISION}
endif
ifeq ($(strip ${HAVEQOP}),true)
QOPPREC = -DQOP_PrecisionInt=${PRECISION}
endif
ifeq ($(strip ${WANTQPHIX}),true)