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

reordered in gradient_minimizer

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