Skip to content
GitLab
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
a9ca2fd8
Commit
a9ca2fd8
authored
Apr 06, 2018
by
Leonardo Solis
Browse files
added kernel_gradients in the ocl string
parent
071eec04
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
a9ca2fd8
...
...
@@ -50,7 +50,8 @@ K1_NAME="gpu_calc_initpop"
K2_NAME
=
"gpu_sum_evals"
K3_NAME
=
"perform_LS"
K4_NAME
=
"gpu_gen_and_eval_newpops"
K_NAMES
=
-DK1
=
$(K1_NAME)
-DK2
=
$(K2_NAME)
-DK3
=
$(K3_NAME)
-DK4
=
$(K4_NAME)
K5_NAME
=
"gradient_minimizer"
K_NAMES
=
-DK1
=
$(K1_NAME)
-DK2
=
$(K2_NAME)
-DK3
=
$(K3_NAME)
-DK4
=
$(K4_NAME)
-DK5
=
$(K5_NAME)
# Kernel flags
KFLAGS
=
-DKRNL_SOURCE
=
$(KRNL_DIR)
/
$(KRNL_MAIN)
-DKRNL_DIRECTORY
=
$(KRNL_DIR)
-DKCMN_DIRECTORY
=
$(KCMN_DIR)
$(K_NAMES)
...
...
device/auxiliary_gradient.cl
View file @
a9ca2fd8
...
...
@@ -6,19 +6,20 @@ bool is_gradDescent_enabled(__local float* a_gNorm,
unsigned
int
gradMin_maxiter,
__local
float*
a_perturbation,
__constant
float*
gradMin_conformation_min_perturbation,
__local
bool*
is_gradDescentEn
)
__local
bool*
is_gradDescentEn,
uint
gradMin_numElements
)
{
bool
is_gNorm_gt_gMin
=
(
a_gNorm
>=
gradMin_tol
)
;
bool
is_nIter_lt_maxIter
=
(
a_n
i
ter
<=
gradMin_maxiter
)
;
bool
is_gNorm_gt_gMin
=
(
a_gNorm
[0]
>=
gradMin_tol
)
;
bool
is_nIter_lt_maxIter
=
(
a_n
I
ter
[0]
<=
gradMin_maxiter
)
;
bool
is_perturb_gt_gene_min
[ACTUAL_GENOTYPE_LENGTH]
;
bool
is
perturb_gt_genotype
=
true
;
bool
is
_
perturb_gt_genotype
=
true
;
//
For
every
gene,
let
's
determine
//
if
perturbation
is
greater
than
min
conformation
for
(
u
nsigned
int
i=get_local_id
(
0
)
;
i<
dockpars_num_of_gene
s
;
i+=NUM_OF_THREADS_PER_BLOCK
)
{
for
(
uint
i=get_local_id
(
0
)
;
i<
gradMin_numElement
s
;
i+=NUM_OF_THREADS_PER_BLOCK
)
{
is_perturb_gt_gene_min[i]
=
(
a_perturbation[i]
>=
gradMin_conformation_min_perturbation[i]
)
;
}
...
...
@@ -26,9 +27,9 @@ bool is_gradDescent_enabled(__local float* a_gNorm,
//
Reduce
all
is_perturb_gt_gene_min
's
//
into
their
corresponding
genotype
for
(
u
nsigned
int
i=get_local_id
(
0
)
;
i<
dockpars_num_of_gene
s
;
i+=NUM_OF_THREADS_PER_BLOCK
)
{
for
(
uint
i=get_local_id
(
0
)
;
i<
gradMin_numElement
s
;
i+=NUM_OF_THREADS_PER_BLOCK
)
{
is_perturb_gt_genotype
=
is_perturb_gt_genotype
&&
is_perturb_gt_gene_min[i]
;
}
...
...
@@ -114,7 +115,9 @@ void stepGPU (// Args for minimization
__local
bool*
is_enabled_gradient_calc,
__local
float*
gradient_inter_x,
__local
float*
gradient_inter_y,
__local
float*
gradient_inter_z
__local
float*
gradient_inter_z,
__local
float*
gradient_genotype
)
{
//
Calculate
gradient
...
...
@@ -133,8 +136,8 @@ void stepGPU (// Args for minimization
dockpars_qasp,
dockpars_coeff_desolv,
genotype,
&
energy,
&
run_id,
energy,
run_id,
//
Some
OpenCL
compilers
don
't
allow
declaring
//
local
variables
within
non-kernel
functions.
//
These
local
variables
must
be
declared
in
a
kernel,
...
...
@@ -166,10 +169,12 @@ void stepGPU (// Args for minimization
//
Derived
from
autodockdev/maps.py
//
-------------------------------------------------------------------
,
&
is_enabled_gradient_calc,
is_enabled_gradient_calc,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z
gradient_inter_z,
gradient_genotype
)
;
//
-------------------------------------------------------------------
//
=============================================================
...
...
device/calcenergy.cl
View file @
a9ca2fd8
...
...
@@ -896,6 +896,19 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
}
}
// -------------------------------------------------------------------
// Calculate gradients (forces) corresponding to (interE + intraE)
// Derived from autodockdev/motions.py/forces_to_delta()
...
...
@@ -1104,3 +1117,5 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
#
include
"auxiliary_genetic.cl"
#
include
"kernel4.cl"
#
include
"kernel3.cl"
#
include
"auxiliary_gradient.cl"
#
include
"kernel_gradient.cl"
device/kernel_gradient.cl
View file @
a9ca2fd8
...
...
@@ -33,12 +33,12 @@ gradient_minimizer( char dockpars_num_of_atoms,
__global
float*
restrict
dockpars_conformations_next,
__global
float*
restrict
dockpars_energies_next,
//__global
int*
restrict
dockpars_evals_of_new_entities,
//
__global
unsigned
int*
restrict
dockpars_prng_states,
__global
unsigned
int*
restrict
dockpars_prng_states,
#
else
__global
float*
dockpars_conformations_next,
__global
float*
dockpars_energies_next,
//__global
int*
dockpars_evals_of_new_entities,
//
__global
unsigned
int*
dockpars_prng_states,
__global
unsigned
int*
dockpars_prng_states,
#
endif
int
dockpars_pop_size,
...
...
@@ -50,7 +50,7 @@ gradient_minimizer( char dockpars_num_of_atoms,
//float
dockpars_base_dang_mul_sqrt3,
//unsigned
int
dockpars_cons_limit,
//unsigned
int
dockpars_max_num_of_iters,
//
float
dockpars_qasp,
float
dockpars_qasp,
__constant
float*
atom_charges_const,
__constant
char*
atom_types_const,
...
...
@@ -74,7 +74,7 @@ gradient_minimizer( char dockpars_num_of_atoms,
unsigned
int
gradMin_maxiter,
float
gradMin_alpha,
float
gradMin_h,
__constant
float*
gradMin_conformation_min_perturbation
,
//
minimal
values
for
gene
perturbation,
originally
as
the
scalar
"dxmin"
__constant
float*
gradMin_conformation_min_perturbation
//
minimal
values
for
gene
perturbation,
originally
as
the
scalar
"dxmin"
//unsigned
int
gradMin_M,
//
dimensionality
of
the
input
data
(
=num_of_genes
)
//
__global
float*
restrict
dockpars_conformations_next,
//
optimized
genotype
are
to
be
store
back
here,
originally
as
"d_xopt"
//
__global
float*
restrict
dockpars_energies_next,
//
minimized
energy,
originally
as
"fopt"
...
...
@@ -106,7 +106,7 @@ gradient_minimizer( char dockpars_num_of_atoms,
//
Since
entity-ID=0
is
the
best
one
due
to
elitism,
it
should
be
subjected
to
random
selection
if
(
entity_id
==
0
)
if
(
100.0f*gpu_randf
(
dockpar_prng_states
)
>
dockpars_lsearch_rate
)
if
(
100.0f*gpu_randf
(
dockpar
s
_prng_states
)
>
dockpars_lsearch_rate
)
entity_id
=
dockpars_num_of_lsentities
; // If entity-ID=0 is not selected according to LS-rate,
//
then
choose
another
entity
...
...
@@ -188,11 +188,12 @@ gradient_minimizer( char dockpars_num_of_atoms,
//
Perform
gradient-descent
iterations
while
(
is_gradDescent_enabled
(
&local_gNorm,
gradMin_tol,
&local_
i
ter,
&local_
nI
ter,
gradMin_maxiter,
local_perturbation,
gradMin_conformation_min_perturbation,
&is_gradDescentEn
)
==
true
)
{
&is_gradDescentEn,
dockpars_num_of_genes
)
==
true
)
{
stepGPU
(
//
Args
for
minimization
local_genotype,
...
...
host/inc/stringify.h
View file @
a9ca2fd8
This diff is collapsed.
Click to expand it.
host/src/performdocking.cpp
View file @
a9ca2fd8
...
...
@@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define KRNL2 STRINGIZE(K2)
#define KRNL3 STRINGIZE(K3)
#define KRNL4 STRINGIZE(K4)
#define KRNL5 STRINGIZE(K5)
#else
#define KRNL_FILE KRNL_SOURCE
...
...
@@ -41,6 +42,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define KRNL2 K2
#define KRNL3 K3
#define KRNL4 K4
#define KRNL5 K5
#endif
#define INC " -I " KRNL_FOLDER " -I " KRNL_COMMON
...
...
stringify_ocl_krnls.sh
View file @
a9ca2fd8
...
...
@@ -18,6 +18,8 @@ IN_KERNEL2=$KERNEL_DIR/"kernel2.cl"
IN_KERNELa
=
$KERNEL_DIR
/
"auxiliary_genetic.cl"
IN_KERNEL3
=
$KERNEL_DIR
/
"kernel3.cl"
IN_KERNEL4
=
$KERNEL_DIR
/
"kernel4.cl"
IN_KERNELb
=
$KERNEL_DIR
/
"auxiliary_gradient.cl"
IN_KERNEL5
=
$KERNEL_DIR
/
"kernel_gradient.cl"
echo
" "
echo
"Stringified input kernel-files: "
...
...
@@ -27,6 +29,8 @@ echo $IN_KERNEL2
echo
$IN_KERNELa
echo
$IN_KERNEL3
echo
$IN_KERNEL4
echo
$IN_KERNELb
echo
$IN_KERNEL5
# output file
OUT
=
host/inc/stringify.h
...
...
@@ -52,6 +56,8 @@ sed 's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/' $IN_KERNEL2 >> $TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNELa
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNEL3
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNEL4
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNELb
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNEL5
>>
$TMP
echo
";"
>>
$TMP
echo
"#endif // End of STRINGIFY_H"
>>
$TMP
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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