Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
ocladock
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
docking
ocladock
Commits
b2436392
Commit
b2436392
authored
Oct 11, 2018
by
Leonardo Solis
5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue #35: merged E+G + updated fire & adadelta kernels
parent
2ae385a1
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1774 additions
and
42 deletions
+1774
-42
device/calcMergedEneGra.cl
device/calcMergedEneGra.cl
+1549
-0
device/calcenergy.cl
device/calcenergy.cl
+8
-0
device/kernel_ad.cl
device/kernel_ad.cl
+81
-3
device/kernel_fire.cl
device/kernel_fire.cl
+82
-4
stringify_ocl_krnls.sh
stringify_ocl_krnls.sh
+54
-35
No files found.
device/calc
EG
.cl
→
device/calc
MergedEneGra
.cl
View file @
b2436392
This diff is collapsed.
Click to expand it.
device/calcenergy.cl
View file @
b2436392
...
...
@@ -23,7 +23,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//#define
DEBUG_ENERGY_KERNEL
//
No
needed
to
be
included
as
all
kernel
sources
are
stringified
#
if
0
#
include
"calcenergy_basic.h"
#
endif
typedef
struct
{
...
...
@@ -689,6 +692,8 @@ if (get_local_id (0) == 0) {
}
//
No
needed
to
be
included
as
all
kernel
sources
are
stringified
#
if
0
#
include
"kernel1.cl"
#
include
"kernel2.cl"
#
include
"auxiliary_genetic.cl"
...
...
@@ -698,3 +703,6 @@ if (get_local_id (0) == 0) {
#
include
"kernel_sd.cl"
#
include
"kernel_fire.cl"
#
include
"kernel_ad.cl"
#
include
"calcEnerGrad.cl"
#
endif
device/kernel_ad.cl
View file @
b2436392
...
...
@@ -312,6 +312,12 @@ gradient_minAD(
}
#endif
// Replacing separate gradient and energy
// calculations with a single & unified
// gpu_calc_energrad() function
// IMPORTANT: be careful with input/output (RE) assignment
// of genotypes, energy, and gradients
#if 0
// =============================================================
// Calculating gradient
barrier(CLK_LOCAL_MEM_FENCE);
...
...
@@ -437,20 +443,92 @@ gradient_minAD(
calc_coords_y,
calc_coords_z,
partial_energies,
#if defined (DEBUG_ENERGY_KERNEL)
#if defined (DEBUG_ENERGY_KERNEL)
partial_interE,
partial_intraE,
#endif
#if 0
#endif
#if 0
true,
#endif
kerconst_interintra,
kerconst_intracontrib,
kerconst_intra,
kerconst_rotlist,
kerconst_conform
);
// =============================================================
#endif
// =============================================================
// =============================================================
// =============================================================
// Calculating energy & gradient
barrier(CLK_LOCAL_MEM_FENCE);
gpu_calc_energrad(
dockpars_rotbondlist_length,
dockpars_num_of_atoms,
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
// g1 = gridsize_x
dockpars_gridsize_x_times_y, // g2 = gridsize_x * gridsize_y
dockpars_gridsize_x_times_y_times_z, // g3 = gridsize_x * gridsize_y * gridsize_z
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
dockpars_grid_spacing,
dockpars_coeff_elec,
dockpars_qasp,
dockpars_coeff_desolv,
dockpars_smooth,
// Some OpenCL compilers don't allow declaring
// local variables within non-kernel functions.
// These local variables must be declared in a kernel,
// and then passed to non-kernel functions.
genotype,
&energy,
&run_id,
calc_coords_x,
calc_coords_y,
calc_coords_z,
partial_energies,
#if defined (DEBUG_ENERGY_KERNEL)
partial_interE,
partial_intraE,
#endif
kerconst_interintra,
kerconst_intracontrib,
kerconst_intra,
kerconst_rotlist,
kerconst_conform
,
rotbonds_const,
rotbonds_atoms_const,
num_rotating_atoms_per_rotbond_const
,
angle_const,
dependence_on_theta_const,
dependence_on_rotangle_const
// Gradient-related arguments
// Calculate gradients (forces) for intermolecular energy
// Derived from autodockdev/maps.py
,
dockpars_num_of_genes,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z,
gradient_intra_x,
gradient_intra_y,
gradient_intra_z,
gradient
);
// =============================================================
// =============================================================
// =============================================================
#if defined (DEBUG_ENERGY_ADADELTA)
if (/*(get_group_id(0) == 0) &&*/ (get_local_id(0) == 0)) {
...
...
device/kernel_fire.cl
View file @
b2436392
...
...
@@ -440,11 +440,17 @@ gradient_minFire(
candidate_genotype [gene_counter] = genotype [gene_counter] + dt * velocity [gene_counter];
}
// Replacing separate gradient and energy
// calculations with a single & unified
// gpu_calc_energrad() function
// IMPORTANT: be careful with input/output (RE) assignment
// of genotypes, energy, and gradients
#if 0
// =============================================================
// Calculating (candidate) gradient
// from "candidate_genotype"
barrier(CLK_LOCAL_MEM_FENCE);
// =============================================================
gpu_calc_gradient(
dockpars_rotbondlist_length,
dockpars_num_of_atoms,
...
...
@@ -536,20 +542,92 @@ gradient_minFire(
calc_coords_y,
calc_coords_z,
partial_energies,
#if defined (DEBUG_ENERGY_KERNEL)
#if defined (DEBUG_ENERGY_KERNEL)
partial_interE,
partial_intraE,
#endif
#if 0
#endif
#if 0
true,
#endif
kerconst_interintra,
kerconst_intracontrib,
kerconst_intra,
kerconst_rotlist,
kerconst_conform
);
// =============================================================
#endif
// =============================================================
// =============================================================
// =============================================================
// Calculating energy & gradient
barrier(CLK_LOCAL_MEM_FENCE);
gpu_calc_energrad(
dockpars_rotbondlist_length,
dockpars_num_of_atoms,
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
// g1 = gridsize_x
dockpars_gridsize_x_times_y, // g2 = gridsize_x * gridsize_y
dockpars_gridsize_x_times_y_times_z, // g3 = gridsize_x * gridsize_y * gridsize_z
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
dockpars_grid_spacing,
dockpars_coeff_elec,
dockpars_qasp,
dockpars_coeff_desolv,
dockpars_smooth,
// Some OpenCL compilers don't allow declaring
// local variables within non-kernel functions.
// These local variables must be declared in a kernel,
// and then passed to non-kernel functions.
candidate_genotype,
&candidate_energy,
&run_id,
calc_coords_x,
calc_coords_y,
calc_coords_z,
partial_energies,
#if defined (DEBUG_ENERGY_KERNEL)
partial_interE,
partial_intraE,
#endif
kerconst_interintra,
kerconst_intracontrib,
kerconst_intra,
kerconst_rotlist,
kerconst_conform
,
rotbonds_const,
rotbonds_atoms_const,
num_rotating_atoms_per_rotbond_const
,
angle_const,
dependence_on_theta_const,
dependence_on_rotangle_const
// Gradient-related arguments
// Calculate gradients (forces) for intermolecular energy
// Derived from autodockdev/maps.py
,
dockpars_num_of_genes,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z,
gradient_intra_x,
gradient_intra_y,
gradient_intra_z,
candidate_gradient
);
// =============================================================
// =============================================================
// =============================================================
// Calculating power
// power is force * velocity.
...
...
stringify_ocl_krnls.sh
View file @
b2436392
...
...
@@ -6,35 +6,53 @@ IN_HEADER1=$HEADER_DIR/"defines.h"
IN_HEADER2
=
$HEADER_DIR
/
"calcenergy_basic.h"
echo
" "
echo
"Stringified input header
-
files: "
echo
"Stringified input header
files: "
echo
$IN_HEADER1
echo
$IN_HEADER2
#
kernel files
#
device source-code folder
KERNEL_DIR
=
"./device"
IN_KERNELm
=
$KERNEL_DIR
/
"calcenergy.cl"
IN_KERNEL1
=
$KERNEL_DIR
/
"kernel1.cl"
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
/
"calcgradient.cl"
IN_KERNEL5
=
$KERNEL_DIR
/
"kernel_sd.cl"
IN_KERNEL6
=
$KERNEL_DIR
/
"kernel_fire.cl"
IN_KERNEL7
=
$KERNEL_DIR
/
"kernel_ad.cl"
# non-kernel function files
## AUXI: auxiliary
## ENER: energy
## GRAD: gradient
## ENEGRA: merged energy & gradient
IN_FUNCTION_AUXI
=
$KERNEL_DIR
/
"auxiliary_genetic.cl"
IN_FUNCTION_ENER
=
$KERNEL_DIR
/
"calcenergy.cl"
IN_FUNCTION_GRAD
=
$KERNEL_DIR
/
"calcgradient.cl"
IN_FUNCTION_MERGED_EG
=
$KERNEL_DIR
/
"calcMergedEneGra.cl"
# kernel files
## INIT: energy calculation of initial population
## EVAL: evaluation count
## GS_ORIG_GA: Global Search Original Genetic Algorithm
## LS_ORIG_SW: Local Search Original Solis-Wets
## LS_GRAD_{SD | FI | AD}: Local Search Gradient-based {Steepest-Descent | Fire | Ada-Delta}
IN_KERNEL_INIT
=
$KERNEL_DIR
/
"kernel1.cl"
IN_KERNEL_EVAL
=
$KERNEL_DIR
/
"kernel2.cl"
IN_KERNEL_GS_ORIG_GA
=
$KERNEL_DIR
/
"kernel4.cl"
IN_KERNEL_LS_ORIG_SW
=
$KERNEL_DIR
/
"kernel3.cl"
IN_KERNEL_LS_GRAD_SD
=
$KERNEL_DIR
/
"kernel_sd.cl"
IN_KERNEL_LS_GRAD_FI
=
$KERNEL_DIR
/
"kernel_fire.cl"
IN_KERNEL_LS_GRAD_AD
=
$KERNEL_DIR
/
"kernel_ad.cl"
echo
" "
echo
"Stringified input non-kernel files: "
echo
$IN_FUNCTION_AUXI
echo
$IN_FUNCTION_ENER
echo
$IN_FUNCTION_GRAD
echo
$IN_FUNCTION_MERGED_EG
echo
" "
echo
"Stringified input kernel-files: "
echo
$IN_KERNELm
echo
$IN_KERNEL1
echo
$IN_KERNEL2
echo
$IN_KERNELa
echo
$IN_KERNEL3
echo
$IN_KERNEL4
echo
$IN_KERNELb
echo
$IN_KERNEL5
echo
$IN_KERNEL6
echo
$IN_KERNEL7
echo
$IN_KERNEL_INIT
echo
$IN_KERNEL_EVAL
echo
$IN_KERNEL_GS_ORIG_GA
echo
$IN_KERNEL_LS_ORIG_SW
echo
$IN_KERNEL_LS_GRAD_SD
echo
$IN_KERNEL_LS_GRAD_FI
echo
$IN_KERNEL_LS_GRAD_AD
# output file
OUT
=
host/inc/stringify.h
...
...
@@ -47,23 +65,24 @@ echo " "
# temporal file
TMP
=
$KERNEL_DIR
/stringify_tmp
echo
"// OCLAD
OCK: AUTOMATICALLY GENERATED FILE, DO NOT EDIT
"
>
$TMP
echo
"// OCLAD
ock: AUTOMATICALLY GENERATED FILE, DO NOT EDIT.
"
>
$TMP
echo
"#ifndef STRINGIFY_H"
>>
$TMP
echo
"#define STRINGIFY_H"
>>
$TMP
echo
"const char *calcenergy_ocl ="
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_HEADER1
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_HEADER2
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNELm
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNEL1
>>
$TMP
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
sed
's/\\/\\\\/g;s/"/\\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$TMP
...
...
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