-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (58 loc) · 2.05 KB
/
Makefile
File metadata and controls
77 lines (58 loc) · 2.05 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Makefile for rummage - GPU Nostr Key Search
SRCDIR = src
SRC = $(SRCDIR)/rummage.cpp \
$(SRCDIR)/CPU/Point.cpp \
$(SRCDIR)/CPU/Int.cpp \
$(SRCDIR)/CPU/IntMod.cpp \
$(SRCDIR)/CPU/SECP256K1.cpp
OBJDIR = obj
OBJET = $(addprefix $(OBJDIR)/, \
GPU/GPURummage.o \
CPU/Point.o \
CPU/Int.o \
CPU/IntMod.o \
CPU/SECP256K1.o \
rummage.o \
)
CCAP = 86
CUDA = /usr/local/cuda-11.8
CXX = g++
CXXCUDA = /usr/bin/g++
# GPU Performance Configuration
# Adjust these based on your GPU (see docs/PERFORMANCE.md)
NOSTR_BLOCKS_PER_GRID = 512
NOSTR_THREADS_PER_BLOCK = 256
KEYS_PER_THREAD_BATCH = 64
CXXFLAGS = -DWITHGPU -m64 -mssse3 -Wno-write-strings -O2 -I$(SRCDIR) -I$(CUDA)/include \
-DNOSTR_BLOCKS_PER_GRID=$(NOSTR_BLOCKS_PER_GRID) \
-DNOSTR_THREADS_PER_BLOCK=$(NOSTR_THREADS_PER_BLOCK) \
-DKEYS_PER_THREAD_BATCH=$(KEYS_PER_THREAD_BATCH)
LFLAGS = /usr/lib/x86_64-linux-gnu/libgmp.so.10 -lpthread -L$(CUDA)/lib64 -lcudart -lcurand
NVCC = $(CUDA)/bin/nvcc
#--------------------------------------------------------------------
all: rummage
$(OBJDIR)/GPU/GPURummage.o: $(SRCDIR)/GPU/GPURummage.cu
$(NVCC) -allow-unsupported-compiler --compile --compiler-options -fPIC -ccbin $(CXXCUDA) -m64 -O2 -I$(SRCDIR) -I$(CUDA)/include \
-DNOSTR_BLOCKS_PER_GRID=$(NOSTR_BLOCKS_PER_GRID) \
-DNOSTR_THREADS_PER_BLOCK=$(NOSTR_THREADS_PER_BLOCK) \
-DKEYS_PER_THREAD_BATCH=$(KEYS_PER_THREAD_BATCH) \
-gencode=arch=compute_$(CCAP),code=sm_$(CCAP) -o $(OBJDIR)/GPU/GPURummage.o -c $(SRCDIR)/GPU/GPURummage.cu
$(OBJDIR)/%.o : $(SRCDIR)/%.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
$(OBJDIR)/CPU/%.o : $(SRCDIR)/CPU/%.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
rummage: $(OBJET)
@echo Making rummage...
$(CXX) $(OBJET) $(LFLAGS) -o rummage
$(OBJET): | $(OBJDIR) $(OBJDIR)/GPU $(OBJDIR)/CPU
$(OBJDIR):
mkdir -p $(OBJDIR)
$(OBJDIR)/GPU: $(OBJDIR)
cd $(OBJDIR) && mkdir -p GPU
$(OBJDIR)/CPU: $(OBJDIR)
cd $(OBJDIR) && mkdir -p CPU
clean:
@echo Cleaning...
@rm -rf obj || true
@rm -f rummage || true
.PHONY: all clean