-
Notifications
You must be signed in to change notification settings - Fork 146
/
Makefile
111 lines (85 loc) · 2.09 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
EIGEN_PREFIX = "3bb6a48d8c171cf20b5f8e48bfb4e424fbd4f79e"
EIGEN_URL = "https://gitlab.com/libeigen/eigen/-/archive/"
TARGETS = qsim
TESTS = run-cxx-tests
CXX=g++
NVCC=nvcc
HIPCC=hipcc
CXXFLAGS = -O3 -fopenmp
ARCHFLAGS = -march=native
NVCCFLAGS = -O3
HIPCCFLAGS = -O3
# CUQUANTUM_ROOT should be set.
CUSTATEVECFLAGS = -I$(CUQUANTUM_ROOT)/include -L${CUQUANTUM_ROOT}/lib -L$(CUQUANTUM_ROOT)/lib64 -lcustatevec -lcublas
PYBIND11 = true
export CXX
export CXXFLAGS
export ARCHFLAGS
export NVCC
export NVCCFLAGS
export CUSTATEVECFLAGS
export HIPCC
export HIPCCFLAGS
ifeq ($(PYBIND11), true)
TARGETS += pybind
TESTS += run-py-tests
endif
.PHONY: all
all: $(TARGETS)
.PHONY: qsim
qsim:
$(MAKE) -C apps/ qsim
.PHONY: qsim-cuda
qsim-cuda:
$(MAKE) -C apps/ qsim-cuda
.PHONY: qsim-custatevec
qsim-custatevec:
$(MAKE) -C apps/ qsim-custatevec
.PHONY: qsim-hip
qsim-hip:
$(MAKE) -C apps/ qsim-hip
.PHONY: pybind
pybind:
$(MAKE) -C pybind_interface/ pybind
.PHONY: cxx-tests
cxx-tests: eigen
$(MAKE) -C tests/ cxx-tests
.PHONY: cuda-tests
cuda-tests:
$(MAKE) -C tests/ cuda-tests
.PHONY: custatevec-tests
custatevec-tests:
$(MAKE) -C tests/ custatevec-tests
.PHONY: hip-tests
hip-tests:
$(MAKE) -C tests/ hip-tests
.PHONY: run-cxx-tests
run-cxx-tests: cxx-tests
$(MAKE) -C tests/ run-cxx-tests
.PHONY: run-cuda-tests
run-cuda-tests: cuda-tests
$(MAKE) -C tests/ run-cuda-tests
.PHONY: run-custatevec-tests
run-custatevec-tests: custatevec-tests
$(MAKE) -C tests/ run-custatevec-tests
.PHONY: run-hip-tests
run-hip-tests: hip-tests
$(MAKE) -C tests/ run-hip-tests
PYTESTS = $(shell find qsimcirq_tests/ -name '*_test.py')
.PHONY: run-py-tests
run-py-tests: pybind
for exe in $(PYTESTS); do if ! python3 -m pytest $$exe; then exit 1; fi; done
.PHONY: run-tests
run-tests: $(TESTS)
eigen:
$(shell\
rm -rf eigen;\
wget $(EIGEN_URL)/$(EIGEN_PREFIX)/eigen-$(EIGEN_PREFIX).tar.gz;\
tar -xf eigen-$(EIGEN_PREFIX).tar.gz && mv eigen-$(EIGEN_PREFIX) eigen;\
rm eigen-$(EIGEN_PREFIX).tar.gz;)
.PHONY: clean
clean:
rm -rf eigen;
-$(MAKE) -C apps/ clean
-$(MAKE) -C tests/ clean
-$(MAKE) -C pybind_interface/ clean