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


Java JCudaDriver.cuInit方法代码示例

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


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

示例1: CudaDriver

import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
public CudaDriver() throws CudaException
{
	JCudaDriver.cuInit(0);
	CUdevice device = new CUdevice();
	checkError(JCudaDriver.cuDeviceGet(device, 0));
	context = new CUcontext();
	checkError(JCudaDriver.cuCtxCreate(context, 0, device));
	module = new CUmodule();
}
 
开发者ID:cycentum,项目名称:birdsong-recognition,代码行数:10,代码来源:CudaDriver.java

示例2: startup

import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
public static void startup(int deviceId) {
       JCudaDriver.setExceptionsEnabled(true);
       JCudaDriver.cuInit(0);
       device = new CUdevice();
       cuDeviceGet(device, deviceId);
       context = new CUcontext();
       cuCtxCreate(context, 0, device);
}
 
开发者ID:tberg12,项目名称:murphy,代码行数:9,代码来源: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

示例4: init

import jcuda.driver.JCudaDriver; //导入方法依赖的package包/类
@Override
public void init(GLAutoDrawable drawable)
{
	if (multiFrameMode) {
		// Perform the default GL initialization
		GL gl = drawable.getGL();
		gl.setSwapInterval(0);
		gl.glEnable(GL.GL_DEPTH_TEST);
		gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
		setupView(drawable);

		// Initialize the GL_ARB_pixel_buffer_object extension
		if (!gl.isExtensionAvailable("GL_ARB_pixel_buffer_object"))
		{
			new Thread(new Runnable()
			{
				public void run()
				{
					JOptionPane.showMessageDialog(null,
							"GL_ARB_pixel_buffer_object extension not available",
							"Unavailable extension", JOptionPane.ERROR_MESSAGE);
					runExit();
				}
			}).start();
		}

		// Create a TextRenderer for the status messages
		renderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 12));

		if (initialized)
		{
			return;
		}

		// 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 = new CUdevice();
		JCudaDriver.cuDeviceGet(dev, 0);
		glCtx = new CUcontext();
		JCudaDriver.cuGLCtxCreate(glCtx, 0, dev);

		// Load the CUBIN file containing the kernel
		JCudaDriver.cuModuleLoad(module, "volumeRender_kernel.sm_10.cubin");

		// Obtain the global pointer to the inverted view matrix from 
		// the module
		JCudaDriver.cuModuleGetGlobal(c_invViewMatrix, new int[1], module,
		"c_invViewMatrix");

		// Obtain a function pointer to the kernel function. This function
		// will later be called in the display method of this 
		// GLEventListener.
		function = new CUfunction();
		JCudaDriver.cuModuleGetFunction(function, module,
		"_Z16d_render_texturePjjjffffi");

		// Initialize CUDA with the current volume data
		initCuda();

		// Initialize the OpenGL pixel buffer object
		initPBO(gl);

		initialized = true;
	} else {
		super.init(drawable);
	}
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:70,代码来源:ImagePlusVolumeRenderer.java


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