-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (83 loc) · 2.68 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
##############################################################################
# Copyright (c) 2015 - 2016 Philipp Schubert. #
# All rights reserved. This program and the accompanying materials are made #
# available under the terms of LICENSE.txt. #
# #
# Contributors: #
# Philipp Schubert #
##############################################################################
EXE := smacofC
CUEXE := smacofCU
BUILDDIR := build
# used libraries
LIBS := -lstdc++ -lm -larmadillo
CULIBS := -lcudart
# some very important switches
# start algorithm with seeded random matrix (1) or unseeded random matrix (0)
SEED_BOOL := 1
# make use of a memory pool (pre-allocation) (1) or do not (0)
MEM_POOL := 1
# setting the compiler to use
CC := gcc
CFLAGS :=
# flag for standard C version
ifeq ($(findstring clang,$(CC)),clang)
else
CFLAGS += -std=c11
endif
# CFLAGS += -g
CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Ofast
CFLAGS += -march=native
CFLAGS += -fopenmp
# flags for CUDA version
CUFLAGS := -O3
CUFLAGS += -use_fast_math
# this line has to be adapted to existing hardware!
CUFLAGS += -gencode arch=compute_30,code=sm_30
CUFLAGS += -Xcompiler -std=c11
CUFLAGS += -Xcompiler -Wall
CUFLAGS += -Xcompiler -Wextra
CUFLAGS += -Xcompiler -Ofast
CUFLAGS += -Xcompiler -march=native
CUFLAGS += -Xcompiler -fopenmp
c:
mkdir $(BUILDDIR); \
cd src; \
$(CC) $(CFLAGS) -DCUDA=0 -DDEBUG=0 -DSEEDED=$(SEED_BOOL) -DMPOOL=$(MEM_POOL) *.cpp *.c -o $(EXE) $(LIBS); \
mv $(EXE) ../$(BUILDDIR); \
cd -; \
cuda:
mkdir $(BUILDDIR); \
cd src; \
nvcc $(CUFLAGS) -DCUDA=1 -DDEBUG=0 -DSEEDED=$(SEED_BOOL) -DMPOOL=$(MEM_POOL) *.cu *.cpp *.c -o $(CUEXE) $(LIBS) $(CULIBDS); \
mv $(CUEXE) ../$(BUILDDIR); \
cd -; \
clang-format:
python3 misc/clang-format.py
run-cubeC-example: c
cd $(BUILDDIR); \
./$(EXE) ../example-data/cube.csv cube-output.csv 0 1000 0.0001 2 2 1; \
run-cubeC-weights-example: c
cd $(BUILDDIR); \
./$(EXE) ../example-data/cube.csv cube-output.csv 0 1000 0.0001 2 2 1 ../example-data/cube-weights.csv; \
run-cubeCUDA-example: cuda
cd $(BUILDDIR); \
./$(CUEXE) ../example-data/cube.csv cube-output.csv 0 1000 0.0001 2 2 1; \
install-prerequisites:
sudo apt-get install cmake libopenblas-dev liblapack-dev; \
tar xvf armadillo-8.500.1.tar.xz; \
cd armadillo-8.500.1/; \
mkdir build; \
cd build; \
cmake ..; \
make; \
sudo make install;
doc:
cd src; \
doxygen doxy_config.conf
clean:
rm -f $(BUILDDIR)/$(EXE); \
rm -f $(BUILDDIR)/$(CUEXE); \
rm -rf $(BUILDDIR); \