Commit 389c51af authored by Leonardo Solis's avatar Leonardo Solis

added commandline option to choose localsearchmethod

parent 588ac909
......@@ -213,9 +213,10 @@ ASTEX_PDB := 2bsm
ASTEX_NRUN:= 10
ASTEX_POPSIZE := 10
ASTEX_TESTNAME := test_astex
ASTEX_LS := sw
astex: odock
$(BIN_DIR)/$(TARGET) -ffile ./input_tsri/search-set-astex/$(ASTEX_PDB)/protein.maps.fld -lfile ./input_tsri/search-set-astex/$(ASTEX_PDB)/flex-xray.pdbqt -nrun $(ASTEX_NRUN) -psize $(ASTEX_POPSIZE) -resnam $(ASTEX_TESTNAME) -gfpop 1
$(BIN_DIR)/$(TARGET) -ffile ./input_tsri/search-set-astex/$(ASTEX_PDB)/protein.maps.fld -lfile ./input_tsri/search-set-astex/$(ASTEX_PDB)/flex-xray.pdbqt -nrun $(ASTEX_NRUN) -psize $(ASTEX_POPSIZE) -resnam $(ASTEX_TESTNAME) -gfpop 1 -lsmet $(ASTEX_LS)
# $(BIN_DIR)/$(TARGET) -ffile ./input_tsri/search-set-astex/$(ASTEX_PDB)/protein.maps.fld -lfile ./input_tsri/search-set-astex/$(ASTEX_PDB)/flex-xray.pdbqt -nrun $(ASTEX_NRUN) -psize $(ASTEX_POPSIZE) -resnam $(ASTEX_TESTNAME) -gfpop 1 | tee ./input_tsri/search-set-astex/intrapairs/$(ASTEX_PDB)_intrapair.txt
......
......@@ -62,7 +62,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// TODO: convert this into a program arg
#define GRADIENT_ENABLED
//#define GRADIENT_ENABLED
......
......@@ -54,6 +54,7 @@ typedef struct
float crossover_rate;
float lsearch_rate;
unsigned long num_of_ls;
char ls_method[128];
float tournament_rate;
float rho_lower_bound;
float base_dmov_mul_sqrt3;
......
......@@ -145,6 +145,10 @@ void get_commandpars(const int* argc,
mypars->crossover_rate = 80; // 80%
mypars->lsearch_rate = 6; // 6%
// unsigned long num_of_ls
strcpy(mypars->ls_method, "sw"); // "sw": Solis-Wetts,
// "sd": Steepest-Descent",
// "bfgs": Broyden-Fletcher-Goldfarb-Shanno (to be implemented)
mypars->tournament_rate = 60; // 60%
mypars->rho_lower_bound = 0.01; // 0.01
mypars->base_dmov_mul_sqrt3 = 2.0/(*spacing)*sqrt(3.0); // 2 A
......@@ -268,6 +272,30 @@ void get_commandpars(const int* argc,
// MISSING: unsigned long num_of_ls
// ---------------------------------
//Argument: local search method:
// "sw": Solis-Wetts
// "sd": Steepest-Descent
// "bfgs": Broyden-Fletcher-Goldfarb-Shanno (to be implemented)
if (strcmp("-lsmet", argv [i]) == 0)
{
arg_recognized = 1;
char temp[128];
strcpy(temp, argv [i+1]);
if (strcmp(temp, "sw") == 0) {
strcpy(mypars->ls_method, temp);
}
else if (strcmp(temp, "sd") == 0) {
strcpy(mypars->ls_method, temp);
}
else {
printf("Warning: value of -lsmet argument ignored. Value must be a valid string: \"sw\", \"sd\".\n");
}
}
//Argument: tournament rate. Must be a float between 50 and 100.
//Means the probability that the better entity wins the tournament round during selectin
if (strcmp("-trat", argv [i]) == 0)
......
......@@ -401,6 +401,10 @@ filled with clock() */
unsigned int g2 = dockpars.gridsize_x * dockpars.gridsize_y;
unsigned int g3 = dockpars.gridsize_x * dockpars.gridsize_y * dockpars.gridsize_z;
printf("Local-search chosen method is: %s\n", (strcmp(mypars->ls_method, "sw") == 0)?"Solis-Wetts":
(strcmp(mypars->ls_method, "sd") == 0)?"Steepest descent": "Unknown");
blocksPerGridForEachLSEntity = dockpars.num_of_lsentities*mypars->num_of_runs;
/*
......@@ -455,6 +459,9 @@ filled with clock() */
clock_start_docking = clock();
//print progress bar
#ifndef DOCK_DEBUG
printf("\nExecuting docking runs:\n");
......@@ -592,7 +599,10 @@ filled with clock() */
// End of Kernel4
/*
#if !defined (GRADIENT_ENABLED)
*/
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);
......@@ -641,7 +651,11 @@ filled with clock() */
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) {
/*
#else
*/
// 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);
......@@ -695,9 +709,11 @@ filled with clock() */
printf("%-25s %10s %8u %10s %4u\n", "K_GRAD_MINIMIZER: ", "gSize: ", kernel5_gxsize, "lSize: ", kernel5_lxsize); fflush(stdout);
#endif
// End of Kernel5
#endif
/*
#endif
*/
}
......@@ -786,7 +802,10 @@ filled with clock() */
#endif
// End of Kernel4
if (strcmp(mypars->ls_method, "sw") == 0) {
/*
#if !defined (GRADIENT_ENABLED)
*/
// Kernel3
#ifdef DOCK_DEBUG
printf("%-25s", "K_LOCAL_SEARCH: ");fflush(stdout);
......@@ -796,7 +815,13 @@ filled with clock() */
printf("%15s" ," ... Finished\n");fflush(stdout);
#endif
// End of Kernel3
/*
#else
*/
} else if (strcmp(mypars->ls_method, "sd") == 0) {
// Kernel5
#ifdef DOCK_DEBUG
printf("%-25s", "K_GRAD_MINIMIZER: ");fflush(stdout);
......@@ -806,7 +831,11 @@ filled with clock() */
printf("%15s" ," ... Finished\n");fflush(stdout);
#endif
// End of Kernel5
/*
#endif
*/
}
// Kernel2
#ifdef DOCK_DEBUG
......@@ -849,16 +878,24 @@ filled with clock() */
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 (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 { // In this configuration, the program starts
// Kernel 4
......@@ -867,15 +904,24 @@ filled with clock() */
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 (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
*/
}
}
// ----------------------------------------------------------------------
......@@ -987,11 +1033,20 @@ filled with clock() */
clReleaseKernel(kernel1);
clReleaseKernel(kernel2);
clReleaseKernel(kernel4);
/*
#if !defined (GRADIENT_ENABLED)
*/
if (strcmp(mypars->ls_method, "sw") == 0) {
clReleaseKernel(kernel3);
/*
#else
*/
} else if (strcmp(mypars->ls_method, "sd") == 0) {
clReleaseKernel(kernel5);
/*
#endif
*/
}
clReleaseCommandQueue(command_queue);
clReleaseContext(context);
free(device_id);
......
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