本文整理汇总了Java中com.nativelibs4java.opencl.CLBuildException类的典型用法代码示例。如果您正苦于以下问题:Java CLBuildException类的具体用法?Java CLBuildException怎么用?Java CLBuildException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CLBuildException类属于com.nativelibs4java.opencl包,在下文中一共展示了CLBuildException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: min
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
@Override
public Matrix min(Ret returnType, int dimension) throws MatrixException {
switch (dimension) {
case ROW:
case COLUMN:
// TODO
return super.min(returnType, dimension);
case ALL:
try {
return inst(impl.min());
} catch (CLBuildException ex) {
throw new MatrixException("Failed to compute min", ex);
}
default:
throw new IllegalArgumentException("Invalid dimension : " + dimension);
}
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:18,代码来源:CLDenseDoubleMatrix2D.java
示例2: max
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
@Override
public Matrix max(Ret returnType, int dimension) throws MatrixException {
switch (dimension) {
case ROW:
case COLUMN:
// TODO
return super.max(returnType, dimension);
case ALL:
try {
return inst(impl.max());
} catch (CLBuildException ex) {
throw new MatrixException("Failed to compute max", ex);
}
default:
throw new IllegalArgumentException("Invalid dimension : " + dimension);
}
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:18,代码来源:CLDenseDoubleMatrix2D.java
示例3: matrixTranspose
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public static <T> void matrixTranspose(
final CLMatrix2D<T> a,
final CLMatrix2D<T> out)
throws CLBuildException
{
final Primitive primitive = a.getPrimitive();
final CLKernels kernels = a.getKernels();
a.getEvents().performRead(new CLEvents.Action() {
public CLEvent perform(final CLEvent[] aevents) {
return out.getEvents().performWrite(new CLEvents.Action() {
public CLEvent perform(final CLEvent[] cevents) {
CLEvent evt = kernels.matrixTranspose(
primitive,
a.getBuffer(),
a.getRowCount(), a.getColumnCount(), a.getStride(),
out.getBuffer(),
join(aevents, cevents)
);
return evt;
}
});
}
});
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:25,代码来源:CLMatrixUtils.java
示例4: op1
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public static <V> CLMatrix2D<V> op1(final CLMatrix2D<V> in, final Fun1 fun, final CLMatrix2D<V> out) throws CLBuildException {
in.getEvents().performRead(new CLEvents.Action() {
public CLEvent perform(final CLEvent[] ievents) {
return out.getEvents().performWrite(new CLEvents.Action() {
public CLEvent perform(CLEvent[] oevents) {
return in.getKernels().op1(in.getPrimitive(), fun, in.getBuffer(),
in.getRowCount(), in.getColumnCount(), in.getStride(),
out.getBuffer(), join(ievents, oevents));
}
});
}
});
return out;
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:17,代码来源:CLMatrixUtils.java
示例5: op2
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public static <V> CLMatrix2D<V> op2(final CLMatrix2D<V> in1, final Fun2 fun, final CLMatrix2D<V> in2, final CLMatrix2D<V> out) throws CLBuildException {
in1.getEvents().performRead(new CLEvents.Action() {
public CLEvent perform(final CLEvent[] i1events) {
return in2.getEvents().performRead(new CLEvents.Action() {
public CLEvent perform(final CLEvent[] i2events) {
return out.getEvents().performWrite(new CLEvents.Action() {
public CLEvent perform(CLEvent[] oevents) {
return in1.getKernels().op2(in1.getPrimitive(), fun,
in1.getBuffer(), in2.getBuffer(),
in1.getRowCount(), in1.getColumnCount(), in1.getStride(),
out.getBuffer(), join(i1events, i2events, oevents));
}
});
}
});
}
});
return out;
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:23,代码来源:CLMatrixUtils.java
示例6: matrixMultiply
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public <T> CLEvent matrixMultiply(Primitive prim,
CLBuffer<T> a, long aRows, long aColumns, long aStride, int aBlockSize,
CLBuffer<T> b, long bRows, long bColumns, long bStride, int bBlockSize,
CLBuffer<T> out, CLEvent... eventsToWaitFor) throws CLBuildException {
boolean useBlocks = false;
int blockSize = aBlockSize;
if (blockSize > 1 && blockSize == bBlockSize) {
long[] maxWorkItemSizes = queue.getDevice().getMaxWorkItemSizes();
useBlocks = maxWorkItemSizes.length >= 2 &&
maxWorkItemSizes[0] >= blockSize &&
maxWorkItemSizes[1] >= blockSize;
}
if (useBlocks) {
return blockMatrixMultiply(
blockSize, prim,
a, roundUp(aRows, blockSize), roundUp(aColumns, blockSize),
b, roundUp(bRows, blockSize), roundUp(bColumns, blockSize),
out, eventsToWaitFor);
} else {
return naiveMatrixMultiply(prim, a, aRows, aColumns, aStride, b, bRows, bColumns, bStride, out, eventsToWaitFor);
}
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:23,代码来源:CLKernels.java
示例7: multiplyDoubles
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public synchronized CLEvent multiplyDoubles(
CLBuffer<Double> a, int aRows, int aColumns,
CLBuffer<Double> b, int bRows, int bColumns,
CLBuffer<Double> out, //long outRows, long outColumns,
CLEvent... eventsToWaitFor) throws CLBuildException
{
if (a == null || b == null || out == null)
throw new IllegalArgumentException("Null matrix");
if (aColumns != bRows || out.getElementCount() != (aRows * bColumns))
throw new IllegalArgumentException("Invalid matrix sizes : multiplying matrices of sizes (A, B) and (B, C) requires output of size (A, C)");
long outRows = aRows;
long outColumns = bColumns;
return kernels.mulMatDouble(queue,
a, (int)aColumns,
b, (int)bColumns,
out,
new int[] { (int)outRows, (int)outColumns },
null,
eventsToWaitFor
);
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:24,代码来源:LinearAlgebraUtils.java
示例8: multiplyFloats
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public synchronized CLEvent multiplyFloats(
CLBuffer<Float> a, long aRows, long aColumns,
CLBuffer<Float> b, long bRows, long bColumns,
CLBuffer<Float> out, //long outRows, long outColumns,
CLEvent... eventsToWaitFor) throws CLBuildException
{
long outRows = aRows;
long outColumns = bColumns;
return kernels.mulMatFloat(queue,
a, (int)aColumns,
b, (int)bColumns,
out,
new int[] { (int)outRows, (int)outColumns },
null,
eventsToWaitFor
);
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:18,代码来源:LinearAlgebraUtils.java
示例9: getKernel
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public synchronized CLKernel getKernel(Fun2 op, Primitive prim1, Primitive prim2, Primitive primOut, boolean secondOperandIsScalar) throws CLBuildException {
Map<PrimitiveTrio, CLKernel> m = fun2Kernels.get(op);
if (m == null)
fun2Kernels.put(op, m = new HashMap<PrimitiveTrio, CLKernel>());
PrimitiveTrio key = new PrimitiveTrio(prim1, prim2, primOut, secondOperandIsScalar);
CLKernel ker = m.get(key);
if (ker == null) {
StringBuilder out = new StringBuilder(300);
String name = createVectFun2Source(op, prim1, prim2, primOut, out, secondOperandIsScalar);
CLProgram prog = getContext().createProgram(out.toString()).build();
ker = prog.createKernel(name);
m.put(key, ker);
}
return ker;
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:17,代码来源:ParallelMath.java
示例10: waitForData
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
private synchronized void waitForData(int n) {
try {
if (lastData == null) {
//lastOutputData = NIOUtils.directInts(parallelSize, context.getKernelsDefaultByteOrder());
if (preloadEvent == null)
preloadEvent = randomProgram.gen_numbers(queue, seeds, output, globalWorkSizes, null);
readLastOutputData();
}
if (consumedInts > parallelSize - n) {
preload().waitFor();
consumedInts = 0;
readLastOutputData();
}
if (preload && preloadEvent == null)
preload();
} catch (CLBuildException ex) {
throw new RuntimeException(ex);
}
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:21,代码来源:ParallelRandom.java
示例11: add
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的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
示例12: createProgram
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public boolean createProgram(String codeSrc, String[] error) {
try {
program = clContext.createProgram(codeSrc);
if (program != null) {
program.build();
return true;
}
} catch (CLBuildException e) {
error[0] = e.getMessage();
}
return false;
}
开发者ID:iapafoto,项目名称:DicomViewer,代码行数:13,代码来源:OpenCLWithJavaCL.java
示例13: min
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public CLDenseMatrix2DImpl<V> min() throws CLBuildException {
synchronized (this) {
if (minReductor == null)
minReductor = ReductionUtils.createReductor(getMatrix().getContext(), ReductionUtils.Operation.Min, getMatrix().getPrimitive().oclType, 1);
}
CLMatrix2D<V> out = getMatrix().blankMatrix(1, 1);
CLMatrixUtils.reduce(getMatrix(), out, minReductor);
return new CLDenseMatrix2DImpl<V>(out);
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:10,代码来源:CLDenseMatrix2DImpl.java
示例14: max
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public CLDenseMatrix2DImpl<V> max() throws CLBuildException {
synchronized (this) {
if (maxReductor == null)
maxReductor = ReductionUtils.createReductor(getMatrix().getContext(), ReductionUtils.Operation.Max, getMatrix().getPrimitive().oclType, 1);
}
CLMatrix2D<V>
in = getMatrix(),
out = in.blankMatrix(1, 1);
CLMatrixUtils.reduce(in, out, minReductor);
return new CLDenseMatrix2DImpl<V>(out);
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:12,代码来源:CLDenseMatrix2DImpl.java
示例15: containsValue
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public boolean containsValue(final V value) throws CLBuildException {
final boolean ret[] = new boolean[1];
getMatrix().getEvents().performRead(new CLEvents.Action() {
public CLEvent perform(CLEvent[] events) {
ret[0] = getMatrix().getKernels().containsValue(getMatrix().getPrimitive(), getMatrix().getBuffer(), getMatrix().getBuffer().getElementCount(), value, events);
return null;
}
});
return ret[0];
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:11,代码来源:CLDenseMatrix2DImpl.java
示例16: clear
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public void clear() throws CLBuildException {
getMatrix().getEvents().performWrite(new CLEvents.Action() {
public CLEvent perform(CLEvent[] events) {
return getMatrix().getKernels().clear(getMatrix().getPrimitive(), getMatrix().getBuffer(), getMatrix().getBuffer().getElementCount(), events);
}
});
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:8,代码来源:CLDenseMatrix2DImpl.java
示例17: containsDouble
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
@Override
public boolean containsDouble(double v) {
try {
return impl.containsValue(v);
} catch (CLBuildException ex) {
throw new RuntimeException("Failed to test value presence", ex);
}
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:9,代码来源:CLDenseDoubleMatrix2D.java
示例18: clear
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
@Override
public void clear() {
try {
impl.clear();
} catch (CLBuildException ex) {
throw new RuntimeException("Failed to clear matrix", ex);
}
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:9,代码来源:CLDenseDoubleMatrix2D.java
示例19: containsFloat
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
@Override
public boolean containsFloat(float v) {
try {
return impl.containsValue((float)v);
} catch (CLBuildException ex) {
throw new RuntimeException("Failed to test value presence", ex);
}
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:9,代码来源:CLDenseFloatMatrix2D.java
示例20: matrixMultiply
import com.nativelibs4java.opencl.CLBuildException; //导入依赖的package包/类
public static <T> void matrixMultiply(
final CLMatrix2D<T> a,
final CLMatrix2D<T> b,
final CLMatrix2D<T> out)
throws CLBuildException
{
final CLKernels kernels = a.getKernels();
final Primitive primitive = a.getPrimitive();
a.getEvents().performRead(new CLEvents.Action() {
public CLEvent perform(final CLEvent[] aevents) {
return b.getEvents().performRead(new CLEvents.Action() {
public CLEvent perform(final CLEvent[] bevents) {
return out.getEvents().performWrite(new CLEvents.Action() {
public CLEvent perform(final CLEvent[] cevents) {
CLEvent evt = kernels.matrixMultiply(
primitive,
a.getBuffer(), a.getRowCount(), a.getColumnCount(), a.getStride(), a.getBlockSize(),
b.getBuffer(), b.getRowCount(), b.getColumnCount(), b.getStride(), b.getBlockSize(),
out.getBuffer(),
join(aevents, bevents, cevents)
);
return evt;
}
});
}
});
}
});
}
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:30,代码来源:CLMatrixUtils.java
注:本文中的com.nativelibs4java.opencl.CLBuildException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论