-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
196 lines (156 loc) · 4.85 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
ALLGEBRA_IMAGE := ghcr.io/ricosjp/allgebra
ALLGEBRA_CUDA := cuda11_8
ALLGEBRA_CC := clang14
ALLGEBRA_TAG := 23.09.1
LLVM_DIR := 14.0.5
MONOLISH_TOP := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
.PHONY: cpu gpu gcc_cpu clang_cpu clang_gpu test_cpu test_gpu install install_cpu install_gpu in format document
MONOLISH_DIR ?= $(HOME)/lib/monolish
all: cpu gpu
##########################################
cpu: gcc_cpu
gpu: clang_gpu
install: install_cpu install_gpu
gcc_cpu:
cmake $(MONOLISH_TOP)\
--preset=cpu-avx-none \
-DCMAKE_CXX_COMPILER=g++ \
-Bbuild_cpu
cmake --build build_cpu -j `nproc`
clang_cpu:
cmake $(MONOLISH_TOP) \
--preset=cpu-avx-none \
-DCMAKE_CXX_COMPILER=clang++ \
-Bbuild_cpu
cmake --build build_cpu -j `nproc`
clang_gpu:
cmake $(MONOLISH_TOP) \
--preset=gpu-avx-none \
-DCMAKE_CXX_COMPILER=clang++ \
-Bbuild_gpu
cmake --build build_gpu -j `nproc`
clang_gpu_all:
cmake $(MONOLISH_TOP) \
--preset=gpu-avx-none \
-DCMAKE_CXX_COMPILER=clang++ \
-DMONOLISH_NVIDIA_GPU_ARCH_ALL=ON
-Bbuild_gpu_all \
cmake --build build_gpu_all -j `nproc`
a64fx:
$(MAKE) -B -j4 -f Makefile.a64fx
sxat:
$(MAKE) -B -j -f Makefile.sxat
install_cpu: cpu
cmake --build build_cpu --target install
cmake --preset=package-common -DCMAKE_INSTALL_PREFIX=$(MONOLISH_DIR)
cmake --build build/package-common --target install
install_gpu: gpu
cmake --build build_gpu --target install
cmake --preset=package-common -DCMAKE_INSTALL_PREFIX=$(MONOLISH_DIR)
cmake --build build/package-common --target install
install_gpu_all: clang_gpu_all
cmake --build build_gpu_all --target install
cmake --preset=package-common -DCMAKE_INSTALL_PREFIX=$(MONOLISH_DIR)
cmake --build build/package-common --target install
install_sxat:
$(MAKE) -B -j -f Makefile.sxat install
install_a64fx:
$(MAKE) -B -j -f Makefile.a64fx install
########################################
cpu_mpi: clang_cpu_mpi
gpu_mpi: clang_gpu_mpi
install_mpi: install_cpu_mpi install_gpu_mpi
clang_cpu_mpi:
cmake $(MONOLISH_TOP)\
--preset=cpu-avx-mpi \
-DCMAKE_C_COMPILER=mpicc \
-DCMAKE_CXX_COMPILER=mpic++ \
-Bbuild_cpu_mpi
cmake --build build_cpu_mpi -j `nproc`
clang_gpu_mpi:
cmake $(MONOLISH_TOP)\
--preset=gpu-avx-mpi \
-DCMAKE_C_COMPILER=mpicc \
-DCMAKE_CXX_COMPILER=mpic++ \
-Bbuild_gpu_mpi
cmake --build build_gpu_mpi -j `nproc`
clang_gpu_mpi_all:
cmake $(MONOLISH_TOP)\
--preset=gpu-avx-mpi \
-DCMAKE_C_COMPILER=mpicc \
-DCMAKE_CXX_COMPILER=mpic++ \
-DMONOLISH_NVIDIA_GPU_ARCH_ALL=ON \
-Bbuild_gpu_mpi_all
cmake --build build_gpu_mpi_all -j `nproc`
install_cpu_mpi: cpu_mpi
cmake --build build_cpu_mpi --target install
install_gpu_mpi: gpu_mpi
cmake --build build_gpu_mpi --target install
install_gpu_mpi_all: clang_gpu_mpi_all
cmake --build build_gpu_mpi_all --target install
install_all: install_cpu install_gpu install_cpu_mpi install_gpu_mpi
##########################################
test:
test_cpu
test_gpu
test_cpu: install_cpu
$(MAKE) -C test cpu
$(MAKE) -C test run_cpu
test_gpu: install_gpu
$(MAKE) -C test gpu
$(MAKE) -C test run_gpu
clean:
- rm -rf build*/
- $(MAKE) -f Makefile.a64fx clean
- $(MAKE) -f Makefile.sxat clean
- $(MAKE) -C test/ clean
##########################################
in_mkl_gpu:
docker run -it --rm \
--gpus all \
--cap-add SYS_ADMIN \
-e MONOLISH_DIR=/opt/monolish/ \
-e LD_LIBRARY_PATH=/opt/monolish/lib:/usr/local/lib/ \
-v $(MONOLISH_TOP):/monolish \
-w /monolish \
$(ALLGEBRA_IMAGE)/$(ALLGEBRA_CUDA)/$(ALLGEBRA_CC)/mkl:$(ALLGEBRA_TAG)
in_mkl_cpu:
docker run -it --rm \
-e MONOLISH_DIR=/opt/monolish/ \
-e LD_LIBRARY_PATH=/opt/monolish/lib:/usr/local/lib/ \
-v $(MONOLISH_TOP):/monolish \
-w /monolish \
$(ALLGEBRA_IMAGE)/$(ALLGEBRA_CUDA)/$(ALLGEBRA_CC)/mkl:$(ALLGEBRA_TAG)
in_oss_gpu:
docker run -it --rm \
--gpus all \
--cap-add SYS_ADMIN \
-e MONOLISH_DIR=/opt/monolish/ \
-e LD_LIBRARY_PATH=/opt/monolish/lib:/usr/local/lib/ \
-v $(MONOLISH_TOP):/monolish \
-w /monolish \
$(ALLGEBRA_IMAGE)/$(ALLGEBRA_CUDA)/$(ALLGEBRA_CC)/oss:$(ALLGEBRA_TAG)
in_oss_cpu:
docker run -it --rm \
-e MONOLISH_DIR=/opt/monolish/ \
-e LD_LIBRARY_PATH=/opt/monolish/lib:/usr/local/lib/ \
-v $(MONOLISH_TOP):/monolish \
-w /monolish \
$(ALLGEBRA_IMAGE)/$(ALLGEBRA_CUDA)/$(ALLGEBRA_CC)/oss:$(ALLGEBRA_TAG)
in_cpu: in_mkl_cpu
in_gpu: in_mkl_gpu
in: in_gpu
format:
docker run -it --rm \
-u `id -u`:`id -g` \
-v $(PWD):$(PWD) \
-w $(PWD) \
$(ALLGEBRA_IMAGE)/$(ALLGEBRA_CUDA)/$(ALLGEBRA_CC)/oss:$(ALLGEBRA_TAG) /usr/bin/check_format.sh
document:
rm -rf $(PWD)/build/document $(PWD)/html
docker run -it --rm \
-u `id -u`:`id -g` \
-v $(PWD):$(PWD) \
-w $(PWD) \
$(ALLGEBRA_IMAGE)/$(ALLGEBRA_CUDA)/$(ALLGEBRA_CC)/oss:$(ALLGEBRA_TAG) bash -c "cmake -Bbuild/document .; cmake --build build/document --target document"
mv $(PWD)/build/document/html $(PWD)