Commit d65a225d authored by Leonardo Solis's avatar Leonardo Solis
Browse files

reordered in gradient_minimizer

parent 6b052b35
// Implementation of auxiliary functions
// for the gradient-based minimizer
bool is_gradDescent_enabled(
void is_gradDescent_enabled(
__local bool* is_perturb_gt_gene_min,
__local float* local_gNorm,
float gradMin_tol,
......@@ -9,8 +9,9 @@ bool is_gradDescent_enabled(
uint gradMin_maxiter,
__local float* local_perturbation,
__constant float* gradMin_conformation_min_perturbation,
__local bool* is_gradDescentEn,
uint gradMin_numElements)
uint gradMin_numElements,
__local bool* is_gradDescentEn
)
{
bool is_gNorm_gt_gMin;
bool is_nIter_lt_maxIter;
......@@ -60,10 +61,10 @@ bool is_gradDescent_enabled(
*/
}
/*
barrier(CLK_LOCAL_MEM_FENCE);
return *is_gradDescentEn;
*/
}
void gradient_norm(
......@@ -82,6 +83,8 @@ void gradient_norm(
init[i] = vector1[i] * vector1[i];
}
barrier(CLK_LOCAL_MEM_FENCE);
// Accumulating dot product,
// and then getting the norm
if(get_local_id(0) == 0) {
......
......@@ -178,16 +178,7 @@ gradient_minimizer(
// -----------------------------------------------------------------------------
// Perform gradient-descent iterations
while (is_gradDescent_enabled(
is_perturb_gt_gene_min,
&local_gNorm,
gradMin_tol,
&local_nIter,
gradMin_maxiter,
local_perturbation,
gradMin_conformation_min_perturbation,
&is_gradDescentEn,
dockpars_num_of_genes) == true) {
do {
// Calculating gradient
// =============================================================
......@@ -257,6 +248,9 @@ gradient_minimizer(
// Updating current solution
local_genotype[i] = local_genotype_new[i];
// Storing all gene-based perturbations
local_perturbation[i] = local_genotype_diff [i];
}
// Updating number of stepest-descent iterations
......@@ -267,14 +261,14 @@ gradient_minimizer(
// Storing the norm of all gradients
gradient_norm(local_gradient, dockpars_num_of_genes, dotProduct, &local_gNorm);
barrier(CLK_LOCAL_MEM_FENCE);
/*
// Storing all gene-based perturbations
for(uint i = get_local_id(0);
i < dockpars_num_of_genes;
i+= NUM_OF_THREADS_PER_BLOCK) {
local_perturbation[i] = local_genotype_diff [i];
}
*/
/*
if (get_local_id(0) == 0) {
......@@ -287,7 +281,20 @@ gradient_minimizer(
printf("Number of gradient iterations: %u\n", local_nIter);
}
*/
}
is_gradDescent_enabled(
is_perturb_gt_gene_min,
&local_gNorm,
gradMin_tol,
&local_nIter,
gradMin_maxiter,
local_perturbation,
gradMin_conformation_min_perturbation,
dockpars_num_of_genes,
&is_gradDescentEn
);
} while (is_gradDescentEn == true);
// -----------------------------------------------------------------------------
// Calculating energy
......
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