devices.h 833 Bytes
#ifndef RTS_CUDA_DEVICES
#define RTS_CUDA_DEVICES

#include <cuda.h>

namespace stim{
extern "C"
int maxThreadsPerBlock()
{
	int device;
	cudaGetDevice(&device);		//get the id of the current device
	cudaDeviceProp props;		//device property structure
	cudaGetDeviceProperties(&props, device);
	return props.maxThreadsPerBlock;
}

extern "C"
size_t sharedMemPerBlock()
{
	int device;
	cudaGetDevice(&device);		//get the id of the current device
	cudaDeviceProp props;		//device property structure
	cudaGetDeviceProperties(&props, device);
	return props.sharedMemPerBlock;
}

extern "C"
size_t constMem()
{
	int device;
	cudaGetDevice(&device);		//get the id of the current device
	cudaDeviceProp props;		//device property structure
	cudaGetDeviceProperties(&props, device);
	return props.totalConstMem;
}
}	//end namespace rts

#endif