Commit 4b1a6b88 authored by Leonardo Solis's avatar Leonardo Solis

added first working version in harp2

parent 302cbcc2
......@@ -141,10 +141,10 @@ ENABLE_K1 = YES
ENABLE_K2 = YES
ENABLE_K3 = YES
ENABLE_K4 = YES
ENABLE_K5 = YES
ENABLE_K6 = YES
ENABLE_K7 = YES
ENABLE_K8 = YES
ENABLE_K5 = NO
ENABLE_K6 = NO
ENABLE_K7 = NO
ENABLE_K8 = NO
ifeq ($(ENABLE_K1),YES)
K1 =-DENABLE_KERNEL1
......@@ -259,8 +259,8 @@ $(TARGET_DIR)/$(TARGET) : Makefile $(SRCS) $(INCS) $(TARGET_DIR)
# Docking parameters
PDB := 3ptb
NRUN := 10
NEV := 200000
NRUN := 20
NEV := 40000
# Device folder
# Device main kernel name
......@@ -268,6 +268,7 @@ NEV := 200000
DEV_DIRS := device
DEV_SRC := $(DEV_DIRS)/Krnl_GA.cl
BOARD_HARP2 := bdw_fpga_v1.0
#BOARD_HARP2 := a10gx
## Make it all: compilation (host & device) + run emulation
## Notice, it switches automatically to /bin folder
......
......@@ -26,11 +26,12 @@ void Krnl_Conform(
char mode = 0;
ushort cnt = 0; //uint cnt = 0;
char IC_active, GG_active, LS_active;
char IC_active, GG_active, LS_active, Off_active;
bool IC_valid = false;
bool GG_valid = false;
bool LS_valid = false;
char IC_mode, GG_mode, LS_mode = 0;
bool Off_valid = false;
char IC_mode, GG_mode, LS_mode, Off_mode = 0;
float phi, theta, genrotangle;
......@@ -59,10 +60,11 @@ while(active) {
// --------------------------------------------------------------
// Wait for genotypes in channel
// --------------------------------------------------------------
while ((IC_valid == false) && (GG_valid == false) && (LS_valid == false)) {
while ((IC_valid == false) && (GG_valid == false) && (LS_valid == false) && (Off_valid == false)) {
IC_active = read_channel_nb_altera(chan_IC2Conf_active, &IC_valid);
GG_active = read_channel_nb_altera(chan_GG2Conf_active, &GG_valid);
LS_active = read_channel_nb_altera(chan_LS2Conf_active, &LS_valid);
Off_active = read_channel_nb_altera(chan_Off2Conf_active, &Off_valid);
}
if (IC_valid) {
......@@ -100,16 +102,31 @@ while(active) {
for (uchar pipe_cnt=0; pipe_cnt<ACTUAL_GENOTYPE_LENGTH; pipe_cnt++) {
genotype[pipe_cnt] = read_channel_altera(chan_LS2Conf_genotype);}
}
else {
if (Off_valid) {
active = Off_active;
mem_fence(CLK_CHANNEL_MEM_FENCE);
mode = read_channel_altera(chan_Off2Conf_mode);
mem_fence(CLK_CHANNEL_MEM_FENCE);
cnt = read_channel_altera(chan_Off2Conf_cnt);
mem_fence(CLK_CHANNEL_MEM_FENCE);
for (uchar pipe_cnt=0; pipe_cnt<ACTUAL_GENOTYPE_LENGTH; pipe_cnt++) {
genotype[pipe_cnt] = read_channel_altera(chan_Off2Conf_genotype);}
}
}
}
}
IC_valid = false;
GG_valid = false;
LS_valid = false;
Off_valid = false;
IC_active = 0;
GG_active = 0;
LS_active = 0;
Off_active = 0;
#if defined (DEBUG_ACTIVE_KERNEL)
if (active == 0) {printf(" %-20s: %s\n", "Krnl_Conform", "must be disabled");}
......@@ -263,12 +280,15 @@ while(active) {
//////======================================================
//printf("Conform: %u %u\n", active, cnt);
/*
if ((active == 0) && (cnt == (DockConst->pop_size -1))) {
active = 0;
}
else {
active = 1;
}
*/
//////======================================================
// --------------------------------------------------------------
......@@ -277,9 +297,8 @@ while(active) {
write_channel_altera(chan_Conf2Intere_active, active);
write_channel_altera(chan_Conf2Intrae_active, active);
mem_fence(CLK_CHANNEL_MEM_FENCE);
/*
write_channel_altera(chan_Conf2Intere_mode, mode);
*/
write_channel_altera(chan_Conf2Intrae_mode, mode);
mem_fence(CLK_CHANNEL_MEM_FENCE);
......
This diff is collapsed.
......@@ -29,9 +29,7 @@ void Krnl_InterE(
*/
char active = 1;
/*
char mode = 0;
*/
ushort cnt = 0; //uint cnt = 0;
float interE;
......@@ -70,10 +68,8 @@ while(active) {
// --------------------------------------------------------------
active = read_channel_altera(chan_Conf2Intere_active);
mem_fence(CLK_CHANNEL_MEM_FENCE);
/*
mode = read_channel_altera(chan_Conf2Intere_mode);
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
cnt = read_channel_altera(chan_Conf2Intere_cnt);
mem_fence(CLK_CHANNEL_MEM_FENCE);
......@@ -270,20 +266,40 @@ while(active) {
//////======================================================
//printf("InterE: %u %u\n", active, cnt);
/*
if ((active == 0) && (cnt == (DockConst->pop_size -1))) {
active = 0;
}
else {
active = 1;
}
*/
//////======================================================
// --------------------------------------------------------------
// Send intermolecular energy to chanel
// --------------------------------------------------------------
write_channel_altera(chan_Intere2Store_intere, interE);
//write_channel_altera(chan_Intere2Store_intere, interE);
switch (mode) {
case 1: // IC
write_channel_altera(chan_Intere2StoreIC_intere, interE);
break;
case 2: // GG
write_channel_altera(chan_Intere2StoreGG_intere, interE);
break;
case 3: // LS
write_channel_altera(chan_Intere2StoreLS_intere, interE);
break;
case 4: // Off
write_channel_altera(chan_Intere2StoreOff_intere, interE);
break;
}
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
write_channel_altera(chan_Intere2Store_active, active);
......
......@@ -157,24 +157,45 @@ while(active) {
} // End of LOOP_INTRAE_1
//////======================================================
//printf("IntraE: %u %u\n", active, cnt);
/*
if ((active == 0) && (cnt == (DockConst->pop_size -1))) {
active = 0;
}
else {
active = 1;
}
*/
//////======================================================
// --------------------------------------------------------------
// Send intramolecular energy to channel
// --------------------------------------------------------------
write_channel_altera(chan_Intrae2Store_intrae, intraE);
//write_channel_altera(chan_Intrae2Store_intrae, intraE);
switch (mode) {
case 1: // IC
write_channel_altera(chan_Intrae2StoreIC_intrae, intraE);
break;
case 2: // GG
write_channel_altera(chan_Intrae2StoreGG_intrae, intraE);
break;
case 3: // LS
write_channel_altera(chan_Intrae2StoreLS_intrae, intraE);
break;
case 4: // Off
write_channel_altera(chan_Intrae2StoreOff_intrae, intraE);
break;
}
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
write_channel_altera(chan_Intrae2Store_active, active);
mem_fence(CLK_CHANNEL_MEM_FENCE);
write_channel_altera(chan_Intrae2Store_mode, mode);
mem_fence(CLK_CHANNEL_MEM_FENCE);
write_channel_altera(chan_Intrae2Store_cnt, cnt);
*/
// --------------------------------------------------------------
} // End of while(1)
......
......@@ -355,7 +355,7 @@ filled with clock() */
mallocBufferObject(context,CL_MEM_READ_ONLY, sizeof(KerConstStatic), &mem_KerConstStatic);
mallocBufferObject(context,CL_MEM_READ_ONLY, sizeof(KerConstDynamic), &mem_KerConstDynamic);
mallocBufferObject(context,CL_MEM_READ_ONLY,size_floatgrids, &mem_dockpars_fgrids);
mallocBufferObject(context,CL_MEM_READ_ONLY,size_populations, &mem_dockpars_conformations_current);
mallocBufferObject(context,CL_MEM_READ_WRITE,size_populations, &mem_dockpars_conformations_current);
mallocBufferObject(context,CL_MEM_READ_WRITE,size_energies, &mem_dockpars_energies_current);
mallocBufferObject(context,CL_MEM_READ_WRITE,size_populations, &mem_dockpars_conformations_next);
mallocBufferObject(context,CL_MEM_READ_WRITE,size_energies, &mem_dockpars_energies_next);
......@@ -374,9 +374,10 @@ filled with clock() */
setKernelArg(kernel1,0, sizeof(mem_dockpars_conformations_current), &mem_dockpars_conformations_current);
setKernelArg(kernel1,1, sizeof(mem_dockpars_energies_current), &mem_dockpars_energies_current);
setKernelArg(kernel1,2, sizeof(mem_dockpars_conformations_next), &mem_dockpars_conformations_next);
setKernelArg(kernel1,3, sizeof(mem_dockpars_energies_next), &mem_dockpars_energies_next);
setKernelArg(kernel1,4, sizeof(cl_mem), &mem_DockparametersConst);
setKernelArg(kernel1,5, sizeof(mem_evals_and_generations_performed), &mem_evals_and_generations_performed);
setKernelArg(kernel1,3, sizeof(mem_dockpars_energies_next), &mem_dockpars_energies_next);
setKernelArg(kernel1,4, sizeof(mem_dockpars_prng_states), &mem_dockpars_prng_states);
setKernelArg(kernel1,5, sizeof(cl_mem), &mem_DockparametersConst);
setKernelArg(kernel1,6, sizeof(mem_evals_and_generations_performed), &mem_evals_and_generations_performed);
#endif // End of ENABLE_KERNEL1
#ifdef ENABLE_KERNEL2 // Krnl_Conform
......
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