-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (48 loc) · 1.31 KB
/
Copy pathMakefile
File metadata and controls
66 lines (48 loc) · 1.31 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
SRC_DIR ?= src
EXEC = miner
ifndef COMPILER
$(error COMPILER is not defined)
endif
ifndef LOCAL
# Partitions
BUILD_PARTITION ?= xl
RUN_PARTITION ?= $(BUILD_PARTITION)
# Time limits
RUN_TIME ?= 00:01:00
BUILD_TIME ?= 00:01:00
# Commands
BUILD_CMD ?= make build LOCAL=y
RUN_CMD ?= make run LOCAL=y
build:
@sbatch --time $(BUILD_TIME) --partition $(BUILD_PARTITION) --wrap="$(BUILD_CMD)"
run:
ifeq ($(COMPILER), gcc)
@sbatch --time $(RUN_TIME) --partition $(RUN_PARTITION) --wrap="$(RUN_CMD)"
else ifeq ($(COMPILER), nvcc)
@sbatch --gres gpu:1 --time $(RUN_TIME) --partition $(RUN_PARTITION) --wrap="$(RUN_CMD)"
endif
else
COMMON_DIR ?= ../common
OBJS ?= $(SRC_DIR)/miner.o $(SRC_DIR)/sha256.o $(SRC_DIR)/utils.o
LIBS ?= -lm
ifeq ($(COMPILER), gcc)
FORCE_C := -x c
else
FORCE_C :=
endif
build: $(EXEC)
$(EXEC): $(OBJS)
$(COMPILER) $(OBJS) -o $(EXEC) $(LIBS)
$(SRC_DIR)/miner.o: $(COMMON_DIR)/miner.cpp
$(COMPILER) $(CFLAGS) $(FORCE_C) -c $< -o $@
$(SRC_DIR)/sha256.o: $(SRC_DIR)/sha256.$(SRC_EXT)
$(COMPILER) $(CFLAGS) -c $< -o $@
$(SRC_DIR)/utils.o: $(SRC_DIR)/utils.$(SRC_EXT)
$(COMPILER) $(CFLAGS) -c $< -o $@
run: $(EXEC)
@echo "Running test $(TEST)..."
./$(EXEC) $(TEST)
endif
clean:
rm -f $(SRC_DIR)/*.o output/* $(EXEC) slurm-*.out slurm-*.err profile.ncu-rep
.PHONY: build run clean