Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyopencl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timothy Smith
pyopencl
Commits
5d2d1ac8
Commit
5d2d1ac8
authored
13 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Revert clrandom to using None for workgroup size.
parent
d7b2da05
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyopencl/clrandom.py
+11
-6
11 additions, 6 deletions
pyopencl/clrandom.py
with
11 additions
and
6 deletions
pyopencl/clrandom.py
+
11
−
6
View file @
5d2d1ac8
...
...
@@ -32,15 +32,19 @@ class RanluxGenerator(object):
self
.
max_work_items
=
max_work_items
src
=
"""
%s
%
(defines)
s
#include <pyopencl-ranluxcl.cl>
kernel void init_ranlux(unsigned seeds, global ranluxcl_state_t *ranluxcltab)
{
ranluxcl_initialization(seeds, ranluxcltab);
if (get_global_id(0) < %(num_work_items)d)
ranluxcl_initialization(seeds, ranluxcltab);
}
"""
%
self
.
generate_settings_defines
()
"""
%
{
"
defines
"
:
self
.
generate_settings_defines
(),
"
num_work_items
"
:
num_work_items
}
prg
=
cl
.
Program
(
queue
.
context
,
src
).
build
()
# {{{ compute work group size
...
...
@@ -67,7 +71,7 @@ class RanluxGenerator(object):
self
.
state
=
cl_array
.
empty
(
queue
,
(
num_work_items
,
112
),
dtype
=
np
.
uint8
)
self
.
state
.
fill
(
17
)
prg
.
init_ranlux
(
queue
,
(
num_work_items
,),
(
self
.
wg_size
,)
,
np
.
uint32
(
seed
),
prg
.
init_ranlux
(
queue
,
(
num_work_items
,),
None
,
np
.
uint32
(
seed
),
self
.
state
.
data
)
def
generate_settings_defines
(
self
,
include_double_pragma
=
True
):
...
...
@@ -132,6 +136,7 @@ class RanluxGenerator(object):
output_t scale,
output_t shift)
{
ranluxcl_state_t ranluxclstate;
ranluxcl_download_seed(&ranluxclstate, ranluxcltab);
...
...
@@ -175,7 +180,7 @@ class RanluxGenerator(object):
queue
=
ary
.
queue
self
.
get_gen_kernel
(
ary
.
dtype
,
""
)(
queue
,
(
self
.
num_work_items
,),
(
self
.
wg_size
,)
,
(
self
.
num_work_items
,),
None
,
self
.
state
.
data
,
ary
.
data
,
ary
.
size
,
b
-
a
,
a
)
...
...
@@ -193,7 +198,7 @@ class RanluxGenerator(object):
queue
=
ary
.
queue
self
.
get_gen_kernel
(
ary
.
dtype
,
"
norm
"
)(
queue
,
(
self
.
num_work_items
,),
(
self
.
wg_size
,)
,
(
self
.
num_work_items
,),
None
,
self
.
state
.
data
,
ary
.
data
,
ary
.
size
,
sigma
,
mu
)
def
normal
(
self
,
*
args
,
**
kwargs
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment