Commit 5669c632 authored by Leonardo Solis's avatar Leonardo Solis
Browse files

first successful test on intel cpu

parent 88486768
# odock Makefile
# ocladock Makefile
# CPU config
INTEL_INCLUDE_PATH=/opt/intel/opencl-1.2-sdk-6.0.0.1049/include
INTEL_LIBRARY_PATH=/opt/intel/opencl-1.2-sdk-6.0.0.1049/
# GPU config
AMD_INCLUDE_PATH=/opt/AMDAPPSDK-3.0/include
AMD_LIBRARY_PATH=/opt/amdgpu-pro/lib/x86_64-linux-gnu
# ------------------------------------------------------
# Choose OpenCL device
# Valid values: CPU, GPU
DEVICE=CPU
ifeq ($(DEVICE), CPU)
DEV =-DCPU_DEVICE
OCLA_INC_PATH=$(INTEL_INCLUDE_PATH)
OCLA_LIB_PATH=$(INTEL_LIBRARY_PATH)
else ifeq ($(DEVICE), GPU)
DEV =-DGPU_DEVICE
OCLA_INC_PATH=$(AMD_INCLUDE_PATH)
OCLA_LIB_PATH=$(AMD_LIBRARY_PATH)
endif
# ------------------------------------------------------
# Project directories
# opencl_lvs: wrapper for OpenCL APIs
COMMON_DIR=./common
......@@ -10,14 +32,15 @@ OCL_SRC_DIR=./opencl_lvs/src
HOST_INC_DIR=./host/inc
HOST_SRC_DIR=./host/src
KRNL_DIR=./device
KCMN_DIR=$(COMMON_DIR)
# Host sources
OCL_SRC=$(wildcard $(OCL_SRC_DIR)/*.cpp)
HOST_SRC=$(wildcard $(HOST_SRC_DIR)/*.cpp)
SRC=$(OCL_SRC) $(HOST_SRC)
IFLAGS=-I$(COMMON_DIR) -I$(OCL_INC_DIR) -I$(HOST_INC_DIR) -I$(AMD_INCLUDE_PATH)
LFLAGS=-L$(AMD_LIBRARY_PATH)
IFLAGS=-I$(COMMON_DIR) -I$(OCL_INC_DIR) -I$(HOST_INC_DIR) -I$(OCLA_INC_PATH)
LFLAGS=-L$(OCLA_LIB_PATH)
CFLAGS=$(IFLAGS) $(LFLAGS)
# Device sources
......@@ -30,21 +53,12 @@ K3_NAME="perform_LS"
K4_NAME="gpu_gen_and_eval_newpops"
K_NAMES=-DK1=$(K1_NAME) -DK2=$(K2_NAME) -DK3=$(K3_NAME) -DK4=$(K4_NAME)
# Kernel flags
KFLAGS=-DKRNL_SOURCE=$(KRNL_DIR)/$(KRNL_MAIN) -DKRNL_DIRECTORY=$(KRNL_DIR) $(K_NAMES)
KFLAGS=-DKRNL_SOURCE=$(KRNL_DIR)/$(KRNL_MAIN) -DKRNL_DIRECTORY=$(KRNL_DIR) -DKCMN_DIRECTORY=$(KCMN_DIR) $(K_NAMES)
TARGET := ocladock
BIN := $(wildcard $(TARGET)*)
# ------------------------------------------------------
# Choose OpenCL device
# Valid values: CPU, GPU
DEVICE=GPU
ifeq ($(DEVICE), CPU)
DEV =-DCPU_DEVICE
else ifeq ($(DEVICE), GPU)
DEV =-DGPU_DEVICE
endif
# ------------------------------------------------------
# Number of work-items (wi)
# Valid values: 16, 32, 64, 128
NWI=
......@@ -84,6 +98,7 @@ else
OPT =
endif
# ------------------------------------------------------
# Host and Device Debug
DOCK_DEBUG=NO
......
#include "/home/wimi/lvs/ofdock_amd/ofdock/calcenergy_basic.h"
#include "calcenergy_basic.h"
// All related pragmas are in defines.h (accesible by host and device code)
......
......@@ -8,8 +8,7 @@
#include "getparameters.h"
#include "performdocking.h"
// ------------------------
// Correct time measurement
// Moved to performdocking.cpp to skip measuring build time
// Time measurement
#include <sys/time.h>
// ------------------------
......@@ -24,8 +23,7 @@ int main(int argc, char* argv[])
clock_start_program = clock();
// ------------------------
// Correct time measurement
// Moved to performdocking.cpp to skip measuring build time
// Time measurement
double num_sec, num_usec, elapsed_sec;
timeval time_start,time_end;
gettimeofday(&time_start,NULL);
......@@ -79,13 +77,12 @@ int main(int argc, char* argv[])
free(floatgrids);
// ------------------------
// Correct time measurement
// Moved to performdocking.cpp to skip measuring build time
// Time measurement
gettimeofday(&time_end,NULL);
num_sec = time_end.tv_sec - time_start.tv_sec;
num_usec = time_end.tv_usec - time_start.tv_usec;
elapsed_sec = num_sec + (num_usec/1000000);
printf("Program run time %.3f sec (CORRECTED, used for EVALUATION)\n",elapsed_sec);
printf("Program run time %.3f sec \n\n", elapsed_sec);
//// ------------------------
return 0;
......
......@@ -11,12 +11,13 @@
#define STRINGIZE(s) STRINGIZE2(s)
#define KRNL_FILE STRINGIZE(KRNL_SOURCE)
#define KRNL_FOLDER STRINGIZE(KRNL_DIRECTORY)
#define KRNL_COMMON STRINGIZE(KCMN_DIRECTORY)
#define KRNL1 STRINGIZE(K1)
#define KRNL2 STRINGIZE(K2)
#define KRNL3 STRINGIZE(K3)
#define KRNL4 STRINGIZE(K4)
#define INC " -I " KRNL_FOLDER
#define INC " -I " KRNL_FOLDER " -I " KRNL_COMMON
#if defined (N16WI)
#define KNWI " -DN16WI "
......@@ -341,9 +342,13 @@ filled with clock() */
clock_start_docking = clock();
//print progress bar
#ifndef DOCK_DEBUG
printf("\nExecuting docking runs:\n");
printf(" 20%% 40%% 60%% 80%% 100%%\n");
printf("---------+---------+---------+---------+---------+\n");
#else
printf("\n");
#endif
curr_progress_cnt = 0;
#ifdef DOCK_DEBUG
......@@ -385,7 +390,7 @@ filled with clock() */
kernel1_gxsize = blocksPerGridForEachEntity * threadsPerBlock;
kernel1_lxsize = threadsPerBlock;
#ifdef DOCK_DEBUG
printf("Kernel1: gSize: %u, lSize: %u\n", kernel1_gxsize, kernel1_lxsize); fflush(stdout);
printf("%-25s %10s %8u %10s %4u\n", "Kernel1: ", "gSize: ", kernel1_gxsize, "lSize: ", kernel1_lxsize); fflush(stdout);
#endif
// End of Kernel1
......@@ -396,7 +401,7 @@ filled with clock() */
kernel2_gxsize = blocksPerGridForEachRun * threadsPerBlock;
kernel2_lxsize = threadsPerBlock;
#ifdef DOCK_DEBUG
printf("Kernel2: gSize: %u, lSize: %u\n", kernel2_gxsize, kernel2_lxsize); fflush(stdout);
printf("%-25s %10s %8u %10s %4u\n", "Kernel2: ", "gSize: ", kernel2_gxsize, "lSize: ", kernel2_lxsize); fflush(stdout);
#endif
// End of Kernel2
......@@ -444,7 +449,7 @@ filled with clock() */
kernel4_gxsize = blocksPerGridForEachEntity * threadsPerBlock;
kernel4_lxsize = threadsPerBlock;
#ifdef DOCK_DEBUG
printf("Kernel4: gSize: %u, lSize: %u\n", kernel4_gxsize, kernel4_lxsize); fflush(stdout);
printf("%-25s %10s %8u %10s %4u\n", "K_GENETIC_GENERATION: ", "gSize: ", kernel4_gxsize, "lSize: ", kernel4_lxsize); fflush(stdout);
#endif
// End of Kernel4
......@@ -491,29 +496,29 @@ filled with clock() */
kernel3_gxsize = blocksPerGridForEachLSEntity * threadsPerBlock;
kernel3_lxsize = threadsPerBlock;
#ifdef DOCK_DEBUG
printf("Kernel3: gSize: %u, lSize: %u\n", kernel3_gxsize, kernel3_lxsize); fflush(stdout);
printf("%-25s %10s %8u %10s %4u\n", "K_LOCAL_SEARCH: ", "gSize: ", kernel3_gxsize, "lSize: ", kernel3_lxsize); fflush(stdout);
#endif
// End of Kernel3
// Kernel1
#ifdef DOCK_DEBUG
printf("Start Kernel1 ... ");fflush(stdout);
#endif
//#ifdef DOCK_DEBUG
// printf("Start Kernel1 ... ");fflush(stdout);
//#endif
runKernel1D(command_queue,kernel1,kernel1_gxsize,kernel1_lxsize,&time_start_kernel,&time_end_kernel);
#ifdef DOCK_DEBUG
printf(" ... Finish Kernel1\n");fflush(stdout);
#endif
//#ifdef DOCK_DEBUG
// printf(" ... Finish Kernel1\n");fflush(stdout);
//#endif
// End of Kernel1
// Kernel2
#ifdef DOCK_DEBUG
printf("Start Kernel2 ... ");fflush(stdout);
#endif
//#ifdef DOCK_DEBUG
// printf("Start Kernel2 ... ");fflush(stdout);
//#endif
runKernel1D(command_queue,kernel2,kernel2_gxsize,kernel2_lxsize,&time_start_kernel,&time_end_kernel);
#ifdef DOCK_DEBUG
printf(" ... Finish Kernel2\n");fflush(stdout);
#endif
//#ifdef DOCK_DEBUG
// printf(" ... Finish Kernel2\n");fflush(stdout);
//#endif
// End of Kernel2
// ===============================================================================
......@@ -542,7 +547,7 @@ filled with clock() */
{
#ifdef DOCK_DEBUG
ite_cnt++;
printf("Iteration # %u\n", ite_cnt);
printf("\nIteration # %u\n", ite_cnt);
fflush(stdout);
#endif
......@@ -553,38 +558,40 @@ filled with clock() */
while (curr_progress_cnt < new_progress_cnt) {
curr_progress_cnt++;
#ifndef DOCK_DEBUG
printf("*");
#endif
fflush(stdout);
}
// Kernel4
#ifdef DOCK_DEBUG
printf("Start Kernel4 ... ");fflush(stdout);
printf("%-25s", "K_GENETIC_GENERATION: ");fflush(stdout);
#endif
runKernel1D(command_queue,kernel4,kernel4_gxsize,kernel4_lxsize,&time_start_kernel,&time_end_kernel);
#ifdef DOCK_DEBUG
printf(" ... Finish Kernel4\n");fflush(stdout);
printf("%15s", " ... Finished\n");fflush(stdout);
#endif
// End of Kernel4
// Kernel3
#ifdef DOCK_DEBUG
printf("Start Kernel3 ... ");fflush(stdout);
printf("%-25s", "K_LOCAL_SEARCH: ");fflush(stdout);
#endif
runKernel1D(command_queue,kernel3,kernel3_gxsize,kernel3_lxsize,&time_start_kernel,&time_end_kernel);
#ifdef DOCK_DEBUG
printf(" ... Finish Kernel3\n");fflush(stdout);
printf("%15s" ," ... Finished\n");fflush(stdout);
#endif
// End of Kernel3
// Kernel2
#ifdef DOCK_DEBUG
printf("Start Kernel2 ... ");fflush(stdout);
#endif
//#ifdef DOCK_DEBUG
// printf("Start Kernel2 ... ");fflush(stdout);
//#endif
runKernel1D(command_queue,kernel2,kernel2_gxsize,kernel2_lxsize,&time_start_kernel,&time_end_kernel);
#ifdef DOCK_DEBUG
printf(" ... Finish Kernel2\n");fflush(stdout);
#endif
//#ifdef DOCK_DEBUG
// printf(" ... Finish Kernel2\n");fflush(stdout);
//#endif
// End of Kernel2
// ===============================================================================
......
......@@ -106,7 +106,7 @@ int ImportSource(const char* filename,
fflush(stdout);
FILE* plogfile;
plogfile = fopen("README_LOG_ProgramBuildInfo.txt","w");
plogfile = fopen("KernelProgramBuildInfo.txt","w");
fprintf(plogfile,"%s",program_build_log);
fclose(plogfile);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment