-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (86 loc) · 3.38 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
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CUDA_HOME=/home/guilherme.castro
endif
ifeq ($(UNAME_S),Darwin)
#COMPILE_FLAGS=-ccbin=clang-omp++ -Xcompiler -fopenmp
#LINK_FLAGS=-ccbin=clang-omp++ -Xcompiler -fopenmp
endif
export LANG=en_US.UTF-8
export LC_ALL=en_US
CUDA_HOME?=/Developer/NVIDIA/CUDA-7.5
COMPILE_FLAGS+=${COMMON_FLAGS}
COMMON_FLAGS=-g -O2 -std=c1x -Wall -o
CUDA_FLAGS=--ptxas-options=-v -arch=sm_30 -o
#MPI_FLAGS=-I$(shell mpicc --showme:incdirs) $(addprefix -L,$(shell mpicc --showme:libdirs)) -fopenmp
MPI_FLAGS= -fopenmp
CUDAC=${CUDA_HOME}/bin/nvcc
ICC=/opt/intel/bin/icc
CC=gcc
MPIC=mpicc
BASES = athaliana celegans Rattusnovergicus Musmusculus HomoSapiens gallus Drosophila
BASE_OBJC = objc/sequence.o objc/io.o objc/kmodes_common.o
OBJC = objc/main.o ${BASE_OBJC}
# sour/opt/intel/bin/compilervars.sh intel64
all: kmodes kmodes_cuda kmodes_mpi kmodes_openmp
kmodes_cuda: kmodes sequence_cuda
${CUDAC} -c ${CUDA_FLAGS} objc/[email protected] src/[email protected] --shared
${CUDAC} ${CUDA_FLAGS} bin/kmodes-cuda objc/[email protected] objc/sequence_cuda.o objc/io.o objc/main.o
kmodes_mpi: kmodes emmc_power
${MPIC} -c -fopenmp $(MPI_FLAGS) -lmpi ${COMPILE_FLAGS} objc/[email protected] src/[email protected]
${MPIC} -c -fopenmp $(MPI_FLAGS) -lmpi ${COMPILE_FLAGS} objc/main_mpi.o src/main.c -D USE_MPI -D EMMC_POWER_MEASUREMENT
${MPIC} -fopenmp $(MPI_FLAGS) -lmpi ${LINK_FLAGS} -o bin/kmodes-mpi objc/emmc_power.o objc/[email protected] objc/main_mpi.o ${BASE_OBJC}
kmodes_openmp: kmodes power
${ICC} -c src/[email protected] -qopt-report -fopenmp $(COMPILE_FLAGS) objc/[email protected]
${ICC} -c src/kmodes_common.c $(COMPILE_FLAGS) objc/kmodes_common_icc.o
${ICC} -c src/sequence.c $(COMPILE_FLAGS) objc/sequence_icc.o
${ICC} -fopenmp objc/power.o objc/[email protected] objc/sequence_icc.o objc/kmodes_common_icc.o objc/io.o objc/main.o -o bin/kmodes-openmp
kmodes: create_objc_dir main io sequence kmodes_common
${CC} -c src/[email protected] ${COMPILE_FLAGS} objc/[email protected]
${CC} -o bin/kmodes objc/kmodes.o ${OBJC}
emmc_power:
${CC} -c src/[email protected] -pthread ${COMPILE_FLAGS} objc/[email protected]
power:
${CC} -c src/[email protected] -pthread ${COMPILE_FLAGS} objc/[email protected]
sequence_cuda:
${CUDAC} -c src/sequence.c ${CUDA_FLAGS} objc/[email protected]
sequence:
${CC} -c src/[email protected] ${COMPILE_FLAGS} objc/[email protected]
io:
${CC} -c src/[email protected] ${COMPILE_FLAGS} objc/[email protected]
kmodes_common:
${CC} -c src/[email protected] ${COMPILE_FLAGS} objc/[email protected]
main:
${CC} -c src/[email protected] ${COMPILE_FLAGS} objc/[email protected]
create_objc_dir:
mkdir -p objc
extract_input:
for base in $(BASES) ; do \
COMMAND="tar -zxkvf input/$$base/clusters.tar.gz -C input/$$base/ --exclude ._* "; \
echo $$COMMAND ; \
$$COMMAND 2>/dev/null; true ;\
done ; \
clean:
for base in $(BASES) ; do \
num=1 ; while [[ $$num -le 10 ]] ; do \
rm -f input/$$base/cluster$$num.out; \
rm -f input/$$base/train$$num; \
rm -f input/$$base/testPos$$num; \
rm -f input/$$base/testNeg$$num; \
rm -f input/$$base/test$$num; \
rm -f input/$$base/results$$num; \
rm -f input/$$base/predictions$$num; \
rm -f input/$$base/model$$num; \
rm -f input/$$base/log$$num.txt; \
rm -f input/$$base/cluster$$num.out; \
rm -f input/$$base/cluster$$num ; \
rm -f input/$$base/cluster$$num.out.binseq; \
((num = num + 1)) ; \
done ; \
rm -f $$input/$$base/resultsFinal; \
rm -f $$input/$$base/positivos.binseq; \
rm -f $$input/$$base/negativos.binseq; \
rm -f $$input/$$base/negativos; \
rm -f $$input/$$base/positivos; \
done ; \
rm -f ${OBJC} objc/kmodes.o objc/kmodes_cuda.o bin/kmodes*