-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (50 loc) · 1.47 KB
/
Makefile
File metadata and controls
64 lines (50 loc) · 1.47 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
OBJDIR=objs
SRCDIR=src
TOOLDIR=tools
ifneq (,$(findstring ghc,$(HOSTNAME)))
# For ghc machines
CXX=/usr/lib64/openmpi/bin/mpic++
MPIRUN=/usr/lib64/openmpi/bin/mpirun
# LD_LIBRARY_PATH=/usr/lib64/openmpi/lib
else ifneq (,$(findstring blacklight,$(HOSTNAME)))
CXX=mpic++
# Do not run this on blacklight
MPIRUN=
else
CXX=mpic++
MPIRUN=mpirun
endif
mpi:=$(shell which mpic++ 2>/dev/null)
ifeq ($(mpi),)
$(error "mpic++ not found - did you set your environment variables or load the module?")
endif
SRCS=$(SRCDIR)/main.cpp\
$(SRCDIR)/cluster.cpp\
$(SRCDIR)/paren_match.cpp\
$(SRCDIR)/mandelbrot.cpp\
OBJS=$(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
CXXFLAGS+= -O3 -std=c++11 -Wall -openmp -fopenmp #-Wextra
LDFLAGS+=-lpthread -lmpi -lmpi_cxx -Llib
.PHONY: jobs
# all should come first in the file, so it is the default target!
all : main
run : main
LD_LIBRARY_PATH=./lib:$(LD_LIBRARY_PATH) $(MPIRUN) -np 6 main -s 10000000 -d norm -p 5
main: $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@
jobs: main
cd jobs && ./generate_job.sh 1
cd jobs && ./generate_job.sh 2
cd jobs && ./generate_job.sh 4
cd jobs && ./generate_job.sh 8
cd jobs && ./generate_job.sh 16
cd jobs && ./generate_job.sh 32
cd jobs && ./generate_job.sh 64
cd jobs && ./generate_job.sh 128
$(OBJS): | $(OBJDIR)
$(OBJDIR):
mkdir -p $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/*.h Makefile
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -c -o $@
clean:
rm -rf $(OBJDIR) main $(TOOLS) jobs/$(USER)_*.job