-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefileOld.mk
64 lines (51 loc) · 1.5 KB
/
MakefileOld.mk
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)/parallelSort.cpp \
$(SRCDIR)/dataGen.cpp \
$(SRCDIR)/stlSort.cpp
# Pattern substitute replace .cpp in srcs with .o it makes sense
OBJS=$(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
CXXFLAGS+=-O3 -std=c++0x #-Wall -Wextra
LDFLAGS+=-lpthread -lmpi -lmpi_cxx
.PHONY: jobs
# all should come first in the file, so it is the default target!
all : parallelSort
run : parallelSort
$(MPIRUN) -np 4 parallelSort -s 10000000 -d norm -p 5
parallelSort: $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@
jobs: parallelSort
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) parallelSort $(TOOLS) jobs/$(USER)_*.job