public class Range extends RangeJNI
Range
using
To request the same linear range but with a groupSize of 64 (range must be a multiple of group size!) we would useRange.create(1024);
To request a two dimensional range over a grid (0..width)x(0..height) where width==512 and height=256 we would useRange.create(1024,64);
Again the above does not specify the group size. One will be chosen for you. If you want to specify the groupSize (say 16x8; 16 wide by 8 high) useint width=512; int height=256; Range.create2D(width,height)
Finally we can request a three dimensional range usingint width=512; int height=256; int groupWidth=16; int groupHeight=8; Range.create2D(width, height, groupWidth, groupHeight);
And can specify a group size usingint width=512; int height=256; int depth=8; Range.create3D(width, height, depth);
int width=512; int height=256; int depth=8; int groupWidth=8; int groupHeight=4; int groupDepth=2 Range.create3D(width, height, depth, groupWidth, groupHeight, groupDepth);
Modifier and Type | Field and Description |
---|---|
static int |
MAX_GROUP_SIZE |
static int |
MAX_OPENCL_GROUP_SIZE |
static int |
THREADS_PER_CORE |
Constructor and Description |
---|
Range(Device _device,
int _dims)
Minimal constructor
|
Modifier and Type | Method and Description |
---|---|
static Range |
create(Device _device,
int _globalWidth)
Create a one dimensional range
0.._globalWidth with an undefined group size. |
static Range |
create(Device _device,
int _globalWidth,
int _localWidth)
Create a one dimensional range
0.._globalWidth which is processed in groups of size _localWidth. |
static Range |
create(int _globalWidth) |
static Range |
create(int _globalWidth,
int _localWidth) |
static Range |
create2D(Device _device,
int _globalWidth,
int _globalHeight)
Create a two dimensional range
0.._globalWidth * 0.._globalHeight choosing suitable values for localWidth and localHeight . |
static Range |
create2D(Device _device,
int _globalWidth,
int _globalHeight,
int _localWidth,
int _localHeight)
Create a two dimensional range 0.._globalWidth x 0.._globalHeight using a group which is _localWidth x _localHeight in size.
|
static Range |
create2D(int _globalWidth,
int _globalHeight) |
static Range |
create2D(int _globalWidth,
int _globalHeight,
int _localWidth,
int _localHeight) |
static Range |
create3D(Device _device,
int _globalWidth,
int _globalHeight,
int _globalDepth)
Create a three dimensional range
0.._globalWidth * 0.._globalHeight *0../_globalDepth
choosing suitable values for localWidth , localHeight and localDepth . |
static Range |
create3D(Device _device,
int _globalWidth,
int _globalHeight,
int _globalDepth,
int _localWidth,
int _localHeight,
int _localDepth)
Create a two dimensional range
0.._globalWidth * 0.._globalHeight *0../_globalDepth
in groups defined by localWidth * localHeight * localDepth . |
static Range |
create3D(int _globalWidth,
int _globalHeight,
int _globalDepth) |
static Range |
create3D(int _globalWidth,
int _globalHeight,
int _globalDepth,
int _localWidth,
int _localHeight,
int _localDepth) |
Device |
getDevice() |
int |
getDims()
Get the number of dims for this Range.
|
int |
getGlobalSize_0() |
int |
getGlobalSize_1() |
int |
getGlobalSize_2() |
int |
getGlobalSize(int _dim)
Get the globalSize (of the range) given the requested dimension
|
int |
getLocalSize_0() |
int |
getLocalSize_1() |
int |
getLocalSize_2() |
int |
getLocalSize(int _dim)
Get the localSize (of the group) given the requested dimension
|
int |
getMaxWorkGroupSize() |
int[] |
getMaxWorkItemSize() |
int |
getNumGroups(int _dim)
Get the number of groups for the given dimension.
|
int |
getWorkGroupSize() |
boolean |
isLocalIsDerived() |
boolean |
isValid() |
void |
setDims(int dims) |
void |
setGlobalSize_0(int globalSize_0) |
void |
setGlobalSize_1(int globalSize_1) |
void |
setGlobalSize_2(int globalSize_2) |
void |
setLocalIsDerived(boolean localIsDerived) |
void |
setLocalSize_0(int localSize_0) |
void |
setLocalSize_1(int localSize_1) |
void |
setLocalSize_2(int localSize_2) |
void |
setMaxWorkGroupSize(int maxWorkGroupSize) |
void |
setMaxWorkItemSize(int[] maxWorkItemSize) |
void |
setValid(boolean valid) |
String |
toString()
Override
toString() |
public static final int THREADS_PER_CORE
public static final int MAX_OPENCL_GROUP_SIZE
public static final int MAX_GROUP_SIZE
public Range(Device _device, int _dims)
_device
- _dims
- public static Range create(Device _device, int _globalWidth, int _localWidth)
0.._globalWidth
which is processed in groups of size _localWidth.
_globalWidth > 0 && _localWidth > 0 && _localWidth < MAX_GROUP_SIZE && _globalWidth % _localWidth==0
_globalWidth
- the overall range we wish to process_localWidth
- the size of the group we wish to process.public static Range create(Device _device, int _globalWidth)
0.._globalWidth
with an undefined group size.
_globalWidth > 0
_globalWidth
- the overall range we wish to processpublic static Range create(int _globalWidth, int _localWidth)
public static Range create(int _globalWidth)
public static Range create2D(Device _device, int _globalWidth, int _globalHeight, int _localWidth, int _localHeight)
_globalWidth
- the overall range we wish to processpublic static Range create2D(Device _device, int _globalWidth, int _globalHeight)
0.._globalWidth * 0.._globalHeight
choosing suitable values for localWidth
and localHeight
.
Note that for this range to be valid _globalWidth > 0 && _globalHeight >0 && _localWidth>0 && _localHeight>0 && _localWidth*_localHeight < MAX_GROUP_SIZE && _globalWidth%_localWidth==0 && _globalHeight%_localHeight==0
.
To determine suitable values for _localWidth
and _localHeight
we extract the factors for _globalWidth
and _globalHeight
and then
find the largest product ( <= MAX_GROUP_SIZE
) with the lowest perimeter.
For example for MAX_GROUP_SIZE
of 16 we favor 4x4 over 1x16.
_globalWidth
- the overall range we wish to processpublic static Range create2D(int _globalWidth, int _globalHeight, int _localWidth, int _localHeight)
public static Range create2D(int _globalWidth, int _globalHeight)
public static Range create3D(Device _device, int _globalWidth, int _globalHeight, int _globalDepth, int _localWidth, int _localHeight, int _localDepth)
0.._globalWidth * 0.._globalHeight *0../_globalDepth
in groups defined by localWidth
* localHeight
* localDepth
.
Note that for this range to be valid _globalWidth > 0 && _globalHeight >0 _globalDepth >0 && _localWidth>0 && _localHeight>0 && _localDepth>0 && _localWidth*_localHeight*_localDepth < MAX_GROUP_SIZE && _globalWidth%_localWidth==0 && _globalHeight%_localHeight==0 && _globalDepth%_localDepth==0
.
_globalWidth
- the width of the 3D grid we wish to process_globalHeight
- the height of the 3D grid we wish to process_globalDepth
- the depth of the 3D grid we wish to process_localWidth
- the width of the 3D group we wish to process_localHeight
- the height of the 3D group we wish to process_localDepth
- the depth of the 3D group we wish to processpublic static Range create3D(Device _device, int _globalWidth, int _globalHeight, int _globalDepth)
0.._globalWidth * 0.._globalHeight *0../_globalDepth
choosing suitable values for localWidth
, localHeight
and localDepth
.
Note that for this range to be valid _globalWidth > 0 && _globalHeight >0 _globalDepth >0 && _localWidth>0 && _localHeight>0 && _localDepth>0 && _localWidth*_localHeight*_localDepth < MAX_GROUP_SIZE && _globalWidth%_localWidth==0 && _globalHeight%_localHeight==0 && _globalDepth%_localDepth==0
.
To determine suitable values for _localWidth
,_localHeight
and _lodalDepth
we extract the factors for _globalWidth
,_globalHeight
and _globalDepth
and then
find the largest product ( <= MAX_GROUP_SIZE
) with the lowest perimeter.
For example for MAX_GROUP_SIZE
of 64 we favor 4x4x4 over 1x16x16.
_globalWidth
- the width of the 3D grid we wish to process_globalHeight
- the height of the 3D grid we wish to process_globalDepth
- the depth of the 3D grid we wish to processpublic static Range create3D(int _globalWidth, int _globalHeight, int _globalDepth)
public static Range create3D(int _globalWidth, int _globalHeight, int _globalDepth, int _localWidth, int _localHeight, int _localDepth)
public String toString()
toString()
public int getLocalSize(int _dim)
_dim
- 0=width, 1=height, 2=depthpublic int getGlobalSize(int _dim)
_dim
- 0=width, 1=height, 2=depthpublic int getNumGroups(int _dim)
This will essentially return globalXXXX/localXXXX for the given dimension (width, height, depth)
_dim
- The dim we are interested in 0, 1 or 2public int getWorkGroupSize()
public Device getDevice()
public int getGlobalSize_0()
public void setGlobalSize_0(int globalSize_0)
globalSize_0
- the globalSize_0 to setpublic int getLocalSize_0()
public void setLocalSize_0(int localSize_0)
localSize_0
- the localSize_0 to setpublic int getGlobalSize_1()
public void setGlobalSize_1(int globalSize_1)
globalSize_1
- the globalSize_1 to setpublic int getLocalSize_1()
public void setLocalSize_1(int localSize_1)
localSize_1
- the localSize_1 to setpublic int getGlobalSize_2()
public void setGlobalSize_2(int globalSize_2)
globalSize_2
- the globalSize_2 to setpublic int getLocalSize_2()
public void setLocalSize_2(int localSize_2)
localSize_2
- the localSize_2 to setpublic int getDims()
public void setDims(int dims)
dims
- the dims to setpublic boolean isValid()
public void setValid(boolean valid)
valid
- the valid to setpublic boolean isLocalIsDerived()
public void setLocalIsDerived(boolean localIsDerived)
localIsDerived
- the localIsDerived to setpublic int getMaxWorkGroupSize()
public void setMaxWorkGroupSize(int maxWorkGroupSize)
maxWorkGroupSize
- the maxWorkGroupSize to setpublic int[] getMaxWorkItemSize()
public void setMaxWorkItemSize(int[] maxWorkItemSize)
maxWorkItemSize
- the maxWorkItemSize to setCopyright © 2016 Syncleus. All rights reserved.