Commit f74dcfce authored by lvs's avatar lvs
Browse files

tor-grad in parallel

parent 80ac51df
......@@ -201,14 +201,15 @@ odock: check-env-all stringify $(SRC)
# 7cpa: for testing gradients of torsion genes (15 torsions)
# 3tmn: for testing gradients of torsion genes (1 torsion)
PDB := 3ce3
NRUN := 100
POPSIZE := 150
TESTNAME:= test
TESTLS := sd
PDB := 3ce3
NRUN := 100
POPSIZE := 150
TESTNAME := test
TESTLS := sw
NUM_LSIT := 10
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)
$(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)
ASTEX_PDB := 2bsm
ASTEX_NRUN:= 10
......
......@@ -172,7 +172,14 @@ void gpu_calc_energy(
atom_to_rotate[2] -= rotation_movingvec[2];
// Transforming torsion angles into quaternions
//----------------------------------
// fastergrad
//----------------------------------
/*
rotation_angle = native_divide(rotation_angle, 2.0f);
*/
rotation_angle = rotation_angle * 0.5f;
//----------------------------------
float sin_angle = native_sin(rotation_angle);
quatrot_left_q = native_cos(rotation_angle);
quatrot_left_x = sin_angle*rotation_unitvec[0];
......
......@@ -218,7 +218,15 @@ void gpu_calc_gradient(
atom_to_rotate[2] -= rotation_movingvec[2];
// Transforming torsion angles into quaternions
//----------------------------------
// fastergrad
//----------------------------------
/*
rotation_angle = native_divide(rotation_angle, 2.0f);
*/
rotation_angle = rotation_angle * 0.5f;
//----------------------------------
float sin_angle = native_sin(rotation_angle);
quatrot_left_q = native_cos(rotation_angle);
quatrot_left_x = sin_angle*rotation_unitvec[0];
......@@ -955,11 +963,22 @@ void gpu_calc_gradient(
// ------------------------------------------
// Obtaining torsion-related gradients
// ------------------------------------------
//----------------------------------
// fastergrad
//----------------------------------
/*
if (get_local_id(0) == 2) {
for (uint rotbond_id = 0;
rotbond_id < dockpars_num_of_genes-6;
rotbond_id ++) {
*/
for (uint rotbond_id = get_local_id(0);
rotbond_id < dockpars_num_of_genes-6;
rotbond_id +=NUM_OF_THREADS_PER_BLOCK) {
//----------------------------------
// Querying ids of atoms belonging to the rotatable bond in question
int atom1_id = rotbonds_const[2*rotbond_id];
......@@ -1052,6 +1071,12 @@ void gpu_calc_gradient(
#endif
} // End of iterations over rotatable bonds
}
//----------------------------------
// fastergrad
//----------------------------------
/*
}
*/
//----------------------------------
}
......@@ -249,6 +249,24 @@ gradient_minimizer(
}
barrier(CLK_LOCAL_MEM_FENCE);
//----------------------------------
// fastergrad
//----------------------------------
// Calculating maximum possible stepsize (alpha)
__local float max_trans_gene, max_rota_gene, max_tors_gene;
__local float max_trans_stepsize, max_rota_stepsize, max_tors_stepsize;
__local float max_stepsize;
//----------------------------------
//----------------------------------
// fastergrad
//----------------------------------
__local float torsions_genotype[ACTUAL_GENOTYPE_LENGTH];
//----------------------------------
// The termination criteria is based on
// a maximum number of iterations, and
// the minimum step size allowed for single-floating point numbers
......@@ -297,11 +315,16 @@ gradient_minimizer(
#endif
//----------------------------------
// fastergrad
//----------------------------------
/*
// Calculating maximum possible stepsize (alpha)
__local float max_trans_gene, max_rota_gene, max_tors_gene;
__local float max_trans_stepsize, max_rota_stepsize, max_tors_stepsize;
__local float max_stepsize;
*/
//----------------------------------
if (get_local_id(0) == 0) {
// Finding maximum of the absolute value
......@@ -324,7 +347,15 @@ gradient_minimizer(
}
// Copying torsions genes
//----------------------------------
// fastergrad
//----------------------------------
/*
__local float torsions_genotype[ACTUAL_GENOTYPE_LENGTH];
*/
//----------------------------------
for(uint i = get_local_id(0);
i < dockpars_num_of_genes-6;
i+= NUM_OF_THREADS_PER_BLOCK) {
......@@ -441,6 +472,18 @@ gradient_minimizer(
barrier(CLK_LOCAL_MEM_FENCE);
//----------------------------------
// fastergrad
//----------------------------------
/*
if ((get_group_id(0) == 0) && (get_local_id(0) == 0)) {
for(uint i = 0; i < dockpars_num_of_genes; i++) {
printf("gradient[%u]=%f \n", i, gradient[i]);
}
}
*/
//----------------------------------
for(uint i = get_local_id(0); i < dockpars_num_of_genes; i+= NUM_OF_THREADS_PER_BLOCK) {
......
......@@ -423,7 +423,18 @@ filled with clock() */
// Setup here (temporarily?) the gradient and associated parameters.
// This should be ultimately configurable by the user as program exec. flags.
Gradientparameters gradientpars;
//----------------------------------
// 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);
......
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