-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathGNUmakefile
1574 lines (1396 loc) · 49.7 KB
/
GNUmakefile
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
# Copyright (c) 2017-2023, University of Tennessee. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# This program is free software: you can redistribute it and/or modify it under
# the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
#
# See INSTALL.md for documentation.
#
# Set only_unit=1 to avoid compiling most of the SLATE library,
# which isn't needed by most unit testers (except test_lq, test_qr).
# Useful to avoid expensive recompilation when debugging headers.
#
# Sort lists alphabetically and end with \ to avoid merge conflicts.
# The "# End." comment avoids the next line being appended accidentally.
-include make.inc
#-------------------------------------------------------------------------------
# Define functions.
# Get parent directory, stripping trailing /.
dir_strip = ${patsubst %/,%,${dir ${1}}}
#-------------------------------------------------------------------------------
# Set defaults
# Do all ?= before strip!
prefix ?= /opt/slate
blas_int ?= int
openmp ?= 1
c_api ?= 0
fortran_api ?= 0
# Strip whitespace.
blas := ${strip ${blas}}
# MKL doesn't oversubscribe within OpenMP tasks, so it's safe and
# desirable to use multi-threaded BLAS.
ifeq (${blas},mkl)
blas_threaded ?= 1
else
blas_threaded ?= 0
endif
NVCC ?= nvcc
HIPCC ?= hipcc
hipify ?= hipify-perl
md5sum ?= tools/md5sum.pl
gpu_backend ?= auto
python ?= python3
# Strip whitespace from variables, in case make.inc had trailing spaces.
mpi := ${strip ${mpi}}
blas_int := ${strip ${blas_int}}
blas_threaded := ${strip ${blas_threaded}}
blas_fortran := ${strip ${blas_fortran}}
mkl_blacs := ${strip ${mkl_blacs}}
openmp := ${strip ${openmp}}
static := ${strip ${static}}
gpu_backend := ${strip ${gpu_backend}}
cuda_arch := ${strip ${cuda_arch}}
hip_arch := ${strip ${hip_arch}}
prefix := ${strip ${prefix}}
c_api := ${strip ${c_api}}
fortran_api := ${strip ${fortran_api}}
abs_prefix := ${abspath ${prefix}}
#-------------------------------------------------------------------------------
# Export variables to sub-make for testsweeper, BLAS++, LAPACK++.
export CXX blas blas_int blas_threaded openmp static gpu_backend
CXXFLAGS += -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD
NVCCFLAGS += -O3 -std=c++11 --compiler-options '-Wall -Wno-unused-function'
HIPCCFLAGS += -std=c++14 -DTCE_HIP -fno-gpu-rdc
force: ;
# Auto-detect CUDA, HIP, SYCL.
ifneq (,${filter-out auto cuda hip sycl none, ${gpu_backend}})
${error ERROR: gpu_backend = ${gpu_backend} is unknown}
endif
cuda = 0
ifneq (,${filter auto cuda, ${gpu_backend}})
NVCC_which := ${shell which ${NVCC} 2>/dev/null}
ifneq (${NVCC_which},)
cuda = 1
ifeq (${CUDA_PATH},)
ifneq (${CUDA_HOME},)
CUDA_PATH = ${CUDA_HOME}
else
CUDA_PATH = ${call dir_strip, ${call dir_strip, ${NVCC_which}}}
endif
endif
else ifeq (${gpu_backend},cuda)
${error ERROR: gpu_backend = ${gpu_backend}, but NVCC = ${NVCC} not found}
endif
endif
hip = 0
ifneq (${cuda},1)
ifneq (,${filter auto hip, ${gpu_backend}})
HIPCC_which = ${shell which ${HIPCC} 2>/dev/null}
ifneq (${HIPCC_which},)
hip = 1
ROCM_PATH ?= ${call dir_strip, ${call dir_strip, ${HIPCC_which}}}
else ifeq (${gpu_backend},hip)
${error ERROR: gpu_backend = ${gpu_backend}, but HIPCC = ${HIPCC} not found}
endif
endif
endif
omptarget = 0
ifneq (${cuda},1)
ifneq (${hip},1)
ifeq (${gpu_backend},sycl)
# enable the omptarget offload kernels in SLATE for oneMKL-SYCL devices
${info Note: enabling omp-target-offload kernels}
omptarget = 1
# -Wno-unused-command-line-argument avoids
# icpx warning: -Wl,-rpath,...: 'linker' input unused.
#
# -Wno-c99-extensions avoids
# icpx warning: '_Complex' is a C99 extension.
#
# -Wno-pass-failed avoids (on src/omptarget/device_transpose.cc)
# icpx warning: loop not vectorized.
#
CXXFLAGS += -fsycl -fp-model=precise -Wno-unused-command-line-argument \
-Wno-c99-extensions -Wno-pass-failed
LIBS += -lsycl
endif
endif
endif
# Default LD=ld won't work; use CXX. Can override in make.inc or environment.
ifeq (${origin LD},default)
LD = ${CXX}
endif
# Use abi-compliance-checker to compare the ABI (application binary
# interface) of 2 releases. Changing the ABI does not necessarily change
# the API (application programming interface). Rearranging a struct or
# changing a by-value argument from int64 to int doesn't change the
# API--no source code changes are required, just a recompile.
#
# if structs or routines are changed or removed:
# bump major version and reset minor, revision = 0;
# else if structs or routines are added:
# bump minor version and reset revision = 0;
# else (e.g., bug fixes):
# bump revision
#
# soversion is major ABI version.
abi_version = 1.0.0
soversion = ${word 1, ${subst ., ,${abi_version}}}
#-------------------------------------------------------------------------------
ldflags_shared = -shared
# auto-detect OS
# $OSTYPE may not be exported from the shell, so echo it
ostype := ${shell echo $${OSTYPE}}
ifneq (,${findstring darwin, ${ostype}})
# MacOS is darwin
macos = 1
# MacOS needs shared library's path set, and shared library version.
ldflags_shared += -install_name @rpath/${notdir $@} \
-current_version ${abi_version} \
-compatibility_version ${soversion}
so = dylib
so2 = .dylib
# on macOS, .dylib comes after version: libfoo.4.dylib
else
# Linux needs shared library's soname.
ldflags_shared += -Wl,-soname,${notdir ${lib_soname}}
so = so
so1 = .so
# on Linux, .so comes before version: libfoo.so.4
endif
# Check if Fortran compiler exists.
# Note that 'make' sets ${FC} to f77 by default.
have_fortran := ${shell which ${FC} 2>/dev/null}
ifeq (${have_fortran},)
fortran_api = 0
endif
# Fortran API depends on C API.
ifneq (${c_api},1)
fortran_api = 0
endif
#-------------------------------------------------------------------------------
# if shared
ifneq (${static},1)
CXXFLAGS += -fPIC
LDFLAGS += -fPIC
FCFLAGS += -fPIC
NVCCFLAGS += --compiler-options '-fPIC'
HIPCCFLAGS += -fPIC
lib_ext = ${so}
else
lib_ext = a
endif
#-------------------------------------------------------------------------------
# if OpenMP
ifeq (${openmp},1)
ifeq (${gpu_backend},sycl)
# Intel icpx options for OpenMP offload.
CXXFLAGS += -fiopenmp -fopenmp-targets=spir64
LDFLAGS += -fiopenmp -fopenmp-targets=spir64
else
# Most other compilers recognize this.
CXXFLAGS += -fopenmp
LDFLAGS += -fopenmp
endif
else
${error ERROR: unsupported `openmp=${openmp}`. OpenMP is required.}
endif
#-------------------------------------------------------------------------------
# if MPI
ifneq (,${filter mpi%,${CXX}})
# CXX = mpicxx, mpic++, ...
# Generic MPI via compiler wrapper. No flags to set.
ifneq (${mpi},)
${warning `CXX=${CXX}` MPI compiler overrides `mpi=${mpi}`}
endif
else ifeq (${mpi},cray)
# Cray MPI via compiler wrapper. No flags to set.
else ifeq (${mpi},1)
# Generic MPI.
LIBS += -lmpi
else ifeq (${mpi},spectrum)
# IBM Spectrum MPI
LIBS += -lmpi_ibm
else
${error ERROR: unknown `mpi=${mpi}`. MPI is required. \
Either set CXX to an MPI compiler named `mpi...`, such as `mpicxx`, \
or set mpi to one of 1, cray, or spectrum}
endif
#-------------------------------------------------------------------------------
# BLAS and LAPACK
# todo: really should get these libraries from BLAS++ and LAPACK++.
# If using shared libraries, and Fortran files that directly call BLAS are
# removed, BLAS++ would pull in the BLAS library for us.
ifeq (${blas},mkl)
# Intel MKL
# Auto-detect whether to use Intel or GNU conventions.
# Won't detect if CXX = mpicxx.
ifeq (${CXX},icpc)
blas_fortran = ifort
endif
# BLAS is Intel MKL and SLATE is using the SYCL backend
# Use ifort, threaded-blas and mkl_intel_thread
ifeq (${gpu_backend},sycl)
blas_fortran = ifort
blas_threaded = 1
endif
ifeq (${macos},1)
# MKL on MacOS (version 20180001) has only Intel Fortran version
blas_fortran = ifort
endif
ifeq (${blas_fortran},ifort)
# use Intel Fortran conventions
ifeq (${blas_int},int64)
LIBS += -lmkl_intel_ilp64
else
LIBS += -lmkl_intel_lp64
endif
# if threaded, use Intel OpenMP (iomp5)
ifeq (${blas_threaded},1)
LIBS += -lmkl_intel_thread
else
LIBS += -lmkl_sequential
endif
else
# use GNU Fortran conventions
ifeq (${blas_int},int64)
LIBS += -lmkl_gf_ilp64
else
LIBS += -lmkl_gf_lp64
endif
# if threaded, use GNU OpenMP (gomp)
ifeq (${blas_threaded},1)
LIBS += -lmkl_gnu_thread
else
LIBS += -lmkl_sequential
endif
endif
LIBS += -lmkl_core -lpthread -lm -ldl
# MKL on MacOS doesn't include ScaLAPACK; use default.
# For others, link with appropriate version of ScaLAPACK and BLACS.
ifneq (${macos},1)
ifeq (${mkl_blacs},openmpi)
ifeq (${blas_int},int64)
SCALAPACK_LIBRARIES ?= -lmkl_scalapack_ilp64 -lmkl_blacs_openmpi_ilp64
else
SCALAPACK_LIBRARIES ?= -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64
endif
else
ifeq (${blas_int},int64)
SCALAPACK_LIBRARIES ?= -lmkl_scalapack_ilp64 -lmkl_blacs_intelmpi_ilp64
else
SCALAPACK_LIBRARIES ?= -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
endif
endif
endif
else ifeq (${blas},essl)
# IBM ESSL
# todo threaded, int64
# hmm... likely LAPACK won't be int64 even if ESSL is.
LIBS += -lessl -llapack
else ifeq (${blas},openblas)
# OpenBLAS
LIBS += -lopenblas
else ifeq (${blas},libsci)
# Cray LibSci
# no LIBS to add
SCALAPACK_LIBRARIES ?=
else
${error ERROR: unknown `blas=${blas}`. Set blas to one of mkl, essl, \
openbblas, libsci, accelerate}
endif
# If not set by user or above, set default.
SCALAPACK_LIBRARIES ?= -lscalapack
#-------------------------------------------------------------------------------
# if CUDA
ifeq (${cuda},1)
# Generate flags for which CUDA architectures to build.
# cuda_arch_ is a local copy to modify.
cuda_arch_ = ${cuda_arch}
ifneq (,${findstring kepler, ${cuda_arch_}})
cuda_arch_ += sm_30
endif
ifneq (,${findstring maxwell, ${cuda_arch_}})
cuda_arch_ += sm_50
endif
ifneq (,${findstring pascal, ${cuda_arch_}})
cuda_arch_ += sm_60
endif
ifneq (,${findstring volta, ${cuda_arch_}})
cuda_arch_ += sm_70
endif
ifneq (,${findstring turing, ${cuda_arch_}})
cuda_arch_ += sm_75
endif
ifneq (,${findstring ampere, ${cuda_arch_}})
cuda_arch_ += sm_80
endif
ifneq (,${findstring hopper, ${cuda_arch_}})
cuda_arch_ += sm_90
endif
# Extract CUDA sm architectures.
sms = ${sort ${patsubst sm_%, %, ${filter sm_%, ${cuda_arch_}}}}
# Generate nvcc gencode options for all sm_XY in cuda_arch_.
# code=sm_XX is binary, code=compute_XX is PTX
nv_sm = ${foreach sm, ${sms},-gencode arch=compute_${sm},code=sm_${sm}}
nv_compute = ${foreach sm, ${sms},-gencode arch=compute_${sm},code=compute_${sm}}
ifeq (${sms},)
# Error if cuda_arch is not empty and sms is empty.
ifneq (${cuda_arch},)
${error ERROR: unknown `cuda_arch=${cuda_arch}`. Set cuda_arch \
to one or more of kepler, maxwell, pascal, volta, \
turing, ampere, hopper, \
or valid sm_XY from nvcc -h}
endif
else
# Get last option (last 2 words) of nv_compute.
nwords := ${words ${nv_compute}}
nwords_1 := ${shell expr ${nwords} - 1}
nv_compute_last := ${wordlist ${nwords_1}, ${nwords}, ${nv_compute}}
endif
# Use all sm_XX (binary), and the last compute_XX (PTX) for forward compatibility.
NVCCFLAGS += ${nv_sm} ${nv_compute_last}
libdir := ${CUDA_PATH}/lib64
ifeq (${wildcard ${libdir}},)
libdir := ${CUDA_PATH}/lib
endif
FLAGS += -I${CUDA_PATH}/include
LIBS += -L${libdir} -Wl,-rpath,${libdir} -lcusolver -lcublas -lcudart
endif
#-------------------------------------------------------------------------------
# if HIP
ifeq (${hip},1)
# Generate flags for which HIP architectures to build.
# hip_arch_ is a local copy to modify.
hip_arch_ = ${hip_arch}
ifneq (,${findstring mi25, ${hip_arch_}})
hip_arch_ += gfx900
endif
ifneq (,${findstring mi50, ${hip_arch_}})
hip_arch_ += gfx906
endif
ifneq (,${findstring mi100, ${hip_arch_}})
hip_arch_ += gfx908
endif
ifneq (,${findstring mi200, ${hip_arch_}})
hip_arch_ += gfx90a
endif
# Extract AMD gfx architectures.
gfx = ${sort ${filter gfx%, ${hip_arch_}}}
ifeq (${gfx},)
# Error if hip_arch is not empty and gfx is empty.
ifneq (${hip_arch},)
${error ERROR: unknown `hip_arch=${hip_arch}`. Set hip_arch \
to one or more of mi25, mi50, mi100, or valid gfxXYZ. \
See https://llvm.org/docs/AMDGPUUsage.html}
endif
endif
# Generate hipcc target options for all gfx in hip_arch_.
offload_arch = ${foreach arch, ${gfx},--offload-arch=${arch}}
HIPCCFLAGS += ${offload_arch}
FLAGS += -I${ROCM_PATH}/include -D__HIP_PLATFORM_AMD__
LIBS += -L${ROCM_PATH}/lib -Wl,-rpath,${ROCM_PATH}/lib -lrocsolver -lrocblas -lamdhip64
# ROCm 4.0 has errors in its headers that produce excessive warnings.
CXXFLAGS := ${filter-out -pedantic, ${CXXFLAGS}}
CXXFLAGS += -Wno-unused-result
endif
#-------------------------------------------------------------------------------
# Files
# types and classes
slate_src += \
src/auxiliary/Debug.cc \
src/auxiliary/Trace.cc \
src/core/Memory.cc \
src/core/enums.cc \
src/core/types.cc \
src/version.cc \
# End. Add alphabetically.
# internal
slate_src += \
src/internal/internal_comm.cc \
src/internal/internal_util.cc \
# End. Add alphabetically.
# Most unit testers don't need the whole library, only the above subset.
ifneq (${only_unit},1)
slate_src += \
src/internal/internal_copyhb2st.cc \
src/internal/internal_copytb2bd.cc \
src/internal/internal_gbnorm.cc \
src/internal/internal_geadd.cc \
src/internal/internal_gebr.cc \
src/internal/internal_gecopy.cc \
src/internal/internal_gerbt.cc \
src/internal/internal_rbt_generate.cc \
src/internal/internal_gemm.cc \
src/internal/internal_gemmA.cc \
src/internal/internal_genorm.cc \
src/internal/internal_geqrf.cc \
src/internal/internal_he2hb_gemm.cc \
src/internal/internal_he2hb_hemm.cc \
src/internal/internal_he2hb_her2k_offdiag_ranks.cc \
src/internal/internal_he2hb_trmm.cc \
src/internal/internal_gescale.cc \
src/internal/internal_gescale_row_col.cc \
src/internal/internal_geset.cc \
src/internal/internal_getrf.cc \
src/internal/internal_getrf_nopiv.cc \
src/internal/internal_getrf_tntpiv.cc \
src/internal/internal_hbnorm.cc \
src/internal/internal_hebr.cc \
src/internal/internal_hegst.cc \
src/internal/internal_hemm.cc \
src/internal/internal_hemmA.cc \
src/internal/internal_henorm.cc \
src/internal/internal_her2k.cc \
src/internal/internal_herk.cc \
src/internal/internal_hettmqr.cc \
src/internal/internal_norm1est.cc \
src/internal/internal_potrf.cc \
src/internal/internal_reduce_info.cc \
src/internal/internal_swap.cc \
src/internal/internal_symm.cc \
src/internal/internal_synorm.cc \
src/internal/internal_syr2k.cc \
src/internal/internal_syrk.cc \
src/internal/internal_trmm.cc \
src/internal/internal_trnorm.cc \
src/internal/internal_trsm.cc \
src/internal/internal_trsmA.cc \
src/internal/internal_trtri.cc \
src/internal/internal_trtrm.cc \
src/internal/internal_ttlqt.cc \
src/internal/internal_ttmlq.cc \
src/internal/internal_ttmqr.cc \
src/internal/internal_ttqrt.cc \
src/internal/internal_tzadd.cc \
src/internal/internal_tzcopy.cc \
src/internal/internal_tzscale.cc \
src/internal/internal_tzset.cc \
src/internal/internal_unmlq.cc \
src/internal/internal_unmqr.cc \
src/internal/internal_unmtr_hb2st.cc \
# End. Add alphabetically.
endif
#-------------------------------------------------------------------------------
# device
cuda_src := \
src/cuda/device_geadd.cu \
src/cuda/device_gecopy.cu \
src/cuda/device_genorm.cu \
src/cuda/device_gescale.cu \
src/cuda/device_gescale_row_col.cu \
src/cuda/device_geset.cu \
src/cuda/device_henorm.cu \
src/cuda/device_synorm.cu \
src/cuda/device_transpose.cu \
src/cuda/device_trnorm.cu \
src/cuda/device_tzadd.cu \
src/cuda/device_tzcopy.cu \
src/cuda/device_tzscale.cu \
src/cuda/device_tzset.cu \
# End. Add alphabetically.
cuda_hdr := \
src/cuda/device_util.cuh
hip_src := ${patsubst src/cuda/%.cu,src/hip/%.hip.cc,${cuda_src}}
hip_hdr := ${patsubst src/cuda/%.cuh,src/hip/%.hip.hh,${cuda_hdr}}
# OpenMP implementations of device kernels
omptarget_src := \
src/omptarget/device_geadd.cc \
src/omptarget/device_gecopy.cc \
src/omptarget/device_genorm.cc \
src/omptarget/device_gescale.cc \
src/omptarget/device_gescale_row_col.cc \
src/omptarget/device_geset.cc \
src/omptarget/device_henorm.cc \
src/omptarget/device_synorm.cc \
src/omptarget/device_transpose.cc \
src/omptarget/device_trnorm.cc \
src/omptarget/device_tzadd.cc \
src/omptarget/device_tzcopy.cc \
src/omptarget/device_tzscale.cc \
src/omptarget/device_tzset.cc \
# End. Add alphabetically.
ifeq (${cuda},1)
slate_src += ${cuda_src}
else ifeq (${hip},1)
slate_src += ${hip_src}
else
# Used for both OpenMP offload (${omptarget} == 1) and as stubs for
# CPU-only build.
slate_src += ${omptarget_src}
endif
#-------------------------------------------------------------------------------
# driver
ifneq (${only_unit},1)
slate_src += \
src/add.cc \
src/bdsqr.cc \
src/cholqr.cc \
src/colNorms.cc \
src/copy.cc \
src/gbmm.cc \
src/gbsv.cc \
src/gbtrf.cc \
src/gbtrs.cc \
src/ge2tb.cc \
src/gecondest.cc \
src/gelqf.cc \
src/gerbt.cc \
src/gels.cc \
src/gels_cholqr.cc \
src/gels_qr.cc \
src/gemm.cc \
src/gemmA.cc \
src/gemmC.cc \
src/geqrf.cc \
src/gesv.cc \
src/gesv_mixed.cc \
src/gesv_mixed_gmres.cc \
src/gesv_nopiv.cc \
src/gesv_rbt.cc \
src/getrf.cc \
src/getrf_nopiv.cc \
src/getrf_tntpiv.cc \
src/getri.cc \
src/getriOOP.cc \
src/getrs.cc \
src/getrs_nopiv.cc \
src/hb2st.cc \
src/hbmm.cc \
src/he2hb.cc \
src/heev.cc \
src/hegst.cc \
src/hegv.cc \
src/hemm.cc \
src/hemmA.cc \
src/hemmC.cc \
src/her2k.cc \
src/herk.cc \
src/hesv.cc \
src/hetrf.cc \
src/hetrs.cc \
src/norm.cc \
src/pbsv.cc \
src/pbtrf.cc \
src/pbtrs.cc \
src/pocondest.cc \
src/posv.cc \
src/posv_mixed.cc \
src/posv_mixed_gmres.cc \
src/potrf.cc \
src/potri.cc \
src/potrs.cc \
src/print.cc \
src/redistribute.cc \
src/scale.cc \
src/scale_row_col.cc \
src/set.cc \
src/set_lambdas.cc \
src/stedc.cc \
src/stedc_deflate.cc \
src/stedc_merge.cc \
src/stedc_secular.cc \
src/stedc_solve.cc \
src/stedc_sort.cc \
src/stedc_z_vector.cc \
src/steqr.cc \
src/steqr_impl.cc \
src/sterf.cc \
src/svd.cc \
src/symm.cc \
src/syr2k.cc \
src/syrk.cc \
src/tb2bd.cc \
src/tbsm.cc \
src/tbsmPivots.cc \
src/trcondest.cc \
src/trmm.cc \
src/trsm.cc \
src/trsmA.cc \
src/trsmB.cc \
src/trtri.cc \
src/trtrm.cc \
src/unmlq.cc \
src/unmbr_ge2tb.cc \
src/unmqr.cc \
src/unmtr_hb2st.cc \
src/unmtr_he2hb.cc \
src/work/work_trmm.cc \
src/work/work_trsm.cc \
src/work/work_trsmA.cc \
# End. Add alphabetically.
endif
# C API
ifeq (${c_api},1)
slate_src += \
src/c_api/matrix.cc \
src/c_api/util.cc \
src/c_api/wrappers.cc \
src/c_api/wrappers_precisions.cc \
# End. Add alphabetically.
endif
# Fortran module
ifeq (${fortran_api},1)
slate_src += \
src/fortran/slate_module.f90 \
# End. Add alphabetically.
endif
# main tester
tester_src += \
test/matrix_params.cc \
test/matrix_utils.cc \
test/test.cc \
test/test_add.cc \
test/test_bdsqr.cc \
test/test_copy.cc \
test/test_gbmm.cc \
test/test_gbnorm.cc \
test/test_gbsv.cc \
test/test_ge2tb.cc \
test/test_gecondest.cc \
test/test_gelqf.cc \
test/test_gels.cc \
test/test_gemm.cc \
test/test_geqrf.cc \
test/test_gesv.cc \
test/test_getri.cc \
test/test_hb2st.cc \
test/test_hbmm.cc \
test/test_hbnorm.cc \
test/test_he2hb.cc \
test/test_heev.cc \
test/test_hegst.cc \
test/test_hegv.cc \
test/test_hemm.cc \
test/test_her2k.cc \
test/test_herk.cc \
test/test_hesv.cc \
test/test_matgen.cc \
test/test_norm.cc \
test/test_pbsv.cc \
test/test_pocondest.cc \
test/test_posv.cc \
test/test_potri.cc \
test/test_scale.cc \
test/test_scale_row_col.cc \
test/test_set.cc \
test/test_stedc.cc \
test/test_stedc_deflate.cc \
test/test_stedc_secular.cc \
test/test_stedc_sort.cc \
test/test_stedc_z_vector.cc \
test/test_steqr.cc \
test/test_sterf.cc \
test/test_svd.cc \
test/test_symm.cc \
test/test_syr2k.cc \
test/test_syrk.cc \
test/test_tb2bd.cc \
test/test_tbsm.cc \
test/test_trcondest.cc \
test/test_trmm.cc \
test/test_trsm.cc \
test/test_trtri.cc \
test/test_unmqr.cc \
test/test_unmtr_hb2st.cc \
test/test_unmtr_he2hb.cc \
# End. Add alphabetically.
# Compile fixes for ScaLAPACK routines if Fortran compiler ${FC} exists.
ifneq (${SCALAPACK_LIBRARIES},none)
ifneq (${have_fortran},)
tester_src += \
test/pslange.f \
test/pdlange.f \
test/pclange.f \
test/pzlange.f \
test/pslansy.f \
test/pdlansy.f \
test/pclansy.f \
test/pzlansy.f \
test/pslantr.f \
test/pdlantr.f \
test/pclantr.f \
test/pzlantr.f \
# End. Add alphabetically, by base name after precision.
endif
endif
# unit testers
unit_src = \
unit_test/test_BandMatrix.cc \
unit_test/test_HermitianMatrix.cc \
unit_test/test_LockGuard.cc \
unit_test/test_Matrix.cc \
unit_test/test_Memory.cc \
unit_test/test_OmpSetMaxActiveLevels.cc \
unit_test/test_SymmetricMatrix.cc \
unit_test/test_Tile.cc \
unit_test/test_Tile_kernels.cc \
unit_test/test_TrapezoidMatrix.cc \
unit_test/test_TriangularBandMatrix.cc \
unit_test/test_TriangularMatrix.cc \
unit_test/test_func.cc \
unit_test/test_geadd.cc \
unit_test/test_gecopy.cc \
unit_test/test_gescale.cc \
unit_test/test_geset.cc \
unit_test/test_internal_blas.cc \
unit_test/test_norm.cc \
unit_test/test_util.cc \
# End. Add alphabetically.
ifeq (${c_api},1)
unit_src += \
unit_test/test_c_api.cc
endif
ifneq (${only_unit},1)
unit_src += \
unit_test/test_lq.cc \
unit_test/test_qr.cc \
# End. Add alphabetically.
endif
# unit test framework
unit_test_obj = \
unit_test/unit_test.o
slate_obj = ${addsuffix .o, ${basename ${slate_src}}}
tester_obj = ${addsuffix .o, ${basename ${tester_src}}}
unit_obj = ${addsuffix .o, ${basename ${unit_src}}}
dep = ${addsuffix .d, ${basename ${slate_src} \
${tester_src} ${unit_src} \
${unit_test_obj}}}
tester = test/tester
unit_test = ${basename ${unit_src}}
pkg = lib/pkgconfig/slate.pc
# For `tester --debug`, lldb may need test.o compiled with -O0 (after -O3)
# to see variable `i`.
test/test.o: CXXFLAGS += -O0
#-------------------------------------------------------------------------------
# Get Mercurial id, and make version.o depend on it via .id file.
ifneq (${wildcard .git},)
id := ${shell git rev-parse --short HEAD}
src/version.o: CXXFLAGS += -DSLATE_ID='"${id}"'
endif
last_id := ${shell [ -e .id ] && cat .id || echo 'NA'}
ifneq (${id},${last_id})
.id: force
endif
.id:
echo ${id} > .id
src/version.o: .id
#-------------------------------------------------------------------------------
# SLATE specific flags and libraries
# FLAGS accumulates definitions, include dirs, etc. for both CXX and NVCC.
# FLAGS += -I.
FLAGS += -I./blaspp/include
FLAGS += -I./lapackpp/include
FLAGS += -I./include
FLAGS += -I./src
CXXFLAGS += ${FLAGS}
NVCCFLAGS += ${FLAGS}
HIPCCFLAGS += ${FLAGS}
# libraries to create libslate.so
LDFLAGS += -L./blaspp/lib
LDFLAGS += -L./lapackpp/lib
LIBS := -lblaspp -llapackpp ${LIBS}
# additional flags and libraries for testers
${tester_obj}: CXXFLAGS += -I./testsweeper
${unit_obj}: CXXFLAGS += -I./testsweeper
${unit_test_obj}: CXXFLAGS += -I./testsweeper
TEST_LDFLAGS = ${LDFLAGS} -L./lib -Wl,-rpath,${abspath ./lib}
TEST_LDFLAGS += -L./testsweeper -Wl,-rpath,${abspath ./testsweeper}
TEST_LDFLAGS += -Wl,-rpath,${abspath ./blaspp/lib}
TEST_LDFLAGS += -Wl,-rpath,${abspath ./lapackpp/lib}
TEST_LIBS += -lslate -lslate_matgen -ltestsweeper ${LIBS}
ifneq (${SCALAPACK_LIBRARIES},none)
TEST_LIBS += ${SCALAPACK_LIBRARIES}
CXXFLAGS += -DSLATE_HAVE_SCALAPACK
endif
UNIT_LDFLAGS = ${LDFLAGS} -L./lib -Wl,-rpath,${abspath ./lib}
UNIT_LDFLAGS += -L./testsweeper -Wl,-rpath,${abspath ./testsweeper}
UNIT_LDFLAGS += -Wl,-rpath,${abspath ./blaspp/lib}
UNIT_LDFLAGS += -Wl,-rpath,${abspath ./lapackpp/lib}
UNIT_LIBS = -lslate -ltestsweeper ${LIBS}
#-------------------------------------------------------------------------------
# Rules
.DELETE_ON_ERROR:
.SUFFIXES:
.PHONY: all docs hooks lib test tester unit_test clean distclean testsweeper blaspp lapackpp
.DEFAULT_GOAL := all
all: lib unit_test hooks
ifneq (${only_unit},1)
all: tester lapack_api matgen
install: lapack_api matgen
ifneq (${SCALAPACK_LIBRARIES},none)
all: scalapack_api
install: scalapack_api
endif
endif
install: lib ${pkg}
cd blaspp && ${MAKE} install prefix=${abs_prefix}
@echo
cd lapackpp && ${MAKE} install prefix=${abs_prefix}
@echo
mkdir -p ${DESTDIR}${abs_prefix}/include/slate/internal
mkdir -p ${DESTDIR}${abs_prefix}/lib${LIB_SUFFIX}
mkdir -p ${DESTDIR}${abs_prefix}/lib${LIB_SUFFIX}/pkgconfig
cp include/slate/*.hh ${DESTDIR}${abs_prefix}/include/slate/
cp include/slate/internal/*.hh ${DESTDIR}${abs_prefix}/include/slate/internal/
cp -av lib/lib* ${DESTDIR}${abs_prefix}/lib${LIB_SUFFIX}/
cp ${pkg} ${DESTDIR}${abs_prefix}/lib${LIB_SUFFIX}/pkgconfig/
if [ ${c_api} -eq 1 ]; then \
mkdir -p ${DESTDIR}${abs_prefix}/include/slate/c_api; \
cp include/slate/c_api/*.h ${DESTDIR}${abs_prefix}/include/slate/c_api; \
fi
if [ ${fortran_api} -eq 1 ]; then \
cp slate.mod ${DESTDIR}${abs_prefix}/include/; \
fi
uninstall:
cd blaspp && ${MAKE} uninstall prefix=${abs_prefix}
@echo
cd lapackpp && ${MAKE} uninstall prefix=${abs_prefix}
@echo
${RM} ${DESTDIR}${abs_prefix}/include/slate.mod
${RM} -r ${DESTDIR}${abs_prefix}/include/slate
${RM} ${DESTDIR}${abs_prefix}/lib${LIB_SUFFIX}/libslate*
${RM} ${DESTDIR}${abs_prefix}/lib${LIB_SUFFIX}/pkgconfig/slate.pc
docs:
doxygen docs/doxygen/doxyfile.conf
@echo "------------------------------------------------------------"
@echo "Errors:"
perl -pe 's@^/.*?slate/@@' docs/doxygen/errors.txt
#-------------------------------------------------------------------------------
# C API
ifeq (${c_api},1)
include/slate/c_api/wrappers.h: src/c_api/wrappers.cc
${python} tools/c_api/generate_wrappers.py $< $@ \
src/c_api/wrappers_precisions.cc
include/slate/c_api/matrix.h: include/slate/Tile.hh include/slate/types.hh
${python} tools/c_api/generate_matrix.py $^ $@ src/c_api/matrix.cc
src/c_api/util.hh: include/slate/c_api/types.h
${python} tools/c_api/generate_util.py $< $@ src/c_api/util.cc
src/c_api/wrappers_precisions.cc: include/slate/c_api/wrappers.h src/c_api/util.hh
src/c_api/matrix.cc: include/slate/c_api/matrix.h src/c_api/util.hh
src/c_api/util.cc: src/c_api/util.hh
src/c_api/wrappers.o: include/slate/c_api/wrappers.h src/c_api/util.hh
generate: include/slate/c_api/wrappers.h
generate: include/slate/c_api/matrix.h
generate: src/c_api/util.hh
endif
#-------------------------------------------------------------------------------
# Fortran module
ifeq (${fortran_api},1)
src/fortran/slate_module.f90: include/slate/c_api/wrappers.h \
include/slate/c_api/types.h \
include/slate/c_api/matrix.h
${python} tools/fortran/generate_fortran_module.py $^ --output $@
generate: src/fortran/slate_module.f90
endif
#-------------------------------------------------------------------------------
# testsweeper library
testsweeper_src = ${wildcard testsweeper/*.hh testsweeper/*.cc}
testsweeper = testsweeper/libtestsweeper.${lib_ext}
${testsweeper}: ${testsweeper_src}
cd testsweeper && ${MAKE} lib
testsweeper: ${testsweeper}
#-------------------------------------------------------------------------------
# BLAS++ library
blaspp_src = ${wildcard blaspp/include/blas/*.h \
blaspp/include/blas/*.hh \
blaspp/src/*.cc}
blaspp = blaspp/lib/libblaspp.${lib_ext}
# dependency on testsweeper serializes compiles
${blaspp}: ${blaspp_src} | ${testsweeper}
cd blaspp && ${MAKE} lib