当前位置: 首页>>代码示例>>Java>>正文


Java JCudaDriver.cuDeviceGetProperties方法代码示例

本文整理汇总了Java中jcuda.driver.JCudaDriver.cuDeviceGetProperties方法的典型用法代码示例。如果您正苦于以下问题:Java JCudaDriver.cuDeviceGetProperties方法的具体用法?Java JCudaDriver.cuDeviceGetProperties怎么用?Java JCudaDriver.cuDeviceGetProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jcuda.driver.JCudaDriver的用法示例。


在下文中一共展示了JCudaDriver.cuDeviceGetProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBestDevice

import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
public static CUdevice getBestDevice() {
	CUdevice best = null;
	long lastmem = Long.MIN_VALUE;
	int [] count = new int[1];
	JCudaDriver.cuDeviceGetCount(count);
	for (int i = 0; i < count[0]; i++) {
		CUdevice dev = new CUdevice();
		JCudaDriver.cuDeviceGet(dev, i);
		CUdevprop prop = new CUdevprop();
		JCudaDriver.cuDeviceGetProperties(prop, dev);
		//System.out.println(prop);
		int [] memory = new int [1]; 
		JCudaDriver.cuDeviceTotalMem(memory, dev);
		long mem = correctMemoryValue(memory[0]);
		//System.out.println("Memory " + mem);
		if (mem > lastmem){
			best = dev;
			lastmem = mem;
		}
	}
	return best;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:23,代码来源:CUDAUtil.java

示例2: getSmallestDevice

import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
public static CUdevice getSmallestDevice() {
	CUdevice best = null;
	long lastmem = Long.MAX_VALUE;
	int [] count = new int[1];
	JCudaDriver.cuDeviceGetCount(count);
	for (int i = 0; i < count[0]; i++) {
		CUdevice dev = new CUdevice();
		JCudaDriver.cuDeviceGet(dev, i);
		CUdevprop prop = new CUdevprop();
		JCudaDriver.cuDeviceGetProperties(prop, dev);
		//System.out.println(prop);
		int [] memory = new int [1]; 
		JCudaDriver.cuDeviceTotalMem(memory, dev);
		long mem = correctMemoryValue(memory[0]);
		//System.out.println("Memory " + mem);
		if (mem < lastmem){
			best = dev;
			lastmem = mem;
		}
	}
	return best;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:23,代码来源:CUDAUtil.java

示例3: initCUDA

import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
public void initCUDA(){
	if (!inited) {
		// Initialize the JCudaDriver. Note that this has to be done from 
		// the same thread that will later use the JCudaDriver API.
		JCudaDriver.setExceptionsEnabled(true);
		JCudaDriver.cuInit(0);
		CUdevice dev = CUDAUtil.getBestDevice();
		cuCtx = new CUcontext();
		JCudaDriver.cuCtxCreate(cuCtx, 0, dev);
		// check space on device:
		int [] memory = new int [1]; 
		JCudaDriver.cuDeviceTotalMem(memory, dev);
		int availableMemory = (int) (CUDAUtil.correctMemoryValue(memory[0]) / ((long)1024 * 1024));
		if (debug) {
			System.out.println("Total available Memory on CUDA card:" + availableMemory);
		}
		if (debug) {
			CUdevprop prop = new CUdevprop();
			JCudaDriver.cuDeviceGetProperties(prop, dev);
			System.out.println(prop.toFormattedString());
		}
		// Load the CUBIN file containing the kernel
		module = new CUmodule();
		JCudaDriver.cuModuleLoad(module, "CUDAVolumeFunctions.sm_10.cubin");

		// Obtain a function pointer to the kernel function. This function
		// will later be called. 
		// 
		if (debug) System.out.println("Initialized.");
		inited = true;
	}
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:33,代码来源:CUDAVolumeOperator.java


注:本文中的jcuda.driver.JCudaDriver.cuDeviceGetProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。