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


Java CLMem类代码示例

本文整理汇总了Java中com.nativelibs4java.opencl.CLMem的典型用法代码示例。如果您正苦于以下问题:Java CLMem类的具体用法?Java CLMem怎么用?Java CLMem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: kernel_14740318

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
public static void kernel_14740318(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int[] paramArrayOfInt)
{
  CLDevice.QueueProperties[] arrayOfQueueProperties = { CLDevice.QueueProperties.ProfilingEnable };
  CLQueue localCLQueue = context.createDefaultQueue(arrayOfQueueProperties);
  String[] arrayOfString = { kernel_14740318 };
  CLKernel[] arrayOfCLKernel = context.createProgram(arrayOfString).createKernels();
  CLKernel localCLKernel = arrayOfCLKernel[0];
  int i = paramInt2;
  int j = paramInt3;
  int k = paramInt4;
  CLBuffer localCLBuffer = context.createBuffer(CLMem.Usage.InputOutput, Pointer.pointerToInts(paramArrayOfInt), true);
  localCLKernel.setArgs(new Object[] { paramInt1, i, j, k, localCLBuffer });
  int m = paramInt1 - paramInt4 / 1;
  CLEvent[] arrayOfCLEvent = { null };
  CLEvent localCLEvent = localCLKernel.enqueueNDRange(localCLQueue, new int[] { m }, arrayOfCLEvent);
  localCLQueue.finish();
  localCLBuffer.read(localCLQueue, new CLEvent[] { localCLEvent }).getInts(paramArrayOfInt);
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:19,代码来源:MemImage.java

示例2: kernel_20211761

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
public static void kernel_20211761(int paramInt1, int paramInt2, int paramInt3, float paramFloat1, short[] paramArrayOfShort, int paramInt4, int paramInt5, float paramFloat2) {
	CLDevice.QueueProperties[] arrayOfQueueProperties = { CLDevice.QueueProperties.ProfilingEnable };
	CLQueue localCLQueue = context.createDefaultQueue(arrayOfQueueProperties);
	String[] arrayOfString = { kernel_20211761 };
	CLKernel[] arrayOfCLKernel = context.createProgram(arrayOfString).createKernels();
	CLKernel localCLKernel = arrayOfCLKernel[0];
	int i = paramInt2;
	int j = paramInt3;
	float f1 = paramFloat1;
	CLBuffer localCLBuffer = context.createBuffer(CLMem.Usage.InputOutput, Pointer.pointerToShorts(paramArrayOfShort), true);
	int k = paramInt4;
	int m = paramInt5;
	float f2 = paramFloat2;
	localCLKernel.setArgs(new Object[] { paramInt1, i, j, f1, localCLBuffer, k, m, f2 });
	int n = paramInt1 - paramInt5 / 1;
	CLEvent[] arrayOfCLEvent = { null };
	CLEvent localCLEvent = localCLKernel.enqueueNDRange(localCLQueue, new int[] { n }, arrayOfCLEvent);
	localCLQueue.finish();
	localCLBuffer.read(localCLQueue, new CLEvent[] { localCLEvent }).getShorts(paramArrayOfShort);
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:21,代码来源:Mandelbrot.java

示例3: kernel_14309029

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
public static void kernel_14309029(int paramInt1, int paramInt2, int paramInt3, int paramInt4, byte[] paramArrayOfByte1, int paramInt5, int paramInt6, int paramInt7, float[] paramArrayOfFloat, byte[] paramArrayOfByte2) {
	CLDevice.QueueProperties[] arrayOfQueueProperties = { CLDevice.QueueProperties.ProfilingEnable };
	CLQueue localCLQueue = context.createDefaultQueue(arrayOfQueueProperties);
	String[] arrayOfString = { kernel_14309029 };
	CLKernel[] arrayOfCLKernel = context.createProgram(arrayOfString).createKernels();
	CLKernel localCLKernel = arrayOfCLKernel[0];
	int i = paramInt2;
	int j = paramInt3;
	int k = paramInt4;
	CLBuffer localCLBuffer1 = context.createBuffer(CLMem.Usage.InputOutput, Pointer.pointerToBytes(paramArrayOfByte1), true);
	int m = paramInt5;
	int n = paramInt6;
	int i1 = paramInt7;
	CLBuffer localCLBuffer2 = context.createBuffer(CLMem.Usage.Input, Pointer.pointerToFloats(paramArrayOfFloat), true);
	CLBuffer localCLBuffer3 = context.createBuffer(CLMem.Usage.Input, Pointer.pointerToBytes(paramArrayOfByte2), true);
	localCLKernel.setArgs(new Object[] { paramInt1, i, j, k, localCLBuffer1, m, n, i1, localCLBuffer2, localCLBuffer3 });
	int i2 = paramInt1 - paramInt4 / 1;
	CLEvent[] arrayOfCLEvent = { null };
	CLEvent localCLEvent = localCLKernel.enqueueNDRange(localCLQueue, new int[] { i2 }, arrayOfCLEvent);
	localCLQueue.finish();
	localCLBuffer1.read(localCLQueue, new CLEvent[] { localCLEvent }).getBytes(paramArrayOfByte1);
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:23,代码来源:Convolution.java

示例4: kernel_332684807

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
public  void kernel_332684807(int paramInt1, int paramInt2, int paramInt3, float[] paramArrayOfFloat1, int paramInt4, int paramInt5, float[] paramArrayOfFloat2, float[] paramArrayOfFloat3)
{
	CLDevice.QueueProperties[] arrayOfQueueProperties = { CLDevice.QueueProperties.ProfilingEnable };
	CLQueue localCLQueue = context.createDefaultQueue(arrayOfQueueProperties);
	String[] arrayOfString = { kernel_332684807 };
	CLKernel[] arrayOfCLKernel = context.createProgram(arrayOfString).createKernels();
	CLKernel localCLKernel = arrayOfCLKernel[0];
	int i = paramInt3;
	CLBuffer localCLBuffer1 = context.createBuffer(CLMem.Usage.Input, Pointer.pointerToFloats(paramArrayOfFloat1), true);
	int j = paramInt4;
	int k = paramInt5;
	CLBuffer localCLBuffer2 = context.createBuffer(CLMem.Usage.InputOutput, Pointer.pointerToFloats(paramArrayOfFloat2), true);
	CLBuffer localCLBuffer3 = context.createBuffer(CLMem.Usage.Input, Pointer.pointerToFloats(paramArrayOfFloat3), true);
	localCLKernel.setArgs(new Object[] { paramInt1, paramInt2, i, localCLBuffer1, j, k, localCLBuffer2, localCLBuffer3 });
	int m = paramInt1 - paramInt5 / 1;
	int n = paramInt2 - paramInt4 / 1;
	CLEvent[] arrayOfCLEvent = { null };
	CLEvent localCLEvent = localCLKernel.enqueueNDRange(localCLQueue, new int[] { m, n }, arrayOfCLEvent);
	localCLQueue.finish();

	localCLBuffer2.read(localCLQueue, new CLEvent[] { localCLEvent }).getFloats(paramArrayOfFloat2);

}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:24,代码来源:MatrixMultiplication.java

示例5: kernel_1365023967

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
public static void kernel_1365023967(int paramInt1, float[] paramArrayOfFloat1, float[] paramArrayOfFloat2, int paramInt2)
{
  CLDevice.QueueProperties[] arrayOfQueueProperties = { CLDevice.QueueProperties.ProfilingEnable };
  CLQueue localCLQueue = context.createDefaultQueue(arrayOfQueueProperties);
  String[] arrayOfString = { kernel_1365023967 };
  CLKernel[] arrayOfCLKernel = context.createProgram(arrayOfString).createKernels();
  CLKernel localCLKernel = arrayOfCLKernel[0];
  CLBuffer localCLBuffer1 = context.createBuffer(CLMem.Usage.InputOutput, Pointer.pointerToFloats(paramArrayOfFloat1), true);
  CLBuffer localCLBuffer2 = context.createBuffer(CLMem.Usage.Input, Pointer.pointerToFloats(paramArrayOfFloat2), true);
  int i = paramInt2;
  localCLKernel.setArgs(new Object[] { paramInt1, localCLBuffer1, localCLBuffer2, i });
  int j = paramInt1 - paramInt2 / 1;
  CLEvent[] arrayOfCLEvent = { null };
  CLEvent localCLEvent = localCLKernel.enqueueNDRange(localCLQueue, new int[] { j }, arrayOfCLEvent);
  localCLQueue.finish();
  localCLBuffer1.read(localCLQueue, new CLEvent[] { localCLEvent }).getFloats(paramArrayOfFloat1);
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:18,代码来源:SquaresMath.java

示例6: kernel_1387062610

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
public static void kernel_1387062610(int paramInt1, int paramInt2, float paramFloat1, float[] paramArrayOfFloat1, float paramFloat2, int paramInt3, float[] paramArrayOfFloat2, float paramFloat3)
{
  CLDevice.QueueProperties[] arrayOfQueueProperties = { CLDevice.QueueProperties.ProfilingEnable };
  CLQueue localCLQueue = context.createDefaultQueue(arrayOfQueueProperties);
  String[] arrayOfString = { kernel_1387062610 };
  CLKernel[] arrayOfCLKernel = context.createProgram(arrayOfString).createKernels();
  CLKernel localCLKernel = arrayOfCLKernel[0];
  int i = paramInt2;
  float f1 = paramFloat1;
  CLBuffer localCLBuffer1 = context.createBuffer(CLMem.Usage.InputOutput, Pointer.pointerToFloats(paramArrayOfFloat1), true);
  float f2 = paramFloat2;
  int j = paramInt3;
  CLBuffer localCLBuffer2 = context.createBuffer(CLMem.Usage.InputOutput, Pointer.pointerToFloats(paramArrayOfFloat2), true);
  float f3 = paramFloat3;
  localCLKernel.setArgs(new Object[] { paramInt1, i, f1, localCLBuffer1, f2, j, localCLBuffer2, f3 });
  int k = paramInt1 - paramInt2 / 1;
  CLEvent[] arrayOfCLEvent = { null };
  CLEvent localCLEvent = localCLKernel.enqueueNDRange(localCLQueue, new int[] { k }, arrayOfCLEvent);
  localCLQueue.finish();
  localCLBuffer1.read(localCLQueue, new CLEvent[] { localCLEvent }).getFloats(paramArrayOfFloat1);
  localCLBuffer2.read(localCLQueue, new CLEvent[] { localCLEvent }).getFloats(paramArrayOfFloat2);
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:23,代码来源:NBody.java

示例7: testStructs

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
@Test
public void testStructs() throws IOException {
    Structs.S s = new Structs.S();
    Pointer<Structs.S> pS = Pointer.getPointer(s);
    CLBuffer<Structs.S> b = context.createBuffer(CLMem.Usage.InputOutput, pS);
    
    CLEvent e = structs.f(queue, b, new int[] { 1 }, null);
    b.read(queue, pS, true, e);
    assertEquals(10, s.a());
    assertEquals(100, s.b());
    
    s.a(1).b(2);
    b.write(queue, pS, true);
    e = structs.f(queue, b, new int[] { 1 }, null);
    b.read(queue, pS, true, e);
    assertEquals(12, s.a());
    assertEquals(120, s.b());
    
}
 
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:20,代码来源:GeneratorTest.java

示例8: add

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
/**
 * Add two images, returning a new image with the result
 * 
 * @param <I> The type of image
 * 
 * @param in1 the first image to add
 * @param in2 the second image to add
 * @return the event
 */
public <I extends Image<?, I>> I add(I in1, I in2) {
	CLQueue queue = context.createDefaultQueue();
	
	CLImage2D clin1 = CLImageConversion.convert(context, in1);
	CLImage2D clin2 = CLImageConversion.convert(context, in2);
	CLImage2D clout = context.createImage2D(CLMem.Usage.Output, clin1.getFormat(), clin1.getWidth(), clin1.getHeight());
	
	CLEvent evt = process(addImage, queue, clin1, clin2, clout);
	
	I out = CLImageConversion.convert(queue, evt, clout, in1.newInstance(in1.getWidth(), in1.getHeight()));
	
	clin1.release();
	clin2.release();
	clout.release();
	queue.release();
	
	return out;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:CLImageArithmetic.java

示例9: subtract

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
/**
 * Subtract two images, returning a new image with the result
 * 
 * @param <I> The type of image
 * 
 * @param in1 the first image to subtract
 * @param in2 the second image to subtract
 * @return the event
 */
public <I extends Image<?, I>> I subtract(I in1, I in2) {
	CLQueue queue = context.createDefaultQueue();
	
	CLImage2D clin1 = CLImageConversion.convert(context, in1);
	CLImage2D clin2 = CLImageConversion.convert(context, in2);
	CLImage2D clout = context.createImage2D(CLMem.Usage.Output, clin1.getFormat(), clin1.getWidth(), clin1.getHeight());
	
	CLEvent evt = process(subtractImage, queue, clin1, clin2, clout);
	
	I out = CLImageConversion.convert(queue, evt, clout, in1.newInstance(in1.getWidth(), in1.getHeight()));
	
	clin1.release();
	clin2.release();
	clout.release();
	queue.release();
	
	return out;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:CLImageArithmetic.java

示例10: multiply

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
/**
 * Multiply two images, returning a new image with the result
 * 
 * @param <I> The type of image
 * 
 * @param in1 the first image to multiply
 * @param in2 the second image to multiply
 * @return the event
 */
public <I extends Image<?, I>> I multiply(I in1, I in2) {
	CLQueue queue = context.createDefaultQueue();
	
	CLImage2D clin1 = CLImageConversion.convert(context, in1);
	CLImage2D clin2 = CLImageConversion.convert(context, in2);
	CLImage2D clout = context.createImage2D(CLMem.Usage.Output, clin1.getFormat(), clin1.getWidth(), clin1.getHeight());
	
	CLEvent evt = process(multiplyImage, queue, clin1, clin2, clout);
	
	I out = CLImageConversion.convert(queue, evt, clout, in1.newInstance(in1.getWidth(), in1.getHeight()));
	
	clin1.release();
	clin2.release();
	clout.release();
	queue.release();
	
	return out;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:CLImageArithmetic.java

示例11: divide

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
/**
 * Divide two images, returning a new image with the result
 * 
 * @param <I> The type of image
 * 
 * @param in1 the first image to divide
 * @param in2 the second image to divide
 * @return the event
 */
public <I extends Image<?, I>> I divide(I in1, I in2) {
	CLQueue queue = context.createDefaultQueue();
	
	CLImage2D clin1 = CLImageConversion.convert(context, in1);
	CLImage2D clin2 = CLImageConversion.convert(context, in2);
	CLImage2D clout = context.createImage2D(CLMem.Usage.Output, clin1.getFormat(), clin1.getWidth(), clin1.getHeight());
	
	CLEvent evt = process(divideImage, queue, clin1, clin2, clout);
	
	I out = CLImageConversion.convert(queue, evt, clout, in1.newInstance(in1.getWidth(), in1.getHeight()));
	
	clin1.release();
	clin2.release();
	clout.release();
	queue.release();
	
	return out;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:CLImageArithmetic.java

示例12: processImage

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
@Override
public void processImage(I image) {
	CLQueue queue = context.createDefaultQueue();

	CLImage2D in = CLImageConversion.convert(context, image);
	CLImage2D out = context.createImage2D(CLMem.Usage.Output, in.getFormat(), in.getWidth(), in.getHeight());
	
	kernel.setArgs(in, out);
	CLEvent evt = kernel.enqueueNDRange(queue, new int[] {(int) in.getWidth(), (int) in.getHeight()});

	CLImageConversion.convert(queue, evt, out, image);
	
	in.release();
	out.release();
	queue.release();
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:17,代码来源:CLImageProcessor.java

示例13: analyseImage

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
@Override
public void analyseImage(FImage image) {
	CLQueue queue = context.createDefaultQueue();

	CLImage2D in = CLImageConversion.convert(context, image);
	
	CLImageFormat outFmt = new CLImageFormat(ChannelOrder.RGBA, ChannelDataType.Float);
	CLImage2D out = context.createImage2D(CLMem.Usage.Output, outFmt, in.getWidth(), in.getHeight());
	
	kernel.setArgs(in, out);
	CLEvent evt = kernel.enqueueNDRange(queue, new int[] {(int) in.getWidth(), (int) in.getHeight()});

	MBFImage res = CLImageConversion.convert(queue, evt, out, new MBFImage(image.width, image.height, 4));
	
	this.magnitude = res.bands.get(0);
	this.orientation = res.bands.get(1);
	this.gradientX = res.bands.get(2);
	this.gradientY = res.bands.get(3);
	
	in.release();
	out.release();
	queue.release();
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:24,代码来源:CLSobel.java

示例14: activesamples_Loop_kernel_11196558885

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
public static void activesamples_Loop_kernel_11196558885(int limit0, int[] v1_2894, int v2_INT) {
CLContext context = createBestContext();
CLQueue queue = context.createDefaultQueue();
CLKernel kernel = context.createProgram(kernel_1196558885).createKernel("kernel_1196558885");
CLBuffer<Integer> _v1_2894 = context.createBuffer(CLMem.Usage.InputOutput, pointerToInts(v1_2894), true);
int _v2_INT = v2_INT;
kernel.setArgs(limit0,  _v1_2894,  _v2_INT);
int required0 = (limit0 - v2_INT) / 1;
CLEvent clEvent1 = kernel.enqueueNDRange(queue, new int[]{required0});
queue.finish();
_v1_2894.read(queue, clEvent1).getInts(v1_2894);
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:13,代码来源:GeneratedTest.java

示例15: add

import com.nativelibs4java.opencl.CLMem; //导入依赖的package包/类
public static Pointer<Float> add(Pointer<Float> a, Pointer<Float> b)
			throws CLBuildException {
		int n = (int) a.getValidElements();

		CLContext context = JavaCL.createBestContext();
		CLQueue queue = context.createDefaultQueue();

		String source = " void plusplus(int *i){i[0]= i[0]+1;}  " +
				" void add(__global float *a,__global float *b,__global float *c,__global int *i){int j = (int)i;c[j] = a[j] + b[j]; } \n" +
				"__kernel void kernel1 (__global  float* a, __global  float* b, __global float* output)     "
				+ "{                                                                                                     "
				+ "   int i = get_global_id(0);  " +
				   "  "+
				"    add(a,b,output,i); " +
				
				"     " +
				"                                                                 "
				+ "   " +
				"                                                                           "
				+ "}                                                                                                     "
				+" ";

		//CLKernel kernel = context.createProgram(kernel_1354633072).createKernel(		"kernel_1354633072");
		
		CLKernel kernel1 = context.createProgram(source).createKernel("kernel1");
		CLBuffer<Float> aBuf = context.createBuffer(CLMem.Usage.Input, a, true);
		CLBuffer<Float> bBuf = context.createBuffer(CLMem.Usage.Input, b, true);
		
		CLBuffer<Float> outBuf = context.createBuffer(CLMem.Usage.InputOutput, a, true);
//		CLBuffer<Float> outBuf = context.createBuffer(CLMem.Usage.InputOutput,
//				Float.class, n);
		kernel1.setArgs(aBuf, bBuf, outBuf);

		kernel1.enqueueNDRange(queue, new int[] { n });
		queue.finish();

		return outBuf.read(queue);
	}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:39,代码来源:VectorAdd.java


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