com.intel.gkl.compression.IntelDeflaterFactory Java Examples

The following examples show how to use com.intel.gkl.compression.IntelDeflaterFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SortedSAMWriter.java    From abra2 with MIT License 5 votes vote down vote up
public SortedSAMWriter(String[] outputFiles, String tempDir, SAMFileHeader[] samHeaders,
		boolean isKeepTmp, ChromosomeChunker chromosomeChunker, int finalCompressionLevel,
		boolean shouldSort, int genomicRangeToCache, boolean shouldUnsetDuplicates,
		boolean shouldCreateIndex, boolean shouldUseGkl, int maxReadsInRam) {

	this.samHeaders = samHeaders;
	this.outputFiles = outputFiles;
	this.tempDir = tempDir;
	this.isKeepTmp = isKeepTmp;
	this.chromosomeChunker = chromosomeChunker;
	this.finalCompressionLevel = finalCompressionLevel;
	this.shouldSort = shouldSort;
	this.genomicRangeToCache = genomicRangeToCache;
	this.shouldUnsetDuplicates = shouldUnsetDuplicates;
	this.shouldCreateIndex = shouldCreateIndex;

	this.maxRecordsInRam = maxReadsInRam;

	if (shouldUseGkl) {
		writerFactory.setUseAsyncIo(false);
		IntelDeflaterFactory intelDeflater = new IntelDeflaterFactory();
		writerFactory.setDeflaterFactory(intelDeflater);
		
		Logger.info("Using intel deflator: " + intelDeflater.usingIntelDeflater());
	} else {
		Logger.info("Intel deflater disabled");
	}
	
	writers = new SAMFileWriter[outputFiles.length][];
	
	for (int i=0; i<writers.length; i++) {
		writers[i] = new SAMFileWriter[chromosomeChunker.getChunks().size()+1];
	}
}
 
Example #2
Source File: CommandLineProgram.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Output a curated set of important settings to the logger.
 *
 * May be overridden by subclasses to specify a different set of settings to output.
 */
protected void printSettings() {
    if ( VERBOSITY != Log.LogLevel.DEBUG ) {
        logger.info("HTSJDK Defaults.COMPRESSION_LEVEL : " + Defaults.COMPRESSION_LEVEL);
        logger.info("HTSJDK Defaults.USE_ASYNC_IO_READ_FOR_SAMTOOLS : " + Defaults.USE_ASYNC_IO_READ_FOR_SAMTOOLS);
        logger.info("HTSJDK Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS : " + Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS);
        logger.info("HTSJDK Defaults.USE_ASYNC_IO_WRITE_FOR_TRIBBLE : " + Defaults.USE_ASYNC_IO_WRITE_FOR_TRIBBLE);
    }
    else {
        // At DEBUG verbosity, print all the HTSJDK defaults:
        Defaults.allDefaults()
                .forEach((key, value) -> logger.info("HTSJDK " + Defaults.class.getSimpleName() + "." + key + " : " + value));
    }

    // Log the configuration options:
    ConfigFactory.logConfigFields(ConfigFactory.getInstance().getGATKConfig(), Log.LogLevel.DEBUG);

    final boolean usingIntelDeflater = (BlockCompressedOutputStream.getDefaultDeflaterFactory() instanceof IntelDeflaterFactory && ((IntelDeflaterFactory)BlockCompressedOutputStream.getDefaultDeflaterFactory()).usingIntelDeflater());
    logger.info("Deflater: " + (usingIntelDeflater ? "IntelDeflater": "JdkDeflater"));
    final boolean usingIntelInflater = (BlockGunzipper.getDefaultInflaterFactory() instanceof IntelInflaterFactory && ((IntelInflaterFactory)BlockGunzipper.getDefaultInflaterFactory()).usingIntelInflater());
    logger.info("Inflater: " + (usingIntelInflater ? "IntelInflater": "JdkInflater"));

    logger.info("GCS max retries/reopens: " + BucketUtils.getCloudStorageConfiguration(NIO_MAX_REOPENS, "").maxChannelReopens());
    if (Strings.isNullOrEmpty(NIO_PROJECT_FOR_REQUESTER_PAYS)) {
        logger.info("Requester pays: disabled");
    } else {
        logger.info("Requester pays: enabled. Billed to: " + NIO_PROJECT_FOR_REQUESTER_PAYS);
    }
}
 
Example #3
Source File: IntelGKLAccessor.java    From Hadoop-BAM with MIT License 4 votes vote down vote up
static DeflaterFactory newDeflaterFactory() {
  return new IntelDeflaterFactory();
}
 
Example #4
Source File: IntelInflaterDeflaterIntegrationTest.java    From gatk with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Test
public void deflateInflateWithIntel() throws DataFormatException {
    if (!isIntelInflaterDeflaterSupported()) {
        throw new SkipException("IntelInflater/IntelDeflater not available on this platform");
    }

    // create buffers and random input
    final int LEN = 64 * 1024;
    final byte[] input = new RandomDNA().nextBases(LEN);
    final byte[] compressed = new byte[2 * LEN];
    final byte[] result = new byte[LEN];

    final IntelInflaterFactory intelInflaterFactory = new IntelInflaterFactory();
    final IntelDeflaterFactory intelDeflaterFactory = new IntelDeflaterFactory();
    Assert.assertTrue(intelInflaterFactory.usingIntelInflater());
    Assert.assertTrue(intelDeflaterFactory.usingIntelDeflater());

    for (int i = 0; i < 10; i++) {
        // create deflater with compression level i
        final Deflater deflater = intelDeflaterFactory.makeDeflater(i, true);

        // setup deflater
        deflater.setInput(input);
        deflater.finish();

        // compress data
        int compressedBytes = 0;

        // buffer for compressed data is 2x the size of the data we are compressing
        // so this loop should always finish in one iteration
        while (!deflater.finished()) {
            compressedBytes = deflater.deflate(compressed, 0, compressed.length);
        }
        deflater.end();

        // decompress and check output == input
        Inflater inflater = intelInflaterFactory.makeInflater(true);

        inflater.setInput(compressed, 0, compressedBytes);
        inflater.inflate(result);
        inflater.end();

        Assert.assertEquals(input, result);

        // clear compressed and result buffers for next iteration
        Arrays.fill(compressed, (byte)0);
        Arrays.fill(result, (byte)0);
    }
}