本文整理汇总了Java中jcuda.driver.JCudaDriver.cuModuleLoad方法的典型用法代码示例。如果您正苦于以下问题:Java JCudaDriver.cuModuleLoad方法的具体用法?Java JCudaDriver.cuModuleLoad怎么用?Java JCudaDriver.cuModuleLoad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jcuda.driver.JCudaDriver
的用法示例。
在下文中一共展示了JCudaDriver.cuModuleLoad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: 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);
}
}