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


Java ConcurrencyUtils.setNumberOfThreads方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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[3]);
		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,代码来源:BenchmarkFloatFFT.java

示例4: 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,代码来源:BenchmarkDoubleFFT.java

示例5: DoubleFFT_2DTest

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入方法依赖的package包/类
/**
 * Creates a new instance of this test.
 *
 * @param numRows
 *            number of rows
 * @param numColumns
 *            number of columns
 * @param numThreads
 *            the number of threads to be used
 * @param seed
 *            the seed of the random generator
 */
public DoubleFFT_2DTest(final int numRows, final int numColumns,
		final int numThreads, final long seed)
{
	this.numRows = numRows;
	this.numCols = numColumns;
	this.rfft = new DoubleFFT_1D(numColumns);
	this.cfft = new DoubleFFT_1D(numRows);
	this.fft = new DoubleFFT_2D(numRows, numColumns);
	this.random = new Random(seed);
	ConcurrencyUtils.setNumberOfThreads(numThreads);
	ConcurrencyUtils.setThreadsBeginN_2D(4);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:25,代码来源:DoubleFFT_2DTest.java

示例6: FloatFFT_2DTest

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入方法依赖的package包/类
/**
 * Creates a new instance of this test.
 *
 * @param numRows
 *            number of rows
 * @param numColumns
 *            number of columns
 * @param numThreads
 *            the number of threads to be used
 * @param seed
 *            the seed of the random generator
 */
public FloatFFT_2DTest(final int numRows, final int numColumns,
		final int numThreads, final long seed)
{
	this.numRows = numRows;
	this.numCols = numColumns;
	this.rfft = new FloatFFT_1D(numColumns);
	this.cfft = new FloatFFT_1D(numRows);
	this.fft = new FloatFFT_2D(numRows, numColumns);
	this.random = new Random(seed);
	ConcurrencyUtils.setNumberOfThreads(numThreads);
	ConcurrencyUtils.setThreadsBeginN_2D(4);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:25,代码来源:FloatFFT_2DTest.java

示例7: setThreadNumber

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入方法依赖的package包/类
@Override
public void setThreadNumber(int number) {
	ConcurrencyUtils.setNumberOfThreads(number);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:5,代码来源:JTransformsFFTVolumeHandle.java

示例8: DoubleFFT_3DTest

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入方法依赖的package包/类
/**
 * Creates a new instance of this test.
 *
 * @param numSlices
 *            number of slices
 * @param numRows
 *            number of rows
 * @param numColumns
 *            number of columns
 * @param numThreads
 *            the number of threads to be used
 * @param seed
 *            the seed of the random generator
 */
public DoubleFFT_3DTest(final int numSlices, final int numRows,
		final int numColumns, final int numThreads, final long seed)
{
	this.numSlices = numSlices;
	this.numRows = numRows;
	this.numCols = numColumns;
	this.fft = new DoubleFFT_3D(numSlices, numRows, numColumns);
	this.xfft = new DoubleFFT_1D(numSlices);
	this.sfft = new DoubleFFT_2D(numRows, numColumns);
	this.random = new Random(seed);
	ConcurrencyUtils.setNumberOfThreads(numThreads);
	ConcurrencyUtils.setThreadsBeginN_3D(4);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:DoubleFFT_3DTest.java

示例9: FloatFFT_1DTest

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入方法依赖的package包/类
/**
 * Creates a new instance of this class.
 *
 * @param n
 *            the size of the FFT to be tested
 * @param numThreads
 *            the number of threads
 * @param seed
 *            the seed of the random generator
 */
public FloatFFT_1DTest(final int n, final int numThreads, final long seed) {
	this.n = n;
	this.fft = new FloatFFT_1D(n);
	this.random = new Random(seed);
	ConcurrencyUtils.setThreadsBeginN_1D_FFT_2Threads(512);
	ConcurrencyUtils.setThreadsBeginN_1D_FFT_4Threads(512);
	ConcurrencyUtils.setNumberOfThreads(numThreads);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:19,代码来源:FloatFFT_1DTest.java

示例10: DoubleFFT_1DTest

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入方法依赖的package包/类
/**
 * Creates a new instance of this class.
 *
 * @param n
 *            the size of the FFT to be tested
 * @param numThreads
 *            the number of threads
 * @param seed
 *            the seed of the random generator
 */
public DoubleFFT_1DTest(final int n, final int numThreads, final long seed) {
	this.n = n;
	this.fft = new DoubleFFT_1D(n);
	this.random = new Random(seed);
	ConcurrencyUtils.setThreadsBeginN_1D_FFT_2Threads(512);
	ConcurrencyUtils.setThreadsBeginN_1D_FFT_4Threads(512);
	ConcurrencyUtils.setNumberOfThreads(numThreads);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:19,代码来源:DoubleFFT_1DTest.java

示例11: FloatFFT_3DTest

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入方法依赖的package包/类
/**
 * Creates a new instance of this test.
 *
 * @param numSlices
 *            number of slices
 * @param numRows
 *            number of rows
 * @param numColumns
 *            number of columns
 * @param numThreads
 *            the number of threads to be used
 * @param seed
 *            the seed of the random generator
 */
public FloatFFT_3DTest(final int numSlices, final int numRows,
		final int numColumns, final int numThreads, final long seed)
{
	this.numSlices = numSlices;
	this.numRows = numRows;
	this.numCols = numColumns;
	this.fft = new FloatFFT_3D(numSlices, numRows, numColumns);
	this.xfft = new FloatFFT_1D(numSlices);
	this.sfft = new FloatFFT_2D(numRows, numColumns);
	this.random = new Random(seed);
	ConcurrencyUtils.setNumberOfThreads(numThreads);
	ConcurrencyUtils.setThreadsBeginN_3D(4);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:FloatFFT_3DTest.java

示例12: RealFFTUtils_2DTest

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入方法依赖的package包/类
/**
 * Creates a new instance of this test.
 *
 * @param rows
 *            number of rows
 * @param columns
 *            number of columns
 * @param numThreads
 *            the number of threads to be used
 * @param seed
 *            the seed of the random generator
 */
public RealFFTUtils_2DTest(final int rows, final int columns,
		final int numThreads, final long seed)
{
	this.rows = rows;
	this.columns = columns;
	this.fft2d = new DoubleFFT_2D(rows, columns);
	this.fft2f = new FloatFFT_2D(rows, columns);
	this.random = new Random(seed);
	this.unpacker = new RealFFTUtils_2D(rows, columns);
	ConcurrencyUtils.setNumberOfThreads(numThreads);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:24,代码来源:RealFFTUtils_2DTest.java

示例13: RealFFTUtils_3DTest

import edu.emory.mathcs.utils.ConcurrencyUtils; //导入方法依赖的package包/类
/**
 * Creates a new instance of this test.
 *
 * @param slices
 *            number of slices
 * @param rows
 *            number of rows
 * @param columns
 *            number of columns
 * @param numThreads
 *            the number of threads to be used
 * @param seed
 *            the seed of the random generator
 */
public RealFFTUtils_3DTest(final int slices, final int rows,
		final int columns, final int numThreads, final long seed)
{
	this.slices = slices;
	this.rows = rows;
	this.columns = columns;
	this.fft3d = new DoubleFFT_3D(slices, rows, columns);
	this.fft3f = new FloatFFT_3D(slices, rows, columns);
	this.random = new Random(seed);
	this.unpacker = new RealFFTUtils_3D(slices, rows, columns);
	ConcurrencyUtils.setNumberOfThreads(numThreads);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:27,代码来源:RealFFTUtils_3DTest.java


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