Commit 17b12c3f authored by lvs's avatar lvs
Browse files

corredted fire

parent 20cf44f1
......@@ -207,10 +207,10 @@ NRUN := 200
POPSIZE := 500
TESTNAME := test
TESTLS := fire
NUM_LSIT := 300
test: odock
$(BIN_DIR)/$(TARGET) -ffile ./input/$(PDB)/derived/$(PDB)_protein.maps.fld -lfile ./input/$(PDB)/derived/$(PDB)_ligand.pdbqt -nrun $(NRUN) -psize $(POPSIZE) -resnam $(TESTNAME) -gfpop 1 -lsmet $(TESTLS) -lsit $(NUM_LSIT) -smooth 0.5
$(BIN_DIR)/$(TARGET) -ffile ./input/$(PDB)/derived/$(PDB)_protein.maps.fld -lfile ./input/$(PDB)/derived/$(PDB)_ligand.pdbqt -nrun $(NRUN) -psize $(POPSIZE) -resnam $(TESTNAME) -gfpop 0 -lsmet $(TESTLS)
ASTEX_PDB := 2bsm
ASTEX_NRUN:= 10
......
This diff is collapsed.
......@@ -38,6 +38,7 @@ gradient_minFire(
int dockpars_num_of_genes,
float dockpars_lsearch_rate,
uint dockpars_num_of_lsentities,
uint dockpars_max_num_of_iters,
float dockpars_qasp,
__constant float* atom_charges_const,
__constant char* atom_types_const,
......@@ -61,11 +62,6 @@ gradient_minFire(
__constant int* rotbonds_const,
__constant int* rotbonds_atoms_const,
__constant int* num_rotating_atoms_per_rotbond_const
/*
// Specific gradient-minimizer args
,
uint gradMin_maxiters
*/
)
//The GPU global function performs gradient-based minimization on (some) entities of conformations_next.
//The number of OpenCL compute units (CU) which should be started equals to num_of_minEntities*num_of_runs.
......@@ -342,10 +338,16 @@ gradient_minFire(
gene_counter < dockpars_num_of_genes;
gene_counter+= NUM_OF_THREADS_PER_BLOCK) {
// TODO: remove division
velocity [gene_counter] = - native_divide(gradient [gene_counter], gradient_norm) * ALPHA_START;
}
barrier(CLK_LOCAL_MEM_FENCE);
/*
if (get_local_id(0) == 0 ){
printf("dt:%f, DT_MIN:%f, power: %f\n", dt, DT_MIN, power);
}
*/
// The termination criteria is based on
// a maximum number of iterations, and
......@@ -441,10 +443,11 @@ gradient_minFire(
gene_counter+= NUM_OF_THREADS_PER_BLOCK) {
//velocity [gene_counter] = (1 - alpha) * velocity [gene_counter] - alpha * gradient [gene_counter] * velnorm_div_gradnorm/*native_divide(velocity_norm, gradient_norm)*/;
velocity [gene_counter] = (1 - alpha) * velocity [gene_counter] - gradient [gene_counter] * velnorm_div_gradnorm;
velocity [gene_counter] = (1 - alpha) * velocity [gene_counter] - velnorm_div_gradnorm * gradient [gene_counter];
}
barrier(CLK_LOCAL_MEM_FENCE);
// Going uphill (against the gradient)
if (power < 0.0f) {
......@@ -456,15 +459,16 @@ gradient_minFire(
velocity [gene_counter] = - native_divide(gradient [gene_counter], gradient_norm) * ALPHA_START;
}
if (get_local_id (0) == 0) {
if (get_local_id(0) == 0) {
count_success = 0;
alpha = ALPHA_START;
dt = dt * DT_DEC;
//printf("UPHILL dt:%f, DT_MIN:%f, power: %f, count: %u \n", dt, DT_MIN, power, count_success);
}
}
// Going downhill
else {
if (get_local_id (0) == 0) {
if (get_local_id(0) == 0) {
count_success ++;
// Reaching minimum number of consecutive successful steps (power >= 0)
......@@ -472,6 +476,7 @@ gradient_minFire(
dt = fmin (dt * DT_INC, DT_MAX); // increase dt
alpha = alpha * ALPHA_DEC; // decrease alpha
}
//printf("DOWNHILL dt:%f, DT_MIN:%f, power: %f, count: %u \n", dt, DT_MIN, power, count_success);
}
}
barrier(CLK_LOCAL_MEM_FENCE);
......@@ -649,9 +654,10 @@ gradient_minFire(
printf("%-18s [%-5s]---{%-5s} [%-10.7f]---{%-10.7f}\n", "-ENERGY-KERNEL5-", "GRIDS", "INTRA", partial_interE[0], partial_intraE[0]);
#endif
}
barrier(CLK_LOCAL_MEM_FENCE);
} while (dt > DT_MIN);
// } while ((iteration_cnt < gradMin_maxiters) && (stepsize > 1E-8));
//} //while (dt > DT_MIN);
} while ((iteration_cnt < dockpars_max_num_of_iters) && (dt > DT_MIN));
// -----------------------------------------------------------------------------
......
......@@ -25,6 +25,7 @@ gradient_minimizer(
int dockpars_num_of_genes,
float dockpars_lsearch_rate,
uint dockpars_num_of_lsentities,
uint dockpars_max_num_of_iters,
float dockpars_qasp,
__constant float* atom_charges_const,
__constant char* atom_types_const,
......@@ -47,9 +48,7 @@ gradient_minimizer(
__constant float* ref_orientation_quats_const,
__constant int* rotbonds_const,
__constant int* rotbonds_atoms_const,
__constant int* num_rotating_atoms_per_rotbond_const,
// Specific gradient-minimizer args
uint gradMin_maxiters
__constant int* num_rotating_atoms_per_rotbond_const
)
//The GPU global function performs gradient-based minimization on (some) entities of conformations_next.
//The number of OpenCL compute units (CU) which should be started equals to num_of_minEntities*num_of_runs.
......@@ -531,7 +530,7 @@ gradient_minimizer(
#endif
}
} while ((iteration_cnt < gradMin_maxiters) && (stepsize > 1E-8));
} while ((iteration_cnt < dockpars_max_num_of_iters) && (stepsize > 1E-8));
// -----------------------------------------------------------------------------
......
......@@ -301,12 +301,15 @@ void get_commandpars(const int* argc,
if (strcmp(temp, "sw") == 0) {
strcpy(mypars->ls_method, temp);
mypars->max_num_of_iters = 300;
}
else if (strcmp(temp, "sd") == 0) {
strcpy(mypars->ls_method, temp);
mypars->max_num_of_iters = 30;
}
else if (strcmp(temp, "fire") == 0) {
strcpy(mypars->ls_method, temp);
mypars->max_num_of_iters = 30;
}
else {
printf("Warning: value of -lsmet argument ignored. Value must be a valid string: \"sw\", \"sd\", \"fire\".\n");
......
......@@ -447,15 +447,6 @@ filled with clock() */
//----------------------------------
// fastergrad
//----------------------------------
/*
gradientpars.max_num_of_iters = 300;
*/
/*
gradientpars.max_num_of_iters = 10;
*/
gradientpars.max_num_of_iters = (unsigned int) mypars->max_num_of_iters;
//----------------------------------
/*
gradientpars.max_num_of_consec_fails = (unsigned int)(0.05 * gradientpars.max_num_of_iters);
......@@ -729,31 +720,30 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
setKernelArg(kernel5,18,sizeof(dockpars.num_of_genes), &dockpars.num_of_genes);
setKernelArg(kernel5,19,sizeof(dockpars.lsearch_rate), &dockpars.lsearch_rate);
setKernelArg(kernel5,20,sizeof(dockpars.num_of_lsentities), &dockpars.num_of_lsentities);
setKernelArg(kernel5,21,sizeof(dockpars.qasp), &dockpars.qasp);
setKernelArg(kernel5,22,sizeof(mem_atom_charges_const), &mem_atom_charges_const);
setKernelArg(kernel5,23,sizeof(mem_atom_types_const), &mem_atom_types_const);
setKernelArg(kernel5,24,sizeof(mem_intraE_contributors_const), &mem_intraE_contributors_const);
setKernelArg(kernel5,25,sizeof(dockpars.smooth), &dockpars.smooth);
setKernelArg(kernel5,26,sizeof(mem_reqm_const), &mem_reqm_const);
setKernelArg(kernel5,27,sizeof(mem_reqm_hbond_const), &mem_reqm_hbond_const);
setKernelArg(kernel5,28,sizeof(mem_atom1_types_reqm_const), &mem_atom1_types_reqm_const);
setKernelArg(kernel5,29,sizeof(mem_atom2_types_reqm_const), &mem_atom2_types_reqm_const);
setKernelArg(kernel5,30,sizeof(mem_VWpars_AC_const), &mem_VWpars_AC_const);
setKernelArg(kernel5,31,sizeof(mem_VWpars_BD_const), &mem_VWpars_BD_const);
setKernelArg(kernel5,32,sizeof(mem_dspars_S_const), &mem_dspars_S_const);
setKernelArg(kernel5,33,sizeof(mem_dspars_V_const), &mem_dspars_V_const);
setKernelArg(kernel5,34,sizeof(mem_rotlist_const), &mem_rotlist_const);
setKernelArg(kernel5,35,sizeof(mem_ref_coords_x_const), &mem_ref_coords_x_const);
setKernelArg(kernel5,36,sizeof(mem_ref_coords_y_const), &mem_ref_coords_y_const);
setKernelArg(kernel5,37,sizeof(mem_ref_coords_z_const), &mem_ref_coords_z_const);
setKernelArg(kernel5,38,sizeof(mem_rotbonds_moving_vectors_const), &mem_rotbonds_moving_vectors_const);
setKernelArg(kernel5,39,sizeof(mem_rotbonds_unit_vectors_const), &mem_rotbonds_unit_vectors_const);
setKernelArg(kernel5,40,sizeof(mem_ref_orientation_quats_const), &mem_ref_orientation_quats_const);
setKernelArg(kernel5,41,sizeof(mem_rotbonds_const), &mem_rotbonds_const);
setKernelArg(kernel5,42,sizeof(mem_rotbonds_atoms_const), &mem_rotbonds_atoms_const);
setKernelArg(kernel5,43,sizeof(mem_num_rotating_atoms_per_rotbond_const),&mem_num_rotating_atoms_per_rotbond_const);
// Specific gradient-minimizer args
setKernelArg(kernel5,44,sizeof(gradientpars.max_num_of_iters), &gradientpars.max_num_of_iters);
setKernelArg(kernel5,21,sizeof(dockpars.max_num_of_iters), &dockpars.max_num_of_iters);
setKernelArg(kernel5,22,sizeof(dockpars.qasp), &dockpars.qasp);
setKernelArg(kernel5,23,sizeof(mem_atom_charges_const), &mem_atom_charges_const);
setKernelArg(kernel5,24,sizeof(mem_atom_types_const), &mem_atom_types_const);
setKernelArg(kernel5,25,sizeof(mem_intraE_contributors_const), &mem_intraE_contributors_const);
setKernelArg(kernel5,26,sizeof(dockpars.smooth), &dockpars.smooth);
setKernelArg(kernel5,27,sizeof(mem_reqm_const), &mem_reqm_const);
setKernelArg(kernel5,28,sizeof(mem_reqm_hbond_const), &mem_reqm_hbond_const);
setKernelArg(kernel5,29,sizeof(mem_atom1_types_reqm_const), &mem_atom1_types_reqm_const);
setKernelArg(kernel5,30,sizeof(mem_atom2_types_reqm_const), &mem_atom2_types_reqm_const);
setKernelArg(kernel5,31,sizeof(mem_VWpars_AC_const), &mem_VWpars_AC_const);
setKernelArg(kernel5,32,sizeof(mem_VWpars_BD_const), &mem_VWpars_BD_const);
setKernelArg(kernel5,33,sizeof(mem_dspars_S_const), &mem_dspars_S_const);
setKernelArg(kernel5,34,sizeof(mem_dspars_V_const), &mem_dspars_V_const);
setKernelArg(kernel5,35,sizeof(mem_rotlist_const), &mem_rotlist_const);
setKernelArg(kernel5,36,sizeof(mem_ref_coords_x_const), &mem_ref_coords_x_const);
setKernelArg(kernel5,37,sizeof(mem_ref_coords_y_const), &mem_ref_coords_y_const);
setKernelArg(kernel5,38,sizeof(mem_ref_coords_z_const), &mem_ref_coords_z_const);
setKernelArg(kernel5,39,sizeof(mem_rotbonds_moving_vectors_const), &mem_rotbonds_moving_vectors_const);
setKernelArg(kernel5,40,sizeof(mem_rotbonds_unit_vectors_const), &mem_rotbonds_unit_vectors_const);
setKernelArg(kernel5,41,sizeof(mem_ref_orientation_quats_const), &mem_ref_orientation_quats_const);
setKernelArg(kernel5,42,sizeof(mem_rotbonds_const), &mem_rotbonds_const);
setKernelArg(kernel5,43,sizeof(mem_rotbonds_atoms_const), &mem_rotbonds_atoms_const);
setKernelArg(kernel5,44,sizeof(mem_num_rotating_atoms_per_rotbond_const),&mem_num_rotating_atoms_per_rotbond_const);
kernel5_gxsize = blocksPerGridForEachGradMinimizerEntity * threadsPerBlock;
kernel5_lxsize = threadsPerBlock;
#ifdef DOCK_DEBUG
......@@ -783,29 +773,30 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
setKernelArg(kernel6,18,sizeof(dockpars.num_of_genes), &dockpars.num_of_genes);
setKernelArg(kernel6,19,sizeof(dockpars.lsearch_rate), &dockpars.lsearch_rate);
setKernelArg(kernel6,20,sizeof(dockpars.num_of_lsentities), &dockpars.num_of_lsentities);
setKernelArg(kernel6,21,sizeof(dockpars.qasp), &dockpars.qasp);
setKernelArg(kernel6,22,sizeof(mem_atom_charges_const), &mem_atom_charges_const);
setKernelArg(kernel6,23,sizeof(mem_atom_types_const), &mem_atom_types_const);
setKernelArg(kernel6,24,sizeof(mem_intraE_contributors_const), &mem_intraE_contributors_const);
setKernelArg(kernel6,25,sizeof(dockpars.smooth), &dockpars.smooth);
setKernelArg(kernel6,26,sizeof(mem_reqm_const), &mem_reqm_const);
setKernelArg(kernel6,27,sizeof(mem_reqm_hbond_const), &mem_reqm_hbond_const);
setKernelArg(kernel6,28,sizeof(mem_atom1_types_reqm_const), &mem_atom1_types_reqm_const);
setKernelArg(kernel6,29,sizeof(mem_atom2_types_reqm_const), &mem_atom2_types_reqm_const);
setKernelArg(kernel6,30,sizeof(mem_VWpars_AC_const), &mem_VWpars_AC_const);
setKernelArg(kernel6,31,sizeof(mem_VWpars_BD_const), &mem_VWpars_BD_const);
setKernelArg(kernel6,32,sizeof(mem_dspars_S_const), &mem_dspars_S_const);
setKernelArg(kernel6,33,sizeof(mem_dspars_V_const), &mem_dspars_V_const);
setKernelArg(kernel6,34,sizeof(mem_rotlist_const), &mem_rotlist_const);
setKernelArg(kernel6,35,sizeof(mem_ref_coords_x_const), &mem_ref_coords_x_const);
setKernelArg(kernel6,36,sizeof(mem_ref_coords_y_const), &mem_ref_coords_y_const);
setKernelArg(kernel6,37,sizeof(mem_ref_coords_z_const), &mem_ref_coords_z_const);
setKernelArg(kernel6,38,sizeof(mem_rotbonds_moving_vectors_const), &mem_rotbonds_moving_vectors_const);
setKernelArg(kernel6,39,sizeof(mem_rotbonds_unit_vectors_const), &mem_rotbonds_unit_vectors_const);
setKernelArg(kernel6,40,sizeof(mem_ref_orientation_quats_const), &mem_ref_orientation_quats_const);
setKernelArg(kernel6,41,sizeof(mem_rotbonds_const), &mem_rotbonds_const);
setKernelArg(kernel6,42,sizeof(mem_rotbonds_atoms_const), &mem_rotbonds_atoms_const);
setKernelArg(kernel6,43,sizeof(mem_num_rotating_atoms_per_rotbond_const),&mem_num_rotating_atoms_per_rotbond_const);
setKernelArg(kernel6,21,sizeof(dockpars.max_num_of_iters), &dockpars.max_num_of_iters);
setKernelArg(kernel6,22,sizeof(dockpars.qasp), &dockpars.qasp);
setKernelArg(kernel6,23,sizeof(mem_atom_charges_const), &mem_atom_charges_const);
setKernelArg(kernel6,24,sizeof(mem_atom_types_const), &mem_atom_types_const);
setKernelArg(kernel6,25,sizeof(mem_intraE_contributors_const), &mem_intraE_contributors_const);
setKernelArg(kernel6,26,sizeof(dockpars.smooth), &dockpars.smooth);
setKernelArg(kernel6,27,sizeof(mem_reqm_const), &mem_reqm_const);
setKernelArg(kernel6,28,sizeof(mem_reqm_hbond_const), &mem_reqm_hbond_const);
setKernelArg(kernel6,29,sizeof(mem_atom1_types_reqm_const), &mem_atom1_types_reqm_const);
setKernelArg(kernel6,30,sizeof(mem_atom2_types_reqm_const), &mem_atom2_types_reqm_const);
setKernelArg(kernel6,31,sizeof(mem_VWpars_AC_const), &mem_VWpars_AC_const);
setKernelArg(kernel6,32,sizeof(mem_VWpars_BD_const), &mem_VWpars_BD_const);
setKernelArg(kernel6,33,sizeof(mem_dspars_S_const), &mem_dspars_S_const);
setKernelArg(kernel6,34,sizeof(mem_dspars_V_const), &mem_dspars_V_const);
setKernelArg(kernel6,35,sizeof(mem_rotlist_const), &mem_rotlist_const);
setKernelArg(kernel6,36,sizeof(mem_ref_coords_x_const), &mem_ref_coords_x_const);
setKernelArg(kernel6,37,sizeof(mem_ref_coords_y_const), &mem_ref_coords_y_const);
setKernelArg(kernel6,38,sizeof(mem_ref_coords_z_const), &mem_ref_coords_z_const);
setKernelArg(kernel6,39,sizeof(mem_rotbonds_moving_vectors_const), &mem_rotbonds_moving_vectors_const);
setKernelArg(kernel6,40,sizeof(mem_rotbonds_unit_vectors_const), &mem_rotbonds_unit_vectors_const);
setKernelArg(kernel6,41,sizeof(mem_ref_orientation_quats_const), &mem_ref_orientation_quats_const);
setKernelArg(kernel6,42,sizeof(mem_rotbonds_const), &mem_rotbonds_const);
setKernelArg(kernel6,43,sizeof(mem_rotbonds_atoms_const), &mem_rotbonds_atoms_const);
setKernelArg(kernel6,44,sizeof(mem_num_rotating_atoms_per_rotbond_const),&mem_num_rotating_atoms_per_rotbond_const);
kernel6_gxsize = blocksPerGridForEachGradMinimizerEntity * threadsPerBlock;
kernel6_lxsize = threadsPerBlock;
#ifdef DOCK_DEBUG
......@@ -933,6 +924,24 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
#endif
// End of Kernel5
/*
#endif
*/
} else if (strcmp(mypars->ls_method, "fire") == 0) {
// Kernel5
#ifdef DOCK_DEBUG
printf("%-25s", "K_GRAD_MINFIRE: ");fflush(stdout);
#endif
runKernel1D(command_queue,kernel6,kernel6_gxsize,kernel6_lxsize,&time_start_kernel,&time_end_kernel);
#ifdef DOCK_DEBUG
printf("%15s" ," ... Finished\n");fflush(stdout);
#endif
// End of Kernel5
/*
#endif
*/
......
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