public class ContextHolder extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEVICES_TO_BAN |
| Modifier and Type | Method and Description |
|---|---|
void |
configure()
Configure the given information
based on the device
|
static CUdevice |
createDevice(CUcontext context,
int deviceNumber)
Create a context for the given device
|
void |
destroy()
Shutdown this instance
|
int |
deviceNum()
Get the number of devices
|
DeviceConfiguration |
getConf()
Get the configuration for the current
device and thread
|
DeviceConfiguration |
getConf(int device)
Get the configuration the given device
|
CUcontext |
getContext()
Retrieve a context for use with the current thread
and the given device
|
CUcontext |
getContext(int deviceToUse)
Retrieve a context for use with the current thread
and the given device
|
cudaStream_t |
getCudaStream()
Get the stream for the current thread
based on the device for the thread
|
GpuInformation |
getCurrentGpuInformation()
Returns the gpu diagnostics
for the current thread
|
int |
getDeviceForThread()
Get the device number for a particular host thread
|
Map<Integer,CUcontext> |
getDeviceIDContexts()
Returns the available contexts
based on device and thread name
|
Map<Integer,CUdevice> |
getDevices()
Returns the available devices
delimited by device,thread
|
GpuInformation |
getGpuInfo(int device)
Returns the gpu diagnostics
for the given device
|
cublasHandle |
getHandle()
Get the handle for the current thread
|
org.apache.commons.pool2.ObjectPool<cublasHandle> |
getHandlePool() |
Map<Integer,GpuInformation> |
getInfo() |
GpuInformation |
getInfoFor(int cUdevice)
Get the information for a particular device
|
static ContextHolder |
getInstance()
Singleton pattern
|
MemoryStrategy |
getMemoryStrategy()
Get the memory strategy for the current thread
and device
|
int |
getNumThreads(Op op) |
org.apache.commons.pool2.ObjectPool<cudaStream_t> |
getOldStreamPool() |
CUstream |
getStream()
Get the stream for the current thread
based on the device for the thread
|
org.apache.commons.pool2.ObjectPool<CUstream> |
getStreamPool() |
Map<String,Integer> |
getThreads() |
void |
setContext() |
void |
setNumDevices(int numDevices) |
static void |
syncStream()
Synchronized the stream.
|
public static final String DEVICES_TO_BAN
public static ContextHolder getInstance()
public org.apache.commons.pool2.ObjectPool<cublasHandle> getHandlePool()
public org.apache.commons.pool2.ObjectPool<CUstream> getStreamPool()
public org.apache.commons.pool2.ObjectPool<cudaStream_t> getOldStreamPool()
public int getNumThreads(Op op)
public int deviceNum()
public DeviceConfiguration getConf()
public MemoryStrategy getMemoryStrategy()
public void configure()
public void setNumDevices(int numDevices)
public GpuInformation getCurrentGpuInformation()
public GpuInformation getGpuInfo(int device)
device - the device to get
the gpu diagnostics forpublic Map<Integer,GpuInformation> getInfo()
public DeviceConfiguration getConf(int device)
device - the device to get the configuration forpublic void setContext()
public static void syncStream()
public int getDeviceForThread()
public cublasHandle getHandle()
public CUcontext getContext()
public cudaStream_t getCudaStream()
public CUstream getStream()
public CUcontext getContext(int deviceToUse)
deviceToUse - the device to usepublic static CUdevice createDevice(CUcontext context, int deviceNumber)
context - the context to createdeviceNumber - the device number to create the context forpublic GpuInformation getInfoFor(int cUdevice)
cUdevice - the device to get the info forpublic Map<Integer,CUdevice> getDevices()
public Map<Integer,CUcontext> getDeviceIDContexts()
public void destroy()
Copyright © 2015. All Rights Reserved.