/**
* 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);
}
}
static InflaterFactory newInflatorFactor() {
return new IntelInflaterFactory();
}
@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);
}
}