Revision 626233623161 () - Diff

Link to this snippet: https://friendpaste.com/4Y1TNkU4VMDOm8kjAk7js5
Embed:
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
# Rules for generating all the kernels of these types.
.PHONY: counts
.PHONY: hists
.PHONY: sorts

# Rules for detecting changes in .cu files effecting these kernels.
.PHONY: count
.PHONY: hist
.PHONY: sort

# Relative paths
# Note that the caller must define BITS
ifeq ($(BITS), 32)
CUBIN = ../cubin
ISA = ../isa
endif

ifeq ($(BITS), 64)
CUBIN = ../cubin64
ISA = ../isa64
endif

# Compiler options
NVCCFLAGS = --cubin -Xptxas=-v -arch=compute_20 -code=sm_20 -m=$(BITS)

T128 = -D NUM_THREADS=128
T256 = -D NUM_THREADS=256

INDEX = -D VALUE_TYPE_INDEX
KEY = -D VALUE_TYPE_NONE
SINGLE = -D VALUE_TYPE_SINGLE
MULTI = -D VALUE_TYPE_MULTI

LIST = -D SCATTER_TRANSACTION_LIST
SIMPLE = -D SCATTER_SIMPLE

SORTFLAGS = $(NVCCFLAGS) -D VALUES_PER_THREAD=8


# Generate all kernels.
all : \
sorts hists counts


# Generate all .isa files
counts : \
$(ISA)/count.isa

hists : \
$(ISA)/hist_simple.isa
sorts : \
$(ISA)/sort_128_8_index_simple.isa \
$(ISA)/sort_128_8_key_simple.isa \
$(ISA)/sort_128_8_single_simple.isa \
$(ISA)/sort_128_8_multi_simple.isa \
$(ISA)/sort_256_8_index_simple.isa \
$(ISA)/sort_256_8_key_simple.isa \
$(ISA)/sort_256_8_single_simple.isa \
$(ISA)/sort_256_8_multi_simple.isa

# Generate all .isa files from a pattern with cuobjdump.
$(ISA)/%.isa : $(CUBIN)/%.cubin
cuobjdump -sass $< > $@
# Define dependencies for count, hist, and sort
count : count.cu countgen.cu common.cu
hist : histgen.cu histogram.cu common.cu params.cu \
hist1.cu hist2.cu hist3.cu hist3_64.cu
sort : common.cu params.cu sort.cu sortcommon.cu sortgen.cu \
sortgeneric.cu sortscan1.cu sortscan2.cu sortscan3.cu sortstore.cu
# Build count cubins
$(CUBIN)/count.cubin : count
nvcc $(NVCCFLAGS) -o $@ countgen.cu
# Build hist cubins
$(CUBIN)/hist_simple.cubin : hist
nvcc $(NVCCFLAGS) -o $@ histgen.cu

# Build sort cubins
$(CUBIN)/sort_128_8_index_simple.cubin : sort
nvcc $(SORTFLAGS) $(T128) $(INDEX) $(SIMPLE) -o $@ sortgen.cu
$(CUBIN)/sort_128_8_key_simple.cubin : sort
nvcc $(SORTFLAGS) $(T128) $(KEY) $(SIMPLE) -o $@ sortgen.cu
$(CUBIN)/sort_128_8_single_simple.cubin : sort
nvcc $(SORTFLAGS) $(T128) $(SINGLE) $(SIMPLE) -o $@ sortgen.cu
$(CUBIN)/sort_128_8_multi_simple.cubin : sort
nvcc $(SORTFLAGS) $(T128) $(MULTI) $(SIMPLE) -o $@ sortgen.cu
$(CUBIN)/sort_256_8_index_simple.cubin : sort
nvcc $(SORTFLAGS) $(T256) $(INDEX) $(SIMPLE) -o $@ sortgen.cu
$(CUBIN)/sort_256_8_key_simple.cubin : sort
nvcc $(SORTFLAGS) $(T256) $(KEY) $(SIMPLE) -o $@ sortgen.cu
$(CUBIN)/sort_256_8_single_simple.cubin : sort
nvcc $(SORTFLAGS) $(T256) $(SINGLE) $(SIMPLE) -o $@ sortgen.cu
$(CUBIN)/sort_256_8_multi_simple.cubin : sort
nvcc $(SORTFLAGS) $(T256) $(MULTI) $(SIMPLE) -o $@ sortgen.cu