• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ConcurrencyUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ddxt2d0_subth

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
private void ddxt2d0_subth(final int isgn, final double[][] a, final boolean scale) {
    final int nthreads = ConcurrencyUtils.getNumberOfThreads() > rows ? rows : ConcurrencyUtils.getNumberOfThreads();

    Future<?>[] futures = new Future[nthreads];

    for (int i = 0; i < nthreads; i++) {
        final int n0 = i;
        futures[i] = ConcurrencyUtils.submit(new Runnable() {

            @Override
public void run() {
                if (isgn == -1) {
                    for (int r = n0; r < rows; r += nthreads) {
                        dctColumns.forward(a[r], scale);
                    }
                } else {
                    for (int r = n0; r < rows; r += nthreads) {
                        dctColumns.inverse(a[r], scale);
                    }
                }
            }
        });
    }
    ConcurrencyUtils.waitForCompletion(futures);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:26,代码来源:DoubleDCT_2D.java


示例2: FloatDCT_1D

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
/**
 * Creates new instance of FloatDCT_1D.
 * 
 * @param n
 *            size of data
 */
public FloatDCT_1D(int n) {
    if (n < 1) {
        throw new IllegalArgumentException("n must be greater than 0");
    }
    this.n = n;
    if (ConcurrencyUtils.isPowerOf2(n)) {
        this.isPowerOfTwo = true;
        this.ip = new int[(int) Math.ceil(2 + (1 << (int) (Math.log(n / 2 + 0.5) / Math.log(2)) / 2))];
        this.w = new float[n * 5 / 4];
        nw = ip[0];
        if (n > (nw << 2)) {
            nw = n >> 2;
            makewt(nw);
        }
        nc = ip[1];
        if (n > nc) {
            nc = n;
            makect(nc, w, nw);
        }
    } else {
        this.w = makect(n);
        fft = new FloatFFT_1D(2 * n);
    }
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:31,代码来源:FloatDCT_1D.java


示例3: ddxt2d0_subth

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
private void ddxt2d0_subth(final int isgn, final double[][] a, final boolean scale) {
    final int nthreads = ConcurrencyUtils.getNumberOfThreads() > rows ? rows : ConcurrencyUtils.getNumberOfThreads();

    Future<?>[] futures = new Future[nthreads];

    for (int i = 0; i < nthreads; i++) {
        final int n0 = i;
        futures[i] = ConcurrencyUtils.submit(new Runnable() {

            @Override
public void run() {
                if (isgn == -1) {
                    for (int r = n0; r < rows; r += nthreads) {
                        dstColumns.forward(a[r], scale);
                    }
                } else {
                    for (int r = n0; r < rows; r += nthreads) {
                        dstColumns.inverse(a[r], scale);
                    }
                }
            }
        });
    }
    ConcurrencyUtils.waitForCompletion(futures);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:26,代码来源:DoubleDST_2D.java


示例4: ddxt2d0_subth

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
private void ddxt2d0_subth(final int isgn, final float[] a, final boolean scale) {
    final int nthreads = ConcurrencyUtils.getNumberOfThreads() > rows ? rows : ConcurrencyUtils.getNumberOfThreads();

    Future<?>[] futures = new Future[nthreads];

    for (int i = 0; i < nthreads; i++) {
        final int n0 = i;
        futures[i] = ConcurrencyUtils.submit(new Runnable() {

            @Override
public void run() {
                if (isgn == -1) {
                    for (int r = n0; r < rows; r += nthreads) {
                        dstColumns.forward(a, r * columns, scale);
                    }
                } else {
                    for (int r = n0; r < rows; r += nthreads) {
                        dstColumns.inverse(a, r * columns, scale);
                    }
                }
            }
        });
    }
    ConcurrencyUtils.waitForCompletion(futures);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:26,代码来源:FloatDST_2D.java


示例5: ddxt2d0_subth

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
private void ddxt2d0_subth(final int isgn, final float[][] a, final boolean scale) {
    final int nthreads = ConcurrencyUtils.getNumberOfThreads() > rows ? rows : ConcurrencyUtils.getNumberOfThreads();

    Future<?>[] futures = new Future[nthreads];

    for (int i = 0; i < nthreads; i++) {
        final int n0 = i;
        futures[i] = ConcurrencyUtils.submit(new Runnable() {

            @Override
public void run() {
                if (isgn == -1) {
                    for (int r = n0; r < rows; r += nthreads) {
                        dhtColumns.forward(a[r]);
                    }
                } else {
                    for (int r = n0; r < rows; r += nthreads) {
                        dhtColumns.inverse(a[r], scale);
                    }
                }
            }
        });
    }
    ConcurrencyUtils.waitForCompletion(futures);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:26,代码来源:FloatDHT_2D.java


示例6: DoubleDCT_1D

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
/**
 * Creates new instance of DoubleDCT_1D.
 * 
 * @param n
 *            size of data
 */
public DoubleDCT_1D(int n) {
    if (n < 1) {
        throw new IllegalArgumentException("n must be greater than 0");
    }
    this.n = n;
    if (ConcurrencyUtils.isPowerOf2(n)) {
        this.isPowerOfTwo = true;
        this.ip = new int[(int) Math.ceil(2 + (1 << (int) (Math.log(n / 2 + 0.5) / Math.log(2)) / 2))];
        this.w = new double[n * 5 / 4];
        nw = ip[0];
        if (n > (nw << 2)) {
            nw = n >> 2;
            makewt(nw);
        }
        nc = ip[1];
        if (n > nc) {
            nc = n;
            makect(nc, w, nw);
        }
    } else {
        this.w = makect(n);
        fft = new DoubleFFT_1D(2 * n);
    }
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:31,代码来源:DoubleDCT_1D.java


示例7: runAll

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
public void runAll() throws Exception {
	List<AbstractMatrix2DBenchmark> benchmarks = getDenseBenchmarks();

	UJMPSettings.getInstance().setNumberOfThreads(getConfig().getNumberOfThreads());
	ConcurrencyUtils.setNumberOfThreads(getConfig().getNumberOfThreads());
	System.setProperty("ATLAS_NUM_THREADS", "" + getConfig().getNumberOfThreads());

	if (getConfig().isShuffle()) {
		Collections.shuffle(benchmarks);
	}
	if (getConfig().isReverse()) {
		Collections.reverse(benchmarks);
	}

	long t0 = System.currentTimeMillis();

	for (int j = 0; j < benchmarks.size(); j++) {
		AbstractMatrix2DBenchmark benchmark = benchmarks.get(j);
		benchmark.run();
	}

	long t1 = System.currentTimeMillis();

	System.out.println();
	System.out.println("Finished.");
	System.out.println("Total Time: " + StringUtil.duration(t1 - t0));
	System.out.println();
	System.out.println();
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:30,代码来源:CompleteMatrixBenchmark.java


示例8: initCheck

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
public static void initCheck(Frame input, int width, int height, int depth) {
  ConcurrencyUtils.setNumberOfThreads(1);
  if (width < 1 || height < 1 || depth < 1)
    throw new H2OIllegalArgumentException("dimensions must be >= 1");
  if (width*height*depth != input.numCols())
    throw new H2OIllegalArgumentException("dimensions HxWxD must match the # columns of the frame");
  for (Vec v : input.vecs()) {
    if (v.naCnt() > 0)
      throw new H2OIllegalArgumentException("DCT can not be computed on rows with missing values");
    if (!v.isNumeric())
      throw new H2OIllegalArgumentException("DCT can only be computed on numeric columns");
  }
}
 
开发者ID:kyoren,项目名称:https-github.com-h2oai-h2o-3,代码行数:14,代码来源:MathUtils.java


示例9: FloatDCT_2D

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
/**
 * Creates new instance of FloatDCT_2D.
 * 
 * @param rows
 *            number of rows
 * @param columns
 *            number of columns
 */
public FloatDCT_2D(int rows, int columns) {
    if (rows <= 1 || columns <= 1) {
        throw new IllegalArgumentException("rows and columns must be greater than 1");
    }
    this.rows = rows;
    this.columns = columns;
    if (rows * columns >= ConcurrencyUtils.getThreadsBeginN_2D()) {
        this.useThreads = true;
    }
    if (ConcurrencyUtils.isPowerOf2(rows) && ConcurrencyUtils.isPowerOf2(columns)) {
        isPowerOfTwo = true;
        oldNthreads = ConcurrencyUtils.getNumberOfThreads();
        nt = 4 * oldNthreads * rows;
        if (columns == 2 * oldNthreads) {
            nt >>= 1;
        } else if (columns < 2 * oldNthreads) {
            nt >>= 2;
        }
        t = new float[nt];
    }
    dctColumns = new FloatDCT_1D(columns);
    if (columns == rows) {
        dctRows = dctColumns;
    } else {
        dctRows = new FloatDCT_1D(rows);
    }
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:36,代码来源:FloatDCT_2D.java


示例10: realForwardFull

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
/**
 * Computes 2D forward DFT of real data leaving the result in <code>a</code>
 * . This method computes full real forward transform, i.e. you will get the
 * same result as from <code>complexForward</code> called with all imaginary
 * part equal 0. Because the result is stored in <code>a</code>, the input
 * array must be of size rows*2*columns, with only the first rows*columns
 * elements filled with real data. To get back the original data, use
 * <code>complexInverse</code> on the output of this method.
 * 
 * @param a
 *            data to transform
 */
public void realForwardFull(float[] a) {
    if (isPowerOfTwo) {
        int nthreads;

        nthreads = ConcurrencyUtils.getNumberOfThreads();
        if (nthreads != oldNthreads) {
            nt = 8 * nthreads * rows;
            if (columns == 4 * nthreads) {
                nt >>= 1;
            } else if (columns < 4 * nthreads) {
                nt >>= 2;
            }
            t = new float[nt];
            oldNthreads = nthreads;
        }
        if ((nthreads > 1) && useThreads) {
            xdft2d0_subth1(1, 1, a, true);
            cdft2d_subth(-1, a, true);
            rdft2d_sub(1, a);
        } else {
            for (int r = 0; r < rows; r++) {
                fftColumns.realForward(a, r * columns);
            }
            cdft2d_sub(-1, a, true);
            rdft2d_sub(1, a);
        }
        fillSymmetric(a);
    } else {
        mixedRadixRealForwardFull(a);
    }
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:44,代码来源:FloatFFT_2D.java


示例11: createEqualityChecker

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
public FloatingPointEqualityChecker createEqualityChecker(final float rel,
		final float abs)
{
	final String msg = String.format(DEFAULT_MESSAGE,
			ConcurrencyUtils.getNumberOfThreads(), numRows, numCols);
	return new FloatingPointEqualityChecker(msg, 0d, 0d, rel, abs);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:8,代码来源:FloatFFT_2DTest.java


示例12: realInverseFull

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
/**
 * Computes 2D inverse DFT of real data leaving the result in <code>a</code>
 * . This method computes full real inverse transform, i.e. you will get the
 * same result as from <code>complexInverse</code> called with all imaginary
 * part equal 0. Because the result is stored in <code>a</code>, the input
 * array must be of size rows*2*columns, with only the first rows*columns
 * elements filled with real data.
 * 
 * @param a
 *            data to transform
 * 
 * @param scale
 *            if true then scaling is performed
 */
public void realInverseFull(float[] a, boolean scale) {
    if (isPowerOfTwo) {
        int nthreads;

        nthreads = ConcurrencyUtils.getNumberOfThreads();
        if (nthreads != oldNthreads) {
            nt = 8 * nthreads * rows;
            if (columns == 4 * nthreads) {
                nt >>= 1;
            } else if (columns < 4 * nthreads) {
                nt >>= 2;
            }
            t = new float[nt];
            oldNthreads = nthreads;
        }
        if ((nthreads > 1) && useThreads) {
            xdft2d0_subth2(1, -1, a, scale);
            cdft2d_subth(1, a, scale);
            rdft2d_sub(1, a);
        } else {
            for (int r = 0; r < rows; r++) {
                fftColumns.realInverse2(a, r * columns, scale);
            }
            cdft2d_sub(1, a, scale);
            rdft2d_sub(1, a);
        }
        fillSymmetric(a);
    } else {
        mixedRadixRealInverseFull(a, scale);
    }
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:46,代码来源:FloatFFT_2D.java


示例13: xdft2d0_subth1

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
private void xdft2d0_subth1(final int icr, final int isgn, final float[] a, final boolean scale) {
    final int nthreads = ConcurrencyUtils.getNumberOfThreads() > rows ? rows : ConcurrencyUtils.getNumberOfThreads();

    Future<?>[] futures = new Future[nthreads];
    for (int i = 0; i < nthreads; i++) {
        final int n0 = i;
        futures[i] = ConcurrencyUtils.submit(new Runnable() {
            @Override
public void run() {
                if (icr == 0) {
                    if (isgn == -1) {
                        for (int r = n0; r < rows; r += nthreads) {
                            fftColumns.complexForward(a, r * columns);
                        }
                    } else {
                        for (int r = n0; r < rows; r += nthreads) {
                            fftColumns.complexInverse(a, r * columns, scale);
                        }
                    }
                } else {
                    if (isgn == 1) {
                        for (int r = n0; r < rows; r += nthreads) {
                            fftColumns.realForward(a, r * columns);
                        }
                    } else {
                        for (int r = n0; r < rows; r += nthreads) {
                            fftColumns.realInverse(a, r * columns, scale);
                        }
                    }
                }
            }
        });
    }
    ConcurrencyUtils.waitForCompletion(futures);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:36,代码来源:FloatFFT_2D.java


示例14: createEqualityChecker

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
public FloatingPointEqualityChecker createEqualityChecker(final double rel,
		final double abs)
{
	final String msg = String.format(DEFAULT_MESSAGE,
			ConcurrencyUtils.getNumberOfThreads(), numRows, numCols);
	return new FloatingPointEqualityChecker(msg, rel, abs, 0f, 0f);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:8,代码来源:DoubleFFT_2DTest.java


示例15: xdft2d0_subth2

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
private void xdft2d0_subth2(final int icr, final int isgn, final float[][] a, final boolean scale) {
    final int nthreads = ConcurrencyUtils.getNumberOfThreads() > rows ? rows : ConcurrencyUtils.getNumberOfThreads();

    Future<?>[] futures = new Future[nthreads];
    for (int i = 0; i < nthreads; i++) {
        final int n0 = i;
        futures[i] = ConcurrencyUtils.submit(new Runnable() {
            @Override
public void run() {
                if (icr == 0) {
                    if (isgn == -1) {
                        for (int r = n0; r < rows; r += nthreads) {
                            fftColumns.complexForward(a[r]);
                        }
                    } else {
                        for (int r = n0; r < rows; r += nthreads) {
                            fftColumns.complexInverse(a[r], scale);
                        }
                    }
                } else {
                    if (isgn == 1) {
                        for (int r = n0; r < rows; r += nthreads) {
                            fftColumns.realForward(a[r]);
                        }
                    } else {
                        for (int r = n0; r < rows; r += nthreads) {
                            fftColumns.realInverse2(a[r], 0, scale);
                        }
                    }
                }
            }
        });
    }
    ConcurrencyUtils.waitForCompletion(futures);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:36,代码来源:FloatFFT_2D.java


示例16: realForwardFull

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
/**
 * Computes 3D forward DFT of real data leaving the result in <code>a</code>
 * . This method computes full real forward transform, i.e. you will get the
 * same result as from <code>complexForward</code> called with all imaginary
 * part equal 0. Because the result is stored in <code>a</code>, the input
 * array must be of size slices*rows*2*columns, with only the first slices*rows*columns elements
 * filled with real data. To get back the original data, use
 * <code>complexInverse</code> on the output of this method.
 * 
 * @param a
 *            data to transform
 */
public void realForwardFull(double[] a) {
    if (isPowerOfTwo) {
        int nthreads = ConcurrencyUtils.getNumberOfThreads();
        if (nthreads != oldNthreads) {
            nt = slices;
            if (nt < rows) {
                nt = rows;
            }
            nt *= 8;
            if (nthreads > 1) {
                nt *= nthreads;
            }
            if (columns == 4) {
                nt >>= 1;
            } else if (columns < 4) {
                nt >>= 2;
            }
            t = new double[nt];
            oldNthreads = nthreads;
        }
        if ((nthreads > 1) && useThreads) {
            xdft3da_subth2(1, -1, a, true);
            cdft3db_subth(-1, a, true);
            rdft3d_sub(1, a);
        } else {
            xdft3da_sub2(1, -1, a, true);
            cdft3db_sub(-1, a, true);
            rdft3d_sub(1, a);
        }
        fillSymmetric(a);
    } else {
        mixedRadixRealForwardFull(a);
    }
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:47,代码来源:DoubleFFT_3D.java


示例17: benchmarkForward_3D_input_1D

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
public static void benchmarkForward_3D_input_1D() {
	final double[] times = new double[nsize];
	float[] x;
	for (int i = 0; i < nsize; i++) {
		System.out.println("Forward DHT 3D (input 1D) of size " + sizes3D[i] + " x " + sizes3D[i] + " x "
				+ sizes3D[i]);
		FloatDHT_3D dht3 = new FloatDHT_3D(sizes3D[i], sizes3D[i], sizes3D[i]);
		x = new float[sizes3D[i] * sizes3D[i] * sizes3D[i]];
		if (doWarmup) { // call the transform twice to warm up
			IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], sizes3D[i], x);
			dht3.forward(x);
			IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], sizes3D[i], x);
			dht3.forward(x);
		}
		float av_time = 0;
		long elapsedTime = 0;
		for (int j = 0; j < niter; j++) {
			IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], sizes3D[i], x);
			elapsedTime = System.nanoTime();
			dht3.forward(x);
			elapsedTime = System.nanoTime() - elapsedTime;
			av_time = av_time + elapsedTime;
		}
		times[i] = av_time / 1000000.0 / niter;
		System.out.println("Average execution time: " + String.format("%.2f", av_time / 1000000.0 / niter) + " msec");
		x = null;
		dht3 = null;
		System.gc();
		ConcurrencyUtils.sleep(5000);
	}
	IOUtils.writeFFTBenchmarkResultsToFile("benchmarkFloatForwardDHT_3D_input_1D.txt", nthread, niter, doWarmup,
			doScaling, sizes3D, times);

}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:35,代码来源:BenchmarkFloatDHT.java


示例18: realInverseFull

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
/**
 * Computes 3D inverse DFT of real data leaving the result in <code>a</code>
 * . This method computes full real inverse transform, i.e. you will get the
 * same result as from <code>complexInverse</code> called with all imaginary
 * part equal 0. Because the result is stored in <code>a</code>, the input
 * array must be of size slices*rows*2*columns, with only the first slices*rows*columns elements
 * filled with real data.
 * 
 * @param a
 *            data to transform
 * @param scale
 *            if true then scaling is performed
 */
public void realInverseFull(double[] a, boolean scale) {
    if (isPowerOfTwo) {
        int nthreads = ConcurrencyUtils.getNumberOfThreads();
        if (nthreads != oldNthreads) {
            nt = slices;
            if (nt < rows) {
                nt = rows;
            }
            nt *= 8;
            if (nthreads > 1) {
                nt *= nthreads;
            }
            if (columns == 4) {
                nt >>= 1;
            } else if (columns < 4) {
                nt >>= 2;
            }
            t = new double[nt];
            oldNthreads = nthreads;
        }
        if ((nthreads > 1) && useThreads) {
            xdft3da_subth2(1, 1, a, scale);
            cdft3db_subth(1, a, scale);
            rdft3d_sub(1, a);
        } else {
            xdft3da_sub2(1, 1, a, scale);
            cdft3db_sub(1, a, scale);
            rdft3d_sub(1, a);
        }
        fillSymmetric(a);
    } else {
        mixedRadixRealInverseFull(a, scale);
    }
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:48,代码来源:DoubleFFT_3D.java


示例19: parseArguments

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
public static void parseArguments(String[] args) {
	if (args.length > 0) {
		nthread = Integer.parseInt(args[0]);
		threadsBegin2D = Integer.parseInt(args[1]);
		threadsBegin3D = Integer.parseInt(args[2]);
		niter = Integer.parseInt(args[3]);
		doWarmup = Boolean.parseBoolean(args[4]);
		doScaling = Boolean.parseBoolean(args[5]);
		nsize = Integer.parseInt(args[6]);
		sizes1D = new int[nsize];
		sizes2D = new int[nsize];
		sizes3D = new int[nsize];
		for (int i = 0; i < nsize; i++) {
			sizes1D[i] = Integer.parseInt(args[7 + i]);
		}
		for (int i = 0; i < nsize; i++) {
			sizes2D[i] = Integer.parseInt(args[7 + nsize + i]);
		}
		for (int i = 0; i < nsize; i++) {
			sizes3D[i] = Integer.parseInt(args[7 + nsize + nsize + i]);
		}
	} else {
		System.out.println("Default settings are used.");
	}
	ConcurrencyUtils.setNumberOfThreads(nthread);
	ConcurrencyUtils.setThreadsBeginN_2D(threadsBegin2D);
	ConcurrencyUtils.setThreadsBeginN_3D(threadsBegin3D);
	System.out.println("nthred = " + nthread);
	System.out.println("threadsBegin2D = " + threadsBegin2D);
	System.out.println("threadsBegin3D = " + threadsBegin3D);
	System.out.println("niter = " + niter);
	System.out.println("doWarmup = " + doWarmup);
	System.out.println("doScaling = " + doScaling);
	System.out.println("nsize = " + nsize);
	System.out.println("sizes1D[] = " + Arrays.toString(sizes1D));
	System.out.println("sizes2D[] = " + Arrays.toString(sizes2D));
	System.out.println("sizes3D[] = " + Arrays.toString(sizes3D));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:39,代码来源:BenchmarkFloatDHT.java


示例20: benchmarkComplexForward_1D

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入依赖的package包/类
public static void benchmarkComplexForward_1D() {
	float[] x;
	final double[] times = new double[nsize];
	for (int i = 0; i < nsize; i++) {
		System.out.println("Complex forward FFT 1D of size " + sizes1D[i]);
		FloatFFT_1D fft = new FloatFFT_1D(sizes1D[i]);
		x = new float[2 * sizes1D[i]];
		if (doWarmup) { // call the transform twice to warm up
			IOUtils.fillMatrix_1D(2 * sizes1D[i], x);
			fft.complexForward(x);
			IOUtils.fillMatrix_1D(2 * sizes1D[i], x);
			fft.complexForward(x);
		}
		float av_time = 0;
		long elapsedTime = 0;
		for (int j = 0; j < niter; j++) {
			IOUtils.fillMatrix_1D(2 * sizes1D[i], x);
			elapsedTime = System.nanoTime();
			fft.complexForward(x);
			elapsedTime = System.nanoTime() - elapsedTime;
			av_time = av_time + elapsedTime;
		}
		times[i] = av_time / 1000000.0 / niter;
		System.out.println("\tAverage execution time: " + String.format("%.2f", av_time / 1000000.0 / niter)
				+ " msec");
		x = null;
		fft = null;
		System.gc();
		ConcurrencyUtils.sleep(5000);
	}
	IOUtils.writeFFTBenchmarkResultsToFile("benchmarkFloatComplexForwardFFT_1D.txt", nthread, niter, doWarmup,
			doScaling, sizes1D, times);

}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:35,代码来源:BenchmarkFloatFFT.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConfigurationProviderFactory类代码示例发布时间:2022-05-23
下一篇:
Java ModifierKey类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap