Commit afd2722e authored by lvs's avatar lvs
Browse files

scaled tour,cross,mut rates in host

parent 284b564b
......@@ -143,15 +143,17 @@ gpu_gen_and_eval_newpops(
if (get_local_id(0) < 2)
{
// Notice: dockpars_tournament_rate was scaled down to [0,1] in host
// to reduce number of operations in device
if (candidate_energies[2*get_local_id(0)] < candidate_energies[2*get_local_id(0)+1])
if (100.0f*randnums[4+get_local_id(0)] < dockpars_tournament_rate) { //using randnum[4..5]
if (/*100.0f**/randnums[4+get_local_id(0)] < dockpars_tournament_rate) { //using randnum[4..5]
parents[get_local_id(0)] = parent_candidates[2*get_local_id(0)];
}
else {
parents[get_local_id(0)] = parent_candidates[2*get_local_id(0)+1];
}
else
if (100.0f*randnums[4+get_local_id(0)] < dockpars_tournament_rate) {
if (/*100.0f**/randnums[4+get_local_id(0)] < dockpars_tournament_rate) {
parents[get_local_id(0)] = parent_candidates[2*get_local_id(0)+1];
}
else {
......@@ -162,7 +164,9 @@ gpu_gen_and_eval_newpops(
// Performing crossover
barrier(CLK_LOCAL_MEM_FENCE);
if (100.0f*randnums[6] < dockpars_crossover_rate) // Using randnums[6]
// Notice: dockpars_crossover_rate was scaled down to [0,1] in host
// to reduce number of operations in device
if (/*100.0f**/randnums[6] < dockpars_crossover_rate) // Using randnums[6]
{
if (get_local_id(0) < 2) {
// Using randnum[7..8]
......@@ -219,7 +223,9 @@ gpu_gen_and_eval_newpops(
gene_counter < dockpars_num_of_genes;
gene_counter+= NUM_OF_THREADS_PER_BLOCK)
{
if (100.0f*gpu_randf(dockpars_prng_states) < dockpars_mutation_rate)
// Notice: dockpars_mutation_rate was scaled down to [0,1] in host
// to reduce number of operations in device
if (/*100.0f**/gpu_randf(dockpars_prng_states) < dockpars_mutation_rate)
{
// Translation genes
if (gene_counter <= 2) {
......
......@@ -394,9 +394,11 @@ filled with clock() */
dockpars.coeff_desolv = ((float) mypars->coeffs.AD4_coeff_desolv);
dockpars.pop_size = mypars->pop_size;
dockpars.num_of_genes = myligand_reference.num_of_rotbonds + 6;
dockpars.tournament_rate = mypars->tournament_rate;
dockpars.crossover_rate = mypars->crossover_rate;
dockpars.mutation_rate = mypars->mutation_rate;
// Notice: dockpars.tournament_rate, dockpars.crossover_rate, dockpars.mutation_rate
// were scaled down to [0,1] in host to reduce number of operations in device
dockpars.tournament_rate = mypars->tournament_rate/100.0f;
dockpars.crossover_rate = mypars->crossover_rate/100.0f;
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.lsearch_rate = mypars->lsearch_rate;
......
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