public class GpuMetrics extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_BLOCKS |
static int |
MAX_THREADS |
| Constructor and Description |
|---|
GpuMetrics() |
| Modifier and Type | Method and Description |
|---|---|
static GpuMetrics |
blockAndThreads(String dataType,
int n)
Get the blocks and threads
used for a kernel launch
|
static GpuMetrics |
blocksAndThreadsOccupancy(String functionName,
String dataType,
int n) |
int |
getBlockSize() |
int[] |
getGpuDefinitionInfo()
Outputs the expected gpu information
to send to the gpu for cuda
kernel metadata.
|
int |
getGridSize() |
int |
getSharedMemory() |
static int[] |
getThreadsAndBlocks(int n,
int maxThreads,
int maxBlocks)
Given n, max threads
|
void |
setBlockSizeNotOverMax(int blockSize)
Special setter
that queries the block size
to ensure not over the max possible
block size is specified.
|
void |
setGridSizeNotOverMax(int gridSize)
Special setter that queries
the maximum amount of shared memory per block allowed
|
void |
setSharedMemoryNotOverMax(int sharedMemory)
Special setter that queries
the maximum amount of shared memory per block allowed
|
void |
validate()
Validates the current configuration
against the gpu's hardware constraints.
|
public static final int MAX_THREADS
public static final int MAX_BLOCKS
public int[] getGpuDefinitionInfo()
public int getGridSize()
public int getBlockSize()
public int getSharedMemory()
public static int[] getThreadsAndBlocks(int n,
int maxThreads,
int maxBlocks)
n - the number of elements to processmaxThreads - the max number of threadsmaxBlocks - the max number of blockspublic static GpuMetrics blockAndThreads(String dataType, int n)
dataType - the data typen - the number of elementspublic static GpuMetrics blocksAndThreadsOccupancy(String functionName, String dataType, int n)
functionName - dataType - n - public void validate()
IllegalArgumentException
if any of the values surpass the GPU's
built in hardware constraintspublic void setSharedMemoryNotOverMax(int sharedMemory)
sharedMemory - public void setGridSizeNotOverMax(int gridSize)
gridSize - public void setBlockSizeNotOverMax(int blockSize)
blockSize - the block size to attempt to setCopyright © 2015. All Rights Reserved.