Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
docking
ocladock
Commits
9b20069a
Commit
9b20069a
authored
May 18, 2018
by
lvs
Browse files
removed comments
parent
beecc552
Changes
4
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
9b20069a
...
...
@@ -205,11 +205,11 @@ PDB := 3ce3
NRUN
:=
100
POPSIZE
:=
150
TESTNAME
:=
test
TESTLS
:=
s
w
TESTLS
:=
s
d
NUM_LSIT
:=
300
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)
-lsit
$(NUM_LSIT)
-smooth
0.
5
$(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)
-smooth
0.
0
ASTEX_PDB
:=
2bsm
ASTEX_NRUN
:=
10
...
...
device/calcenergy.cl
View file @
9b20069a
...
...
@@ -96,8 +96,8 @@ void gpu_calc_energy(
#endif
uchar g1 = dockpars_gridsize_x;
uint g2 = dockpars_gridsize_x_times_y
/*dockpars_gridsize_x * dockpars_gridsize_y*/
;
uint g3 = dockpars_gridsize_x_times_y_times_z
/*dockpars_gridsize_x * dockpars_gridsize_y * dockpars_gridsize_z*/
;
uint g2 = dockpars_gridsize_x_times_y;
uint g3 = dockpars_gridsize_x_times_y_times_z;
// ================================================
// CALCULATING ATOMIC POSITIONS AFTER ROTATIONS
...
...
@@ -172,14 +172,7 @@ 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];
...
...
@@ -578,6 +571,5 @@ void gpu_calc_energy(
#
include
"auxiliary_genetic.cl"
#
include
"kernel4.cl"
#
include
"kernel3.cl"
//#include
"auxiliary_gradient.cl"
#
include
"calcgradient.cl"
#
include
"kernel_gradient.cl"
device/calcgradient.cl
View file @
9b20069a
...
...
@@ -34,13 +34,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
whose
population
includes
the
current
entity
(
which
can
be
determined
with
get_group_id
(
0
))
,
//
since
this
determines
which
reference
orientation
should
be
used.
//#define
DEBUG_GRAD_TRANSLATION_GENES
//#define
DEBUG_GRAD_ROTATION_GENES
//#define
DEBUG_GRAD_TORSION_GENES
//#define
DEBUG_ENERGY_KERNEL5
//
Atomic
operations
used
in
gradients
of
intra
contributors.
//
Only
atomic_cmpxchg
()
works
on
floats.
//
So
for
atomic
add
on
floats,
this
link
was
used:
...
...
@@ -142,11 +140,6 @@ void gpu_calc_gradient(
__local
float*
gradient_intra_x,
__local
float*
gradient_intra_y,
__local
float*
gradient_intra_z,
/*
__local
float*
gradient_x,
__local
float*
gradient_y,
__local
float*
gradient_z,
*/
__local
float*
gradient_genotype
)
{
...
...
@@ -174,8 +167,8 @@ void gpu_calc_gradient(
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
uchar
g1
=
dockpars_gridsize_x
;
uint
g2
=
dockpars_gridsize_x_times_y
/*dockpars_gridsize_x
*
dockpars_gridsize_y*/
;
uint
g3
=
dockpars_gridsize_x_times_y_times_z
/*dockpars_gridsize_x
*
dockpars_gridsize_y
*
dockpars_gridsize_z*/
;
uint
g2
=
dockpars_gridsize_x_times_y
;
uint
g3
=
dockpars_gridsize_x_times_y_times_z
;
//
================================================
//
CALCULATING
ATOMIC
POSITIONS
AFTER
ROTATIONS
...
...
@@ -250,15 +243,7 @@ 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]
;
...
...
@@ -727,10 +712,10 @@ void gpu_calc_gradient(
}
//
End
contributor_counter
for-loop
(
INTRAMOLECULAR
ENERGY
)
//----------------------------------
//
eliminat
e
unnecessary
local
storage
//
----------------------------------
/*
//
Commented
to
remov
e
unnecessary
local
storage
which
was
//
required
by
gradient_per_intracontributor[MAX_INTRAE_CONTRIBUTORS]
/*
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
//
Accumulating
gradients
from
"gradient_per_intracontributor"
for
each
each
...
...
@@ -768,7 +753,7 @@ void gpu_calc_gradient(
//printf
(
"%-20s %-10u %-5u %-5u %-10.8f\n"
,
"grad_intracontrib"
,
contributor_counter,
atom1_id,
atom2_id,
gradient_per_intracontributor[contributor_counter]
)
;
}
}
*/
*/
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
...
...
@@ -786,22 +771,14 @@ void gpu_calc_gradient(
gradient_inter_y[atom_cnt]
=
native_divide
(
gradient_inter_y[atom_cnt],
dockpars_grid_spacing
)
;
gradient_inter_z[atom_cnt]
=
native_divide
(
gradient_inter_z[atom_cnt],
dockpars_grid_spacing
)
;
/*
gradient_x[atom_cnt]
=
gradient_inter_x[atom_cnt]
+
gradient_intra_x[atom_cnt]
;
gradient_y[atom_cnt]
=
gradient_inter_y[atom_cnt]
+
gradient_intra_y[atom_cnt]
;
gradient_z[atom_cnt]
=
gradient_inter_z[atom_cnt]
+
gradient_intra_z[atom_cnt]
;
*/
//
Re-using
"gradient_inter_*"
for
total
gradient
(
inter+intra
)
gradient_inter_x[atom_cnt]
+=
gradient_intra_x[atom_cnt]
;
gradient_inter_y[atom_cnt]
+=
gradient_intra_y[atom_cnt]
;
gradient_inter_z[atom_cnt]
+=
gradient_intra_z[atom_cnt]
;
//printf
(
"%-15s %-5u %-10.8f %-10.8f %-10.8f\n"
,
"grad_grid"
,
atom_cnt,
gradient_inter_x[atom_cnt],
gradient_inter_y[atom_cnt],
gradient_inter_z[atom_cnt]
)
;
//printf
(
"%-15s %-5u %-10.8f %-10.8f %-10.8f\n"
,
"grad_intra"
,
atom_cnt,
gradient_intra_x[atom_cnt],
gradient_intra_y[atom_cnt],
gradient_intra_z[atom_cnt]
)
;
//printf
(
"%-15s %-5u %-10.8f %-10.8f %-10.8f\n"
,
"calc_coords"
,
atom_cnt,
calc_coords_x[atom_cnt],
calc_coords_y[atom_cnt],
calc_coords_z[atom_cnt]
)
;
}
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
...
...
@@ -813,11 +790,8 @@ void gpu_calc_gradient(
for
(
uint
lig_atom_id
=
0
;
lig_atom_id<dockpars_num_of_atoms
;
lig_atom_id++
)
{
/*
gradient_genotype[0]
+=
gradient_x[lig_atom_id]
; // gradient for gene 0: gene x
gradient_genotype[1]
+=
gradient_y[lig_atom_id]
; // gradient for gene 1: gene y
gradient_genotype[2]
+=
gradient_z[lig_atom_id]
; // gradient for gene 2: gene z
*/
//
Re-using
"gradient_inter_*"
for
total
gradient
(
inter+intra
)
gradient_genotype[0]
+=
gradient_inter_x[lig_atom_id]
; // gradient for gene 0: gene x
gradient_genotype[1]
+=
gradient_inter_y[lig_atom_id]
; // gradient for gene 1: gene y
gradient_genotype[2]
+=
gradient_inter_z[lig_atom_id]
; // gradient for gene 2: gene z
...
...
@@ -832,14 +806,9 @@ void gpu_calc_gradient(
gradient_genotype[2]
*=
dockpars_grid_spacing
;
#
if
defined
(
DEBUG_GRAD_TRANSLATION_GENES
)
/*
printf
(
"gradient_x:%f\n"
,
gradient_genotype
[0]
)
;
printf
(
"gradient_y:%f\n"
,
gradient_genotype
[1]
)
;
printf
(
"gradient_z:%f\n"
,
gradient_genotype
[2]
)
;
*/
printf
(
"gradient_inter_x:%f\n"
,
gradient_genotype
[0]
)
;
printf
(
"gradient_inter_y:%f\n"
,
gradient_genotype
[1]
)
;
printf
(
"gradient_inter_z:%f\n"
,
gradient_genotype
[2]
)
;
#
endif
}
...
...
@@ -885,12 +854,8 @@ void gpu_calc_gradient(
r.y
=
(
calc_coords_y[lig_atom_id]
-
about.y
)
*
dockpars_grid_spacing
;
r.z
=
(
calc_coords_z[lig_atom_id]
-
about.z
)
*
dockpars_grid_spacing
;
//
Re-using
"gradient_inter_*"
for
total
gradient
(
inter+intra
)
float3
force
;
/*
force.x
=
gradient_x[lig_atom_id]
;
force.y
=
gradient_y[lig_atom_id]
;
force.z
=
gradient_z[lig_atom_id]
;
*/
force.x
=
gradient_inter_x[lig_atom_id]
;
force.y
=
gradient_inter_y[lig_atom_id]
;
force.z
=
gradient_inter_z[lig_atom_id]
;
...
...
@@ -1119,12 +1084,8 @@ void gpu_calc_gradient(
r.y
=
(
atom_coords.y
-
atomRef_coords.y
)
*
dockpars_grid_spacing
;
r.z
=
(
atom_coords.z
-
atomRef_coords.z
)
*
dockpars_grid_spacing
;
//
Re-using
"gradient_inter_*"
for
total
gradient
(
inter+intra
)
float3
atom_force
;
/*
atom_force.x
=
gradient_x[lig_atom_id]
;
atom_force.y
=
gradient_y[lig_atom_id]
;
atom_force.z
=
gradient_z[lig_atom_id]
;
*/
atom_force.x
=
gradient_inter_x[lig_atom_id]
;
atom_force.y
=
gradient_inter_y[lig_atom_id]
;
atom_force.z
=
gradient_inter_z[lig_atom_id]
;
...
...
device/kernel_gradient.cl
View file @
9b20069a
...
...
@@ -48,10 +48,6 @@ gradient_minimizer(
__constant
int*
num_rotating_atoms_per_rotbond_const,
//
Specific
gradient-minimizer
args
uint
gradMin_maxiters
/*
,
uint
gradMin_maxfails
*/
)
//The
GPU
global
function
performs
gradient-based
minimization
on
(
some
)
entities
of
conformations_next.
//The
number
of
OpenCL
compute
units
(
CU
)
which
should
be
started
equals
to
num_of_minEntities*num_of_runs.
...
...
@@ -68,17 +64,8 @@ gradient_minimizer(
__local
float
energy
;
__local
float
genotype[ACTUAL_GENOTYPE_LENGTH]
;
//
Variables
for
gradient
minimizer
__local
uint
iteration_cnt
; // minimizer iteration counter
/*
__local
uint
failure_cnt
; // minimizer failure counter
__local
bool
exit
;
*/
/*
//
Number
of
energy-evaluations
counter
__local
int
evaluation_cnt
;
*/
//
Iteration
counter
fot
the
minimizer
__local
uint
iteration_cnt
;
//
Stepsize
for
the
minimizer
__local
float
stepsize
;
...
...
@@ -92,7 +79,6 @@ gradient_minimizer(
entity_id
=
0
;
*/
///*
run_id
=
get_group_id
(
0
)
/
dockpars_num_of_lsentities
;
entity_id
=
get_group_id
(
0
)
%
dockpars_num_of_lsentities
;
...
...
@@ -105,7 +91,6 @@ gradient_minimizer(
entity_id
=
dockpars_num_of_lsentities
;
}
}
//*/
energy
=
dockpars_energies_next[run_id*dockpars_pop_size+entity_id]
;
...
...
@@ -115,12 +100,6 @@ gradient_minimizer(
//
Initializing
gradient-minimizer
counters
and
flags
iteration_cnt
=
0
;
/*
failure_cnt
=
0
;
*/
/*
evaluation_cnt
=
0
;
*/
stepsize
=
STEP_START
;
}
...
...
@@ -146,6 +125,7 @@ gradient_minimizer(
//
Derived
from
autodockdev/maps.py
//
-------------------------------------------------------------------
//
Gradient
of
the
intermolecular
energy
per
each
ligand
atom
//
Also
used
to
store
the
accummulated
gradient
per
each
ligand
atom
__local
float
gradient_inter_x[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_y[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_z[MAX_NUM_OF_ATOMS]
;
...
...
@@ -155,14 +135,7 @@ gradient_minimizer(
__local
float
gradient_intra_y[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_intra_z[MAX_NUM_OF_ATOMS]
;
//
Accummulated
gradient
per
each
ligand
atom
/*
__local
float
gradient_x[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_y[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_z[MAX_NUM_OF_ATOMS]
;
*/
//
-------------------------------------------------------------------
//
Ligand-atom
position
and
partial
energies
__local
float
calc_coords_x[MAX_NUM_OF_ATOMS]
;
__local
float
calc_coords_y[MAX_NUM_OF_ATOMS]
;
...
...
@@ -173,28 +146,8 @@ gradient_minimizer(
__local
float
partial_interE[NUM_OF_THREADS_PER_BLOCK]
;
__local
float
partial_intraE[NUM_OF_THREADS_PER_BLOCK]
;
#
endif
//
-----------------------------------------------------------------------------
/*
//
Step
size
of
the
steepest
descent
float
alpha
;
*/
#
if
0
//
Initilizing
each
(
work-item
)
-specific
alpha
for
(
uint
i
=
get_local_id
(
0
)
;
i
<
dockpars_num_of_genes
;
i+=
NUM_OF_THREADS_PER_BLOCK
)
{
if
(
i<3
)
{
alpha
=
TRANGENE_ALPHA
; }
else
if
(
i<6
)
{
alpha
=
ROTAGENE_ALPHA
; }
else
{
alpha
=
TORSGENE_ALPHA
; }
#
if
defined
(
DEBUG_MINIMIZER
)
//printf
(
"(%-3u) %-15.15f\n"
,
i,
alpha
)
;
#
endif
}
#
endif
//
-----------------------------------------------------------------------------
//
Perform
gradient-descent
iterations
#
if
0
...
...
@@ -249,21 +202,13 @@ 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
;
//
Storing
torsion
genotypes
here
__local
float
torsions_genotype[ACTUAL_GENOTYPE_LENGTH]
;
//----------------------------------
//
Asynchronous
copy
should
be
finished
by
here
wait_group_events
(
1
,
&ev
)
;
...
...
@@ -318,8 +263,8 @@ gradient_minimizer(
if
(
get_local_id
(
0
)
==
0
)
{
//
Finding
maximum
of
the
absolute
value
//
for
the
three
translation
genes
max_trans_gene
=
fmax
/*max*/
(
fabs
(
genotype[0]
)
,
fabs
(
genotype[1]
))
;
max_trans_gene
=
fmax
/*max*/
(
max_trans_gene,
fabs
(
genotype[2]
))
;
max_trans_gene
=
fmax
(
fabs
(
genotype[0]
)
,
fabs
(
genotype[1]
))
;
max_trans_gene
=
fmax
(
max_trans_gene,
fabs
(
genotype[2]
))
;
//
Note
that
MAX_DEV_TRANSLATION
needs
to
be
//
expressed
in
grid
size
first
...
...
@@ -327,8 +272,8 @@ gradient_minimizer(
//
Finding
maximum
of
the
absolute
value
//
for
the
three
Shoemake
rotation
genes
max_rota_gene
=
fmax
/*max*/
(
fabs
(
genotype[3]
)
,
fabs
(
genotype[4]
))
;//printf("max_rota_gene: %-10.7f\n", max_rota_gene);
max_rota_gene
=
fmax
/*max*/
(
max_rota_gene,
fabs
(
genotype[5]
))
; //printf("max_rota_gene: %-10.7f\n", max_rota_gene);
max_rota_gene
=
fmax
(
fabs
(
genotype[3]
)
,
fabs
(
genotype[4]
))
;
//printf("max_rota_gene: %-10.7f\n", max_rota_gene);
max_rota_gene
=
fmax
(
max_rota_gene,
fabs
(
genotype[5]
))
;
//printf("max_rota_gene: %-10.7f\n", max_rota_gene);
//
Note
that
MAX_DEV_ROTATION
//
is
already
expressed
within
[0,
1]
...
...
@@ -367,11 +312,11 @@ gradient_minimizer(
if
(
get_local_id
(
0
)
==
0
)
{
//
Calculating
the
maximum
stepsize
using
previous
three
max_stepsize
=
fmin
/*min*/
(
max_trans_stepsize,
max_rota_stepsize
)
;
max_stepsize
=
fmin
/*min*/
(
max_stepsize,
max_tors_stepsize
)
;
max_stepsize
=
fmin
(
max_trans_stepsize,
max_rota_stepsize
)
;
max_stepsize
=
fmin
(
max_stepsize,
max_tors_stepsize
)
;
//
Capping
the
stepsize
stepsize
=
fmin
/*min*/
(
stepsize,
max_stepsize
)
;
stepsize
=
fmin
(
stepsize,
max_stepsize
)
;
#
if
defined
(
DEBUG_MINIMIZER
)
//printf
(
"max_genes: %-0.7f %-10.7f %-10.7f %-10.7f\n"
,
max_trans_gene,
max_rota_gene,
max_tors_gene,
stepsize
)
;
...
...
@@ -442,20 +387,10 @@ gradient_minimizer(
gradient_intra_x,
gradient_intra_y,
gradient_intra_z,
/*
gradient_x,
gradient_y,
gradient_z,
*/
gradient
)
;
//
=============================================================
/*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++) {
...
...
@@ -463,8 +398,6 @@ gradient_minimizer(
}
}
*/
//----------------------------------
for
(
uint
i
=
get_local_id
(
0
)
; i < dockpars_num_of_genes; i+= NUM_OF_THREADS_PER_BLOCK) {
...
...
@@ -476,8 +409,8 @@ gradient_minimizer(
#
endif
//
Putting
genes
back
within
bounds
candidate_genotype[i]
=
fmin
/*min*/
(
candidate_genotype[i],
upper_bounds_genotype[i]
)
;
candidate_genotype[i]
=
fmax
/*max*/
(
candidate_genotype[i],
lower_bounds_genotype[i]
)
;
candidate_genotype[i]
=
fmin
(
candidate_genotype[i],
upper_bounds_genotype[i]
)
;
candidate_genotype[i]
=
fmax
(
candidate_genotype[i],
lower_bounds_genotype[i]
)
;
}
//
Evaluating
candidate
...
...
@@ -510,7 +443,7 @@ gradient_minimizer(
calc_coords_y,
calc_coords_z,
partial_energies,
#
if
defined
(
DEBUG_ENERGY_KERNEL
1
)
#
if
defined
(
DEBUG_ENERGY_KERNEL
5
)
partial_interE,
partial_intraE,
#
endif
...
...
@@ -535,14 +468,6 @@ gradient_minimizer(
)
;
//
=============================================================
/*
//
Updating
number
of
energy-evaluations
counter
if
(
get_local_id
(
0
)
==
0
)
{
evaluation_cnt
=
evaluation_cnt
+
1
;
}
*/
/*barrier
(
CLK_LOCAL_MEM_FENCE
)
;*/
//
Checking
if
E
(
candidate_genotype
)
<
E
(
genotype
)
if
(
candidate_energy
<
energy
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment