Commit 9f3aedd6 authored by lvs's avatar lvs
Browse files

added -lsrat 0 support,solved issue #17

parent dfa9a2c2
......@@ -428,25 +428,40 @@ filled with clock() */
dockpars.mutation_rate = mypars->mutation_rate/100.f;
dockpars.abs_max_dang = mypars->abs_max_dang;
dockpars.abs_max_dmov = mypars->abs_max_dmov;
dockpars.qasp = mypars->qasp;
dockpars.smooth = mypars->smooth;
unsigned int g2 = dockpars.gridsize_x * dockpars.gridsize_y;
unsigned int g3 = dockpars.gridsize_x * dockpars.gridsize_y * dockpars.gridsize_z;
dockpars.lsearch_rate = mypars->lsearch_rate;
if (dockpars.lsearch_rate != 0.0f)
{
dockpars.num_of_lsentities = (unsigned int) (mypars->lsearch_rate/100.0*mypars->pop_size + 0.5);
dockpars.rho_lower_bound = mypars->rho_lower_bound;
dockpars.base_dmov_mul_sqrt3 = mypars->base_dmov_mul_sqrt3;
dockpars.base_dang_mul_sqrt3 = mypars->base_dang_mul_sqrt3;
dockpars.cons_limit = (unsigned int) mypars->cons_limit;
dockpars.max_num_of_iters = (unsigned int) mypars->max_num_of_iters;
dockpars.qasp = mypars->qasp;
dockpars.smooth = mypars->smooth;
unsigned int g2 = dockpars.gridsize_x * dockpars.gridsize_y;
unsigned int g3 = dockpars.gridsize_x * dockpars.gridsize_y * dockpars.gridsize_z;
// The number of entities that undergo Solis-Wets minimization,
blocksPerGridForEachLSEntity = dockpars.num_of_lsentities*mypars->num_of_runs;
printf("Local-search chosen method is: %s\n", (strcmp(mypars->ls_method, "sw") == 0)?"Solis-Wets":
(strcmp(mypars->ls_method, "sd") == 0)?"Steepest descent":
(strcmp(mypars->ls_method, "fire") == 0)?"Fire": "Unknown");
// The number of entities that undergo any gradient-based minimization,
// by default, it is the same as the number of entities that undergo the Solis-Wets minimizer
blocksPerGridForEachGradMinimizerEntity = dockpars.num_of_lsentities*mypars->num_of_runs;
// For testing: only one entity per reach run, undergoes gradient minimization
//blocksPerGridForEachGradMinimizerEntity = mypars->num_of_runs;
}
blocksPerGridForEachLSEntity = dockpars.num_of_lsentities*mypars->num_of_runs;
printf("Local-search chosen method is: %s\n", (dockpars.lsearch_rate == 0.0f)? "GA" :
(
(strcmp(mypars->ls_method, "sw") == 0)?"Solis-Wets":
(strcmp(mypars->ls_method, "sd") == 0)?"Steepest descent":
(strcmp(mypars->ls_method, "fire") == 0)?"Fire": "Unknown")
);
/*
printf("dockpars.num_of_intraE_contributors:%u\n", dockpars.num_of_intraE_contributors);
......@@ -489,16 +504,7 @@ filled with clock() */
*/
///*
// Initially, the number of entities that undergo gradient-minimization,
// by default, it is the same as the number of entities that undergo gradient-based minimizer
blocksPerGridForEachGradMinimizerEntity = dockpars.num_of_lsentities*mypars->num_of_runs;
//*/
/*
// test, only one entity per reach run, undergoes gradient minimization
blocksPerGridForEachGradMinimizerEntity = mypars->num_of_runs;
*/
clock_start_docking = clock();
......@@ -535,12 +541,7 @@ filled with clock() */
}
*/
// Kernel1
// Kernel1
setKernelArg(kernel1,0, sizeof(dockpars.num_of_atoms), &dockpars.num_of_atoms);
setKernelArg(kernel1,1, sizeof(dockpars.num_of_atypes), &dockpars.num_of_atypes);
setKernelArg(kernel1,2, sizeof(dockpars.num_of_intraE_contributors), &dockpars.num_of_intraE_contributors);
......@@ -584,10 +585,9 @@ filled with clock() */
#ifdef DOCK_DEBUG
printf("%-25s %10s %8u %10s %4u\n", "Kernel1: ", "gSize: ", kernel1_gxsize, "lSize: ", kernel1_lxsize); fflush(stdout);
#endif
// End of Kernel1
// End of Kernel1
// Kernel2
// setKernelArg(kernel2,0,sizeof(mypars->pop_size), &mypars->pop_size);
// Kernel2
setKernelArg(kernel2,0,sizeof(dockpars.pop_size), &dockpars.pop_size);
setKernelArg(kernel2,1,sizeof(mem_dockpars_evals_of_new_entities), &mem_dockpars_evals_of_new_entities);
setKernelArg(kernel2,2,sizeof(mem_gpu_evals_of_runs), &mem_gpu_evals_of_runs);
......@@ -596,9 +596,9 @@ filled with clock() */
#ifdef DOCK_DEBUG
printf("%-25s %10s %8u %10s %4u\n", "Kernel2: ", "gSize: ", kernel2_gxsize, "lSize: ", kernel2_lxsize); fflush(stdout);
#endif
// End of Kernel2
// End of Kernel2
// Kernel4
// Kernel4
setKernelArg(kernel4,0, sizeof(dockpars.num_of_atoms), &dockpars.num_of_atoms);
setKernelArg(kernel4,1, sizeof(dockpars.num_of_atypes), &dockpars.num_of_atypes);
setKernelArg(kernel4,2, sizeof(dockpars.num_of_intraE_contributors), &dockpars.num_of_intraE_contributors);
......@@ -651,14 +651,13 @@ filled with clock() */
#ifdef DOCK_DEBUG
printf("%-25s %10s %8u %10s %4u\n", "K_GENETIC_GENERATION: ", "gSize: ", kernel4_gxsize, "lSize: ", kernel4_lxsize); fflush(stdout);
#endif
// End of Kernel4
// End of Kernel4
/*
#if !defined (GRADIENT_ENABLED)
*/
if (strcmp(mypars->ls_method, "sw") == 0) {
// Kernel3
if (dockpars.lsearch_rate != 0.0f) {
if (strcmp(mypars->ls_method, "sw") == 0) {
// Kernel3
setKernelArg(kernel3,0, sizeof(dockpars.num_of_atoms), &dockpars.num_of_atoms);
setKernelArg(kernel3,1, sizeof(dockpars.num_of_atypes), &dockpars.num_of_atypes);
setKernelArg(kernel3,2, sizeof(dockpars.num_of_intraE_contributors), &dockpars.num_of_intraE_contributors);
......@@ -710,9 +709,9 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
#ifdef DOCK_DEBUG
printf("%-25s %10s %8u %10s %4u\n", "K_LOCAL_SEARCH: ", "gSize: ", kernel3_gxsize, "lSize: ", kernel3_lxsize); fflush(stdout);
#endif
// End of Kernel3
} else if (strcmp(mypars->ls_method, "sd") == 0) {
// Kernel5
// End of Kernel3
} else if (strcmp(mypars->ls_method, "sd") == 0) {
// Kernel5
setKernelArg(kernel5,0, sizeof(dockpars.num_of_atoms), &dockpars.num_of_atoms);
setKernelArg(kernel5,1, sizeof(dockpars.num_of_atypes), &dockpars.num_of_atypes);
setKernelArg(kernel5,2, sizeof(dockpars.num_of_intraE_contributors), &dockpars.num_of_intraE_contributors);
......@@ -758,19 +757,17 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
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);
setKernelArg(kernel5,45,sizeof(mem_angle_const) ,&mem_angle_const);
setKernelArg(kernel5,46,sizeof(mem_dependence_on_theta_const) ,&mem_dependence_on_theta_const);
setKernelArg(kernel5,47,sizeof(mem_dependence_on_rotangle_const) ,&mem_dependence_on_rotangle_const);
setKernelArg(kernel5,45,sizeof(mem_angle_const), &mem_angle_const);
setKernelArg(kernel5,46,sizeof(mem_dependence_on_theta_const), &mem_dependence_on_theta_const);
setKernelArg(kernel5,47,sizeof(mem_dependence_on_rotangle_const), &mem_dependence_on_rotangle_const);
kernel5_gxsize = blocksPerGridForEachGradMinimizerEntity * threadsPerBlock;
kernel5_lxsize = threadsPerBlock;
#ifdef DOCK_DEBUG
#ifdef DOCK_DEBUG
printf("%-25s %10s %8u %10s %4u\n", "K_GRAD_MINIMIZER: ", "gSize: ", kernel5_gxsize, "lSize: ", kernel5_lxsize); fflush(stdout);
#endif
// End of Kernel5
} else if (strcmp(mypars->ls_method, "fire") == 0) {
// Kernel6
#endif
// End of Kernel5
} else if (strcmp(mypars->ls_method, "fire") == 0) {
// Kernel6
setKernelArg(kernel6,0, sizeof(dockpars.num_of_atoms), &dockpars.num_of_atoms);
setKernelArg(kernel6,1, sizeof(dockpars.num_of_atypes), &dockpars.num_of_atypes);
setKernelArg(kernel6,2, sizeof(dockpars.num_of_intraE_contributors), &dockpars.num_of_intraE_contributors);
......@@ -816,36 +813,19 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
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);
setKernelArg(kernel6,45,sizeof(mem_angle_const) ,&mem_angle_const);
setKernelArg(kernel6,46,sizeof(mem_dependence_on_theta_const) ,&mem_dependence_on_theta_const);
setKernelArg(kernel6,47,sizeof(mem_dependence_on_rotangle_const) ,&mem_dependence_on_rotangle_const);
setKernelArg(kernel6,45,sizeof(mem_angle_const), &mem_angle_const);
setKernelArg(kernel6,46,sizeof(mem_dependence_on_theta_const), &mem_dependence_on_theta_const);
setKernelArg(kernel6,47,sizeof(mem_dependence_on_rotangle_const), &mem_dependence_on_rotangle_const);
kernel6_gxsize = blocksPerGridForEachGradMinimizerEntity * threadsPerBlock;
kernel6_lxsize = threadsPerBlock;
#ifdef DOCK_DEBUG
#ifdef DOCK_DEBUG
printf("%-25s %10s %8u %10s %4u\n", "K_GRAD_MINFIRE: ", "gSize: ", kernel6_gxsize, "lSize: ", kernel6_lxsize); fflush(stdout);
#endif
// End of Kernel5
}
#endif
// End of Kernel6
}
} // End if (dockpars.lsearch_rate != 0.0f)
// Kernel1
// Kernel1
#ifdef DOCK_DEBUG
printf("Start Kernel1 ... ");fflush(stdout);
#endif
......@@ -853,9 +833,9 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
#ifdef DOCK_DEBUG
printf(" ... Finish Kernel1\n");fflush(stdout);
#endif
// End of Kernel1
// End of Kernel1
// Kernel2
// Kernel2
#ifdef DOCK_DEBUG
printf("Start Kernel2 ... ");fflush(stdout);
#endif
......@@ -863,7 +843,7 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
#ifdef DOCK_DEBUG
printf(" ... Finish Kernel2\n");fflush(stdout);
#endif
// End of Kernel2
// End of Kernel2
// ===============================================================================
......@@ -908,7 +888,7 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
fflush(stdout);
}
// Kernel4
// Kernel4
#ifdef DOCK_DEBUG
printf("%-25s", "K_GENETIC_GENERATION: ");fflush(stdout);
#endif
......@@ -916,13 +896,11 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
#ifdef DOCK_DEBUG
printf("%15s", " ... Finished\n");fflush(stdout);
#endif
// End of Kernel4
// End of Kernel4
if (dockpars.lsearch_rate != 0.0f) {
if (strcmp(mypars->ls_method, "sw") == 0) {
/*
#if !defined (GRADIENT_ENABLED)
*/
// Kernel3
// Kernel3
#ifdef DOCK_DEBUG
printf("%-25s", "K_LOCAL_SEARCH: ");fflush(stdout);
#endif
......@@ -930,15 +908,10 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
#ifdef DOCK_DEBUG
printf("%15s" ," ... Finished\n");fflush(stdout);
#endif
// End of Kernel3
// End of Kernel3
/*
#else
*/
} else if (strcmp(mypars->ls_method, "sd") == 0) {
// Kernel5
// Kernel5
#ifdef DOCK_DEBUG
printf("%-25s", "K_GRAD_MINIMIZER: ");fflush(stdout);
#endif
......@@ -946,17 +919,10 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
#ifdef DOCK_DEBUG
printf("%15s" ," ... Finished\n");fflush(stdout);
#endif
// End of Kernel5
/*
#endif
*/
// End of Kernel5
} else if (strcmp(mypars->ls_method, "fire") == 0) {
// Kernel5
// Kernel6
#ifdef DOCK_DEBUG
printf("%-25s", "K_GRAD_MINFIRE: ");fflush(stdout);
#endif
......@@ -964,14 +930,11 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
#ifdef DOCK_DEBUG
printf("%15s" ," ... Finished\n");fflush(stdout);
#endif
// End of Kernel5
/*
#endif
*/
// End of Kernel6
}
} // End if (dockpars.lsearch_rate != 0.0f)
// Kernel2
// Kernel2
#ifdef DOCK_DEBUG
printf("Start Kernel2 ... ");fflush(stdout);
#endif
......@@ -979,7 +942,7 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
#ifdef DOCK_DEBUG
printf(" ... Finish Kernel2\n");fflush(stdout);
#endif
// End of Kernel2
// End of Kernel2
// ===============================================================================
......@@ -1012,28 +975,22 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
setKernelArg(kernel4,14,sizeof(mem_dockpars_energies_next), &mem_dockpars_energies_next);
setKernelArg(kernel4,15,sizeof(mem_dockpars_conformations_current), &mem_dockpars_conformations_current);
setKernelArg(kernel4,16,sizeof(mem_dockpars_energies_current), &mem_dockpars_energies_current);
/*
#if !defined (GRADIENT_ENABLED)
*/
if (dockpars.lsearch_rate != 0.0f) {
if (strcmp(mypars->ls_method, "sw") == 0) {
// Kernel 3
setKernelArg(kernel3,13,sizeof(mem_dockpars_conformations_current), &mem_dockpars_conformations_current);
setKernelArg(kernel3,14,sizeof(mem_dockpars_energies_current), &mem_dockpars_energies_current);
/*
#else
*/
} else if (strcmp(mypars->ls_method, "sd") == 0) {
// Kernel 5
setKernelArg(kernel5,13,sizeof(mem_dockpars_conformations_current), &mem_dockpars_conformations_current);
setKernelArg(kernel5,14,sizeof(mem_dockpars_energies_current), &mem_dockpars_energies_current);
/*
#endif
*/
} else if (strcmp(mypars->ls_method, "fire") == 0) {
// Kernel 6
setKernelArg(kernel6,13,sizeof(mem_dockpars_conformations_current), &mem_dockpars_conformations_current);
setKernelArg(kernel6,14,sizeof(mem_dockpars_energies_current), &mem_dockpars_energies_current);
}
} // End if (dockpars.lsearch_rate != 0.0f)
}
else { // In this configuration, the program starts
// Kernel 4
......@@ -1042,28 +999,21 @@ if (strcmp(mypars->ls_method, "sw") == 0) {
setKernelArg(kernel4,15,sizeof(mem_dockpars_conformations_next), &mem_dockpars_conformations_next);
setKernelArg(kernel4,16,sizeof(mem_dockpars_energies_next), &mem_dockpars_energies_next);
if (dockpars.lsearch_rate != 0.0f) {
if (strcmp(mypars->ls_method, "sw") == 0) {
/*
#if !defined (GRADIENT_ENABLED)
*/
// Kernel 3
setKernelArg(kernel3,13,sizeof(mem_dockpars_conformations_next), &mem_dockpars_conformations_next);
setKernelArg(kernel3,14,sizeof(mem_dockpars_energies_next), &mem_dockpars_energies_next);
/*
#else
*/
} else if (strcmp(mypars->ls_method, "sd") == 0) {
// Kernel 5
setKernelArg(kernel5,13,sizeof(mem_dockpars_conformations_next), &mem_dockpars_conformations_next);
setKernelArg(kernel5,14,sizeof(mem_dockpars_energies_next), &mem_dockpars_energies_next);
/*
#endif
*/
} else if (strcmp(mypars->ls_method, "fire") == 0) {
// Kernel 6
setKernelArg(kernel6,13,sizeof(mem_dockpars_conformations_next), &mem_dockpars_conformations_next);
setKernelArg(kernel6,14,sizeof(mem_dockpars_energies_next), &mem_dockpars_energies_next);
}
} // End if (dockpars.lsearch_rate != 0.0f)
}
// ----------------------------------------------------------------------
......
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