public TestBlockDenseDoubleMatrix2D() { UJMPSettings.getInstance().setNumberOfThreads(1); }
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(); }
/** * Create a new matrix with the specified size, and specified block stripe * size. * * @param rows * - number of rows of the matrix. * @param cols * - number of columns of the matrix. * @param blockStripeSize * - length of one side of a square block. * @throws IllegalArgumentException * if rows, cols or blockStripeSize are 0 or less, or blockOrder * is null. */ public BlockDenseDoubleMatrix2D(final int rows, final int cols, final int blockStripeSize, final BlockOrder blockOrder) { super(rows, cols); verifyTrue(rows > 0, "rows<=0"); verifyTrue(cols > 0, "cols<=0"); verifyTrue(blockStripeSize > 0, "blockStripeSize<=0"); verifyTrue(blockOrder != null, "blockOrder == null"); if (UJMPSettings.getInstance().getNumberOfThreads() != 1) { System.err.println("WARNING: setting number of threads to 1 for BlockMatrix"); UJMPSettings.getInstance().setNumberOfThreads(1); } this.size = new long[] { rows, cols }; // layout structure for the blocks in the matrix this.layout = new BlockMatrixLayout(rows, cols, blockStripeSize, blockOrder); this.data = new double[this.layout.numberOfBlocks][]; }