Commit 824eb416 authored by Leonardo Solis's avatar Leonardo Solis
Browse files

#31, krnl_GA: added write-only arg (final pops) + corrected initial-pop arg to read-only

This one runs correctly in terms of docking, yay
parent d1529db6
...@@ -222,7 +222,8 @@ __kernel __attribute__ ((max_global_work_dim(0))) ...@@ -222,7 +222,8 @@ __kernel __attribute__ ((max_global_work_dim(0)))
*/ */
__kernel __attribute__ ((reqd_work_group_size(1,1,1))) __kernel __attribute__ ((reqd_work_group_size(1,1,1)))
void Krnl_GA( void Krnl_GA(
__global float* restrict GlobPopulationCurrent, __global const float* restrict GlobPopulationCurrentInitial,
__global float* restrict GlobPopulationCurrentFinal,
__global float* restrict GlobEnergyCurrent, __global float* restrict GlobEnergyCurrent,
__global unsigned int* restrict GlobEvals_performed, __global unsigned int* restrict GlobEvals_performed,
__global unsigned int* restrict GlobGens_performed, __global unsigned int* restrict GlobGens_performed,
...@@ -264,8 +265,9 @@ void Krnl_GA( ...@@ -264,8 +265,9 @@ void Krnl_GA(
__local float LocalPopCurr[MAX_POPSIZE][ACTUAL_GENOTYPE_LENGTH]; __local float LocalPopCurr[MAX_POPSIZE][ACTUAL_GENOTYPE_LENGTH];
__local float LocalEneCurr[MAX_POPSIZE]; __local float LocalEneCurr[MAX_POPSIZE];
__global float* GlobPopCurr = & GlobPopulationCurrent [Host_Offset_Pop]; __global const float* GlobPopCurrInitial = & GlobPopulationCurrentInitial [Host_Offset_Pop];
__global float* GlobEneCurr = & GlobEnergyCurrent [Host_Offset_Ene]; __global float* GlobPopCurrFinal = & GlobPopulationCurrentFinal [Host_Offset_Pop];
__global float* GlobEneCurr = & GlobEnergyCurrent [Host_Offset_Ene];
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Initial Calculation (IC) of scores // Initial Calculation (IC) of scores
...@@ -283,7 +285,7 @@ void Krnl_GA( ...@@ -283,7 +285,7 @@ void Krnl_GA(
LOOP_FOR_GA_IC_INNER_WRITE_GENOTYPE: LOOP_FOR_GA_IC_INNER_WRITE_GENOTYPE:
for (uchar gene_cnt=0; gene_cnt<DockConst_num_of_genes; gene_cnt++) { for (uchar gene_cnt=0; gene_cnt<DockConst_num_of_genes; gene_cnt++) {
float tmp_ic; float tmp_ic;
tmp_ic = GlobPopCurr[pop_cnt*ACTUAL_GENOTYPE_LENGTH + gene_cnt]; tmp_ic = GlobPopCurrInitial[pop_cnt*ACTUAL_GENOTYPE_LENGTH + gene_cnt];
LocalPopCurr[pop_cnt][gene_cnt & MASK_GENOTYPE] = tmp_ic; LocalPopCurr[pop_cnt][gene_cnt & MASK_GENOTYPE] = tmp_ic;
write_pipe_block(chan_IC2Conf_genotype, &tmp_ic); write_pipe_block(chan_IC2Conf_genotype, &tmp_ic);
...@@ -856,7 +858,7 @@ void Krnl_GA( ...@@ -856,7 +858,7 @@ void Krnl_GA(
__attribute__((xcl_pipeline_loop)) __attribute__((xcl_pipeline_loop))
LOOP_GA_WRITEPOP2DDR_INNER: LOOP_GA_WRITEPOP2DDR_INNER:
for (uchar gene_cnt=0; gene_cnt<DockConst_num_of_genes; gene_cnt++) { for (uchar gene_cnt=0; gene_cnt<DockConst_num_of_genes; gene_cnt++) {
GlobPopCurr[pop_cnt*ACTUAL_GENOTYPE_LENGTH + gene_cnt] = LocalPopCurr[pop_cnt][gene_cnt & MASK_GENOTYPE]; GlobPopCurrFinal[pop_cnt*ACTUAL_GENOTYPE_LENGTH + gene_cnt] = LocalPopCurr[pop_cnt][gene_cnt & MASK_GENOTYPE];
} }
GlobEneCurr[pop_cnt] = LocalEneCurr[pop_cnt]; GlobEneCurr[pop_cnt] = LocalEneCurr[pop_cnt];
......
...@@ -388,8 +388,12 @@ filled with clock() */ ...@@ -388,8 +388,12 @@ filled with clock() */
// functions. // functions.
// Krnl_GA buffers // Krnl_GA buffers
cl::Buffer mem_dockpars_conformations_current (context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, cl::Buffer mem_dockpars_conformations_current_Initial
(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY,
size_populations_nbytes, cpu_init_populations.data()); size_populations_nbytes, cpu_init_populations.data());
cl::Buffer mem_dockpars_conformations_current_Final
(context, CL_MEM_USE_HOST_PTR | CL_MEM_WRITE_ONLY,
size_populations_nbytes, cpu_final_populations.data());
cl::Buffer mem_dockpars_energies_current (context, CL_MEM_USE_HOST_PTR | CL_MEM_WRITE_ONLY, cl::Buffer mem_dockpars_energies_current (context, CL_MEM_USE_HOST_PTR | CL_MEM_WRITE_ONLY,
size_energies_nbytes, cpu_energies.data()); size_energies_nbytes, cpu_energies.data());
cl::Buffer mem_evals_performed (context, CL_MEM_USE_HOST_PTR | CL_MEM_WRITE_ONLY, cl::Buffer mem_evals_performed (context, CL_MEM_USE_HOST_PTR | CL_MEM_WRITE_ONLY,
...@@ -463,7 +467,7 @@ filled with clock() */ ...@@ -463,7 +467,7 @@ filled with clock() */
std::vector<cl::Memory> inBufVec, outBufVec; std::vector<cl::Memory> inBufVec, outBufVec;
// Krnl_GA // Krnl_GA
inBufVec.push_back(mem_dockpars_conformations_current); // RD & WR inBufVec.push_back(mem_dockpars_conformations_current_Initial);
// Krnl_Conform // Krnl_Conform
inBufVec.push_back(mem_KerConstStatic_rotlist_const); inBufVec.push_back(mem_KerConstStatic_rotlist_const);
inBufVec.push_back(mem_KerConstStatic_ref_coords_const); inBufVec.push_back(mem_KerConstStatic_ref_coords_const);
...@@ -488,8 +492,8 @@ filled with clock() */ ...@@ -488,8 +492,8 @@ filled with clock() */
inBufVec.push_back(mem_KerConstStatic_dspars_V_const); inBufVec.push_back(mem_KerConstStatic_dspars_V_const);
// Krnl_GA // Krnl_GA
outBufVec.push_back(mem_dockpars_conformations_current); // RD & WR outBufVec.push_back(mem_dockpars_conformations_current_Final);
outBufVec.push_back(mem_dockpars_energies_current); // WR outBufVec.push_back(mem_dockpars_energies_current);
outBufVec.push_back(mem_evals_performed); outBufVec.push_back(mem_evals_performed);
outBufVec.push_back(mem_gens_performed); outBufVec.push_back(mem_gens_performed);
...@@ -506,7 +510,8 @@ filled with clock() */ ...@@ -506,7 +510,8 @@ filled with clock() */
int narg; int narg;
#ifdef ENABLE_KRNL_GA #ifdef ENABLE_KRNL_GA
narg = 0; narg = 0;
kernel_ga.setArg(narg++, mem_dockpars_conformations_current); kernel_ga.setArg(narg++, mem_dockpars_conformations_current_Initial);
kernel_ga.setArg(narg++, mem_dockpars_conformations_current_Final);
kernel_ga.setArg(narg++, mem_dockpars_energies_current); kernel_ga.setArg(narg++, mem_dockpars_energies_current);
kernel_ga.setArg(narg++, mem_evals_performed); kernel_ga.setArg(narg++, mem_evals_performed);
kernel_ga.setArg(narg++, mem_gens_performed); kernel_ga.setArg(narg++, mem_gens_performed);
...@@ -825,9 +830,9 @@ filled with clock() */ ...@@ -825,9 +830,9 @@ filled with clock() */
unsigned short ushort_run_cnt = (unsigned ushort) run_cnt; unsigned short ushort_run_cnt = (unsigned ushort) run_cnt;
unsigned int Host_Offset_Pop = run_cnt * dockpars.pop_size * ACTUAL_GENOTYPE_LENGTH; unsigned int Host_Offset_Pop = run_cnt * dockpars.pop_size * ACTUAL_GENOTYPE_LENGTH;
unsigned int Host_Offset_Ene = run_cnt * dockpars.pop_size; unsigned int Host_Offset_Ene = run_cnt * dockpars.pop_size;
kernel_ga.setArg(16, ushort_run_cnt); kernel_ga.setArg(17, ushort_run_cnt);
kernel_ga.setArg(17, Host_Offset_Pop); kernel_ga.setArg(18, Host_Offset_Pop);
kernel_ga.setArg(18, Host_Offset_Ene); kernel_ga.setArg(19, Host_Offset_Ene);
#endif #endif
#ifdef ENABLE_KRNL_CONFORM #ifdef ENABLE_KRNL_CONFORM
......
Supports Markdown
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