-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (31 loc) · 1.72 KB
/
Copy pathMakefile
File metadata and controls
44 lines (31 loc) · 1.72 KB
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
GPU_ARCH := sm_120
NVCC := /usr/local/cuda/bin/nvcc
pair_sort_real_gpu: src/main_real.cu
$(NVCC) -O3 -arch=$(GPU_ARCH) -std=c++20 -Xcompiler -fopenmp -lgomp -o $@ $<
pair_sort_real_cpu: src/main_real_cpu.cpp
g++ -O3 -std=c++20 -fopenmp -lgomp -o $@ $<
pair_sort_preprocess_gpu: src/main_preprocess.cu src/mem_preprocess.cuh
$(NVCC) -O3 -arch=$(GPU_ARCH) -std=c++20 -o $@ $<
pair_sort_full_gpu: src/main_full.cu src/count_and_plan.cu src/count_and_plan.cuh
$(NVCC) -O3 -arch=$(GPU_ARCH) -std=c++20 -Xcompiler -fopenmp -lgomp -o $@ src/main_full.cu src/count_and_plan.cu
# ─── Static library for Rust FFI ───────────────────────────────────
# Builds libcount_and_plan.a containing the CountAndPlan implementation
# + the C ABI shim. Rust's build.rs links against this + libcudart.
CNP_OBJS := build/count_and_plan.o build/count_and_plan_c.o
build/count_and_plan.o: src/count_and_plan.cu src/count_and_plan.cuh
@mkdir -p build
$(NVCC) -O3 -arch=$(GPU_ARCH) -std=c++20 -Xcompiler -fPIC -dc -c -o $@ $<
build/count_and_plan_c.o: src/count_and_plan_c.cu src/count_and_plan.cuh
@mkdir -p build
$(NVCC) -O3 -arch=$(GPU_ARCH) -std=c++20 -Xcompiler -fPIC -dc -c -o $@ $<
# Resolve device-relocatable symbols across the two TUs into one object.
build/count_and_plan_dlink.o: $(CNP_OBJS)
$(NVCC) -arch=$(GPU_ARCH) -dlink -Xcompiler -fPIC -o $@ $(CNP_OBJS)
build/libcount_and_plan.a: $(CNP_OBJS) build/count_and_plan_dlink.o
@mkdir -p build
ar rcs $@ $(CNP_OBJS) build/count_and_plan_dlink.o
libcount_and_plan: build/libcount_and_plan.a
clean:
rm -f pair_sort_real_gpu pair_sort_real_cpu pair_sort_preprocess_gpu pair_sort_full_gpu
rm -rf build
.PHONY: clean libcount_and_plan