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
6b052b35
Commit
6b052b35
authored
Apr 11, 2018
by
Leonardo Solis
Browse files
improved readability of gradient-norm calc
parent
478124ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
device/auxiliary_gradient.cl
View file @
6b052b35
...
...
@@ -66,10 +66,12 @@ bool is_gradDescent_enabled(
return
*is_gradDescentEn
;
}
float
inner_product
(
__local
float*
vector1,
__local
float*
vector2,
uint
inputSize,
__local
float*
init
)
{
void
gradient_norm
(
__local
float*
vector1,
uint
inputSize,
__local
float*
init,
__local
float*
inner_product
)
{
float
temp
=
0.0f
;
...
...
@@ -77,10 +79,11 @@ float inner_product(__local float* vector1,
for
(
uint
i
=
get_local_id
(
0
)
;
i
<
inputSize
;
i+=
NUM_OF_THREADS_PER_BLOCK
)
{
init[i]
=
vector1[i]
*
vector
2
[i]
;
init[i]
=
vector1[i]
*
vector
1
[i]
;
}
//
Accumulating
dot
product
//
Accumulating
dot
product,
//
and
then
getting
the
norm
if
(
get_local_id
(
0
)
==
0
)
{
for
(
uint
i
=
0
;
i
<
inputSize
;
...
...
@@ -88,11 +91,7 @@ float inner_product(__local float* vector1,
temp
+=
init[i]
;
}
in
it
[0]
=
temp
;
*
in
ner_product
=
native_sqrt
(
temp
)
;
}
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
return
init[0]
;
}
device/kernel_gradient.cl
View file @
6b052b35
...
...
@@ -168,7 +168,6 @@ gradient_minimizer(
__local
float
gradient_intra_z[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_per_intracontributor[MAX_INTRAE_CONTRIBUTORS]
;
//
-------------------------------------------------------------------
//
Variables
to
store
partial
energies
...
...
@@ -266,11 +265,7 @@ gradient_minimizer(
}
//
Storing
the
norm
of
all
gradients
local_gNorm
=
inner_product
(
local_gradient,
local_gradient,
dockpars_num_of_genes,
dotProduct
)
;
if
(
get_local_id
(
0
)
==
0
)
{
local_gNorm
=
native_sqrt
(
local_gNorm
)
;
}
gradient_norm
(
local_gradient,
dockpars_num_of_genes,
dotProduct,
&local_gNorm
)
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
...
...
@@ -353,10 +348,12 @@ gradient_minimizer(
async_work_group_copy
(
dockpars_conformations_next+
(
run_id*dockpars_pop_size+entity_id
)
*GENOTYPE_LENGTH_IN_GLOBMEM,
local_genotype,
dockpars_num_of_genes,0
)
;
dockpars_num_of_genes,
0
)
;
//
FIXME:
maybe
not
used
outside?
//
Copying
final
"local"
results
into
"global"
memory
/*
local_nIter
=
local_nIter
-
1
;
*/
}
Write
Preview
Supports
Markdown
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