Skip to content

Commit d188f88

Browse files
committed
added necessary makefiles
1 parent 652501a commit d188f88

File tree

7 files changed

+234
-6093
lines changed

7 files changed

+234
-6093
lines changed

docking/AUTODOCK_GPU_DIR/MAKEFILE

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
# AutoDock-GPU Cuda Makefile
2+
3+
# ------------------------------------------------------
4+
# Note that environment variables must be defined
5+
# before compiling
6+
# DEVICE?
7+
# if DEVICE=CPU: CPU_INCLUDE_PATH?, CPU_LIBRARY_PATH?
8+
# if DEVICE=GPU: GPU_INCLUDE_PATH?, GPU_LIBRARY_PATH?
9+
10+
# ------------------------------------------------------
11+
# Choose OpenCL device
12+
# Valid values: CPU, GPU
13+
14+
NVCC = nvcc
15+
CPP = g++
16+
UNAME := $(shell uname)
17+
18+
TARGETS = 52 60 61 70 80
19+
20+
ifeq ($(TENSOR), ON)
21+
NVTENSOR=-DUSE_NVTENSOR
22+
NVTENSOR+=-I./wmma_extension/include
23+
TARGETS = 80
24+
endif
25+
26+
# Replace the gencode line with SASS+PTX for each target:
27+
CUDA_TARGETS=$(foreach t,$(TARGETS),-gencode arch=compute_$(t),code=[sm_$(t),compute_$(t)])
28+
29+
30+
ifeq ($(DEVICE), CPU)
31+
DEV =-DCPU_DEVICE
32+
else ifeq ($(DEVICE), GPU)
33+
DEV =-DGPU_DEVICE
34+
endif
35+
36+
# ------------------------------------------------------
37+
# Project directories
38+
# opencl_lvs: wrapper for OpenCL APIs
39+
COMMON_DIR=./common
40+
HOST_INC_DIR=./host/inc
41+
HOST_SRC_DIR=./host/src
42+
KRNL_DIR=./cuda
43+
KCMN_DIR=$(COMMON_DIR)
44+
BIN_DIR=./bin
45+
LIB_CUDA = kernels.o -lcurand -lcudart -DUSE_CUDA
46+
47+
TARGET := autodock
48+
TOOL_TARGET := adgpu_analysis
49+
50+
IFLAGS=-I$(COMMON_DIR) -I$(HOST_INC_DIR) -I$(GPU_INCLUDE_PATH) -I$(KRNL_DIR)
51+
LFLAGS=-L$(GPU_LIBRARY_PATH) -Wl,-rpath=$(GPU_LIBRARY_PATH):$(CPU_LIBRARY_PATH)
52+
CFLAGS=-std=c++17 $(IFLAGS) $(LFLAGS)
53+
TOOL_CFLAGS=-std=c++17 -I$(COMMON_DIR) -I$(HOST_INC_DIR)
54+
55+
ifeq ($(DEVICE), CPU)
56+
TARGET:=$(TARGET)_cpu
57+
else ifeq ($(DEVICE), GPU)
58+
NWI=-DN64WI
59+
TARGET:=$(TARGET)_gpu
60+
endif
61+
62+
ifeq ($(OVERLAP), ON)
63+
PIPELINE=-DUSE_PIPELINE -fopenmp
64+
endif
65+
66+
BIN := $(wildcard $(TARGET)*)
67+
68+
# ------------------------------------------------------
69+
# Number of work-items (wi)
70+
# Valid values: 32, 64, 128, 256
71+
NUMWI=
72+
73+
ifeq ($(NUMWI), 32)
74+
ifeq ($(TENSOR), ON)
75+
$(error NUMWI needs to be at least 64 with TENSOR=ON)
76+
endif
77+
NWI=-DN32WI
78+
TARGET:=$(TARGET)_32wi
79+
else ifeq ($(NUMWI), 64)
80+
NWI=-DN64WI
81+
TARGET:=$(TARGET)_64wi
82+
else ifeq ($(NUMWI), 128)
83+
NWI=-DN128WI
84+
TARGET:=$(TARGET)_128wi
85+
else ifeq ($(NUMWI), 256)
86+
NWI=-DN256WI
87+
TARGET:=$(TARGET)_256wi
88+
else
89+
ifeq ($(DEVICE), CPU)
90+
NWI=-DN16WI
91+
TARGET:=$(TARGET)_16wi
92+
else ifeq ($(DEVICE), GPU)
93+
NWI=-DN128WI
94+
TARGET:=$(TARGET)_128wi
95+
endif
96+
endif
97+
98+
# ------------------------------------------------------
99+
# Configuration
100+
# FDEBUG (full) : enables debugging on both host + device
101+
# LDEBUG (light): enables debugging on host
102+
# RELEASE
103+
CONFIG=RELEASE
104+
#CONFIG=FDEBUG
105+
106+
ifeq ($(CONFIG),FDEBUG)
107+
OPT =-O0 -g3 -Wall -DDOCK_DEBUG
108+
CUDA_FLAGS = -G -use_fast_math --ptxas-options="-v" $(CUDA_TARGETS) -std=c++11
109+
else ifeq ($(CONFIG),LDEBUG)
110+
OPT =-O0 -g3 -Wall
111+
CUDA_FLAGS = -use_fast_math --ptxas-options="-v" $(CUDA_TARGETS) -std=c++11
112+
else ifeq ($(CONFIG),RELEASE)
113+
OPT =-O3
114+
CUDA_FLAGS = -use_fast_math --ptxas-options="-v" $(CUDA_TARGETS) -std=c++11
115+
else
116+
OPT =
117+
CUDA_FLAGS = -use_fast_math --ptxas-options="-v" $(CUDA_TARGETS) -std=c++11
118+
endif
119+
120+
# ------------------------------------------------------
121+
# Reproduce results (remove randomness)
122+
REPRO=NO
123+
124+
ifeq ($(REPRO),YES)
125+
REP =-DREPRO
126+
else
127+
REP =
128+
endif
129+
# ------------------------------------------------------
130+
131+
all: otool odock
132+
133+
check-env-dev:
134+
@if test -z "$$DEVICE"; then \
135+
echo "Please set DEVICE to either CPU, GPU, CUDA, or OCLGPU to build docking software."; \
136+
exit 1; \
137+
else \
138+
if [ "$$DEVICE" = "CPU" ]; then \
139+
echo "DEVICE is set to $$DEVICE which is not a valid Cuda device."; \
140+
exit 1; \
141+
else \
142+
if [ "$$DEVICE" = "GPU" ]; then \
143+
echo "DEVICE is set to $$DEVICE"; \
144+
else \
145+
echo "DEVICE value is invalid. Please set DEVICE to either CPU, GPU, CUDA, or OCLGPU"; \
146+
exit 1; \
147+
fi; \
148+
fi; \
149+
fi; \
150+
echo " "
151+
152+
check-env-cpu:
153+
@if test -z "$$CPU_INCLUDE_PATH"; then \
154+
echo "CPU_INCLUDE_PATH is undefined"; \
155+
else \
156+
echo "CPU_INCLUDE_PATH is set to $$CPU_INCLUDE_PATH"; \
157+
fi; \
158+
if test -z "$$CPU_LIBRARY_PATH"; then \
159+
echo "CPU_LIBRARY_PATH is undefined"; \
160+
else \
161+
echo "CPU_LIBRARY_PATH is set to $$CPU_LIBRARY_PATH"; \
162+
fi; \
163+
echo " "
164+
165+
check-env-gpu:
166+
@if test -z "$$GPU_INCLUDE_PATH"; then \
167+
echo "GPU_INCLUDE_PATH is undefined"; \
168+
else \
169+
echo "GPU_INCLUDE_PATH is set to $$GPU_INCLUDE_PATH"; \
170+
fi; \
171+
if test -z "$$GPU_LIBRARY_PATH"; then \
172+
echo "GPU_LIBRARY_PATH is undefined"; \
173+
else \
174+
echo "GPU_LIBRARY_PATH is set to $$GPU_LIBRARY_PATH"; \
175+
fi; \
176+
echo " "
177+
178+
check-env-all: check-env-dev check-env-cpu check-env-gpu
179+
180+
# ------------------------------------------------------
181+
# Priting out its git version hash
182+
183+
GIT_VERSION := $(shell ./version_string.sh)
184+
185+
CFLAGS+=-DVERSION=\"$(GIT_VERSION)\"
186+
TOOL_CFLAGS+=-DVERSION=\"$(GIT_VERSION)\"
187+
188+
# ------------------------------------------------------
189+
190+
kernels: $(KERNEL_SRC)
191+
$(NVCC) $(NWI) $(REP) $(CUDA_FLAGS) $(IFLAGS) $(CUDA_INCLUDES) $(NVTENSOR) -c $(KRNL_DIR)/kernels.cu
192+
193+
otool:
194+
@echo "Building" $(TOOL_TARGET) "..."
195+
$(CPP) \
196+
$(shell ls $(HOST_SRC_DIR)/*.cpp) \
197+
$(TOOL_CFLAGS) \
198+
-o$(BIN_DIR)/$(TOOL_TARGET) \
199+
$(PIPELINE) $(NVTENSOR) $(OPT) -DTOOLMODE $(REP)
200+
201+
odock: check-env-all kernels
202+
@echo "Building" $(TARGET) "..."
203+
$(CPP) \
204+
$(shell ls $(HOST_SRC_DIR)/*.cpp) \
205+
$(CFLAGS) \
206+
$(LIB_CUDA) \
207+
-o$(BIN_DIR)/$(TARGET) \
208+
$(DEV) $(NWI) $(PIPELINE) $(NVTENSOR) $(OPT) $(DD) $(REP) $(KFLAGS)
209+
210+
# Example
211+
# 1ac8: for testing gradients of translation and rotation genes
212+
# 7cpa: for testing gradients of torsion genes (15 torsions)
213+
# 3tmn: for testing gradients of torsion genes (1 torsion)
214+
215+
PDB := 3ce3
216+
NRUN := 100
217+
NGEN := 27000
218+
POPSIZE := 150
219+
TESTNAME := test
220+
TESTLS := ad
221+
222+
test: odock
223+
$(BIN_DIR)/$(TARGET) \
224+
-ffile ./input/$(PDB)/derived/$(PDB)_protein.maps.fld \
225+
-lfile ./input/$(PDB)/derived/$(PDB)_ligand.pdbqt \
226+
-nrun $(NRUN) \
227+
-ngen $(NGEN) \
228+
-psize $(POPSIZE) \
229+
-resnam $(TESTNAME) \
230+
-gfpop 0 \
231+
-lsmet $(TESTLS)
232+
233+
.PHONY: clean

docking/AUTODOCK_GPU_DIR/Makefile

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ $(info Please make sure to set environment variables)
6363
$(info GPU_INCLUDE_PATH and GPU_LIBRARY_PATH)
6464
$(info )
6565
include Makefile.OpenCL
66-
endif
66+
endif

0 commit comments

Comments
 (0)