-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
106 lines (87 loc) · 2.75 KB
/
Makefile
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# ------------------------------------------------------------------------------
# GNU gmake file.
# Change these lines to fit your system, or provide them in make.inc. fortranint
# should be 4 or 8 bytes. This was established when you compiled LAPACK and
# BLAS.
# fortranint = 4
# BLASLIB = -lblas
# LAPACKLIB = -llapack
# FORTRANLIB = -lgfortran
# CPP = g++
# MPICPP = mpic++
# FORTRAN = gfortran
# MODE_FLAGS = -fPIC
include make.inc
# Set the optimization level. I prefer '-O3'.
#opt =
#opt = -g
opt = -g -O3
# Choose serial, OpenMP-parallelized, MPI-parallized versions, or hybrid
# MPI-OpenMP. I prefer OpenMP to MPI if I'm running on one shared-memory
# machine. Compression cannot be run as hybrid; only the MVP can.
#mode = s
mode = omp
#mode = mpi
#mode = hybrid
# Probably does not need to be changed:
ifeq ($(mode),s)
MODE_FLAGS +=
ext = omp
endif
ifeq ($(mode),omp)
MODE_FLAGS += -fopenmp -DUTIL_OMP
ext = omp
endif
ifeq ($(mode),mpi)
CPP = $(MPICPP)
MODE_FLAGS += -DUTIL_MPI
ext = mpi
endif
ifeq ($(mode),hybrid)
CPP = $(MPICPP)
MODE_FLAGS += -fopenmp -DUTIL_OMP -DUTIL_MPI
ext = mpi
endif
# ------------------------------------------------------------------------------
# The rest should not have to be changed.
INCLUDE = -I .
LIBS = $(LAPACKLIB) $(BLASLIB) $(FORTRANLIB)
LIBDIRS =
OPTFLAGS = $(opt)
FFLAGS += $(OPTFLAGS) $(MODE_FLAGS)
CPPFLAGS += $(OPTFLAGS) $(MODE_FLAGS) -DFORTRAN_INT_$(fortranint)
LDFLAGS += $(MODE_FLAGS)
.SUFFIXES:
.SUFFIXES: .cpp .f90 .o
CPPSRCS = src/Hd.cpp src/Compress.cpp src/Hmat.cpp src/HmatIo.cpp \
src/KeyValueFile.cpp src/CodeAnalysis.cpp src/Mpi.cpp src/CHmat.cpp \
src/SFHmat.cpp
OBJECTS = $(patsubst %.cpp,%.o,$(CPPSRCS))
%.o : %.cpp
$(CPP) $(CPPFLAGS) $(INCLUDE) -c $< -o $@
%.o : %.f90
$(FORTRAN) $(FFLAGS) -c $< -o $@
all: libhmmvp build mvp cmvp fmvp
# Library to compress and apply an H-matrix.
libhmmvp: $(OBJECTS)
ar rucs lib/libhmmvp_$(mode).a $(OBJECTS)
# A driver to compress an H-matrix.
build: libhmmvp src/hmmvpbuild.o
$(CPP) $(LDFLAGS) $(LIBFLAGS) $(LIBDIRS) src/hmmvpbuild.o lib/libhmmvp_$(mode).a $(LIBS) -o bin/hmmvpbuild_$(mode)
# C++ examples.
mvp: libhmmvp examples/mvp_$(ext).o
$(CPP) $(LDFLAGS) $(LIBFLAGS) $(LIBDIRS) examples/mvp_$(ext).o lib/libhmmvp_$(mode).a $(LIBS) -o examples/mvp_$(mode)
# C example.
cmvp: libhmmvp
ifneq ($(ext),mpi)
$(CPP) examples/cmvp_$(ext).c $(INCLUDE) $(CPPFLAGS) $(LDFLAGS) $(LIBFLAGS) $(LIBDIRS) lib/libhmmvp_$(mode).a $(LIBS) -o examples/cmvp_$(mode)
endif
# Fortran 90 example.
fmvp: libhmmvp
ifneq ($(ext),mpi)
$(FORTRAN) examples/fmvp_$(ext).f90 $(INCLUDE) $(FFLAGS) $(LDFLAGS) lib/libhmmvp_$(mode).a $(LIBS) -lstdc++ -o examples/fmvp_$(mode)
endif
clean:
rm -f src/*.o lib/*.a bin/*
# generate by running `bash make-depends.sh`
include make.depends