-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (45 loc) · 1.19 KB
/
Makefile
File metadata and controls
59 lines (45 loc) · 1.19 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# TopOpt-CUDA Makefile
# Topology Optimization using CUDA
NVCC = nvcc
CUDA_ARCH = -arch=sm_89 # RTX 4090
# Compiler flags
NVCCFLAGS = -O3 $(CUDA_ARCH) -std=c++17 -Xcompiler -Wall
NVCCFLAGS += -lineinfo # For debugging
# Libraries (cuSOLVER and cuSPARSE for coarse grid direct solver)
LIBS = -lcusolver -lcusparse
# Include paths
INCLUDES = -I./include
# Source files
SRCS = src/main.cu \
src/solver.cu \
src/cg_solver.cu \
src/optimization.cu \
src/stencil_kernels.cu \
src/multigrid_kernels.cu \
src/optimization_kernels.cu \
src/vector_ops.cu \
src/vtk_output.cu \
src/multi_gpu.cu \
src/halo_exchange.cu \
src/multi_gpu_opt.cu \
src/distributed_cg.cu \
src/distributed_stencil.cu \
src/csr_assembly.cu \
src/cusolver_solver.cu
# Object files
OBJS = $(SRCS:.cu=.o)
# Target
TARGET = top3d_cuda
.PHONY: all clean run
all: $(TARGET)
$(TARGET): $(OBJS)
$(NVCC) $(NVCCFLAGS) $(LIBS) -o $@ $^
%.o: %.cu
$(NVCC) $(NVCCFLAGS) $(INCLUDES) -c -o $@ $<
clean:
rm -f $(OBJS) $(TARGET)
run: $(TARGET)
./$(TARGET) 64 32 32 3 10
# Run with larger problem
run_large: $(TARGET)
./$(TARGET) 128 64 64 4 25