Skip to content

Commit

Permalink
Check that AVX (now required) is present.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardDixon committed Nov 9, 2018
1 parent 82e30b8 commit 73e9efc
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.broadinstitute.hellbender.engine.*;
import org.broadinstitute.hellbender.engine.filters.*;
import org.broadinstitute.hellbender.exceptions.GATKException;
import org.broadinstitute.hellbender.exceptions.UserException;
import org.broadinstitute.hellbender.utils.haplotype.HaplotypeBAMWriter;
import org.broadinstitute.hellbender.utils.io.IOUtils;
import org.broadinstitute.hellbender.utils.io.Resource;
Expand Down Expand Up @@ -110,7 +111,13 @@ public class CNNScoreVariants extends TwoPassVariantWalker {
"1D models will look at the reference sequence and variant annotations." +
"2D models look at aligned reads, reference sequence, and variant annotations." +
"2D models require a BAM file as input as well as the tensor-type argument to be set.";
<<<<<<< 82e30b8f5001000e3f58efb4b3d6c99ca42b185c
static final String AVXREQUIRED_ERROR = "This functionality requires hardware that supports the AVX instruction ste.";
=======
static final String AVXREQUIRED_ERROR = "This tool requires AVX instruction set support by default due to its dependency on recent versions of the TensorFlow library.\n" +
" If you have an older (pre-1.6) version of TensorFlow installed that does not require AVX, you may attempt to re-run the tool with the --disable-avx-check argument to bypass this check.\n" +
" Note that such configurations are not officially supported.";
>>>>>>> Check that AVX (now required) is present.

private static final int CONTIG_INDEX = 0;
private static final int POS_INDEX = 1;
Expand Down Expand Up @@ -143,6 +150,11 @@ public class CNNScoreVariants extends TwoPassVariantWalker {
@Argument(fullName="info-annotation-keys", shortName="info-annotation-keys", doc="The VCF info fields to send to python.", optional=true)
private List<String> annotationKeys = new ArrayList<>(Arrays.asList("MQ", "DP", "SOR", "FS", "QD", "MQRankSum", "ReadPosRankSum"));

@Advanced
@Argument(fullName = "disable-avx-check", shortName = "disable-avx-check", doc = "If set, no check will be made for AVX support. " +
"Use only if you have installed a pre-1.6 TensorFlow build. ", optional = true)
private boolean disableAVXCheck = false;

@Advanced
@Argument(fullName = "inference-batch-size", shortName = "inference-batch-size", doc = "Size of batches for python to do inference on.", minValue = 1, maxValue = 4096, optional = true)
private int inferenceBatchSize = 256;
Expand Down Expand Up @@ -206,12 +218,15 @@ protected String[] customCommandLineValidation() {
}
}

<<<<<<< 82e30b8f5001000e3f58efb4b3d6c99ca42b185c
IntelGKLUtils utils = new IntelGKLUtils();
if (utils.isAvxSupported() == false)
{
return new String[]{CNNScoreVariants.AVXREQUIRED_ERROR};
}

=======
>>>>>>> Check that AVX (now required) is present.
return null;
}

Expand Down Expand Up @@ -242,8 +257,23 @@ public List<ReadFilter> getDefaultReadFilters() {

@Override
public void onTraversalStart() {
<<<<<<< 82e30b8f5001000e3f58efb4b3d6c99ca42b185c
if (getHeaderForVariants().getGenotypeSamples().size() > 1) {
logger.warn("CNNScoreVariants is a single sample tool, but the input VCF has more than 1 sample.");
=======
// Users can disable the AVX check to allow an older version of TF that doesn't require AVX to be used.
if(this.disableAVXCheck == false) {
IntelGKLUtils utils = new IntelGKLUtils();
if (utils.isAvxSupported() == false) {
// Give user the bad news, suggest remedies.
throw new UserException.HardwareFeatureException(CNNScoreVariants.AVXREQUIRED_ERROR);
}

scoreKey = getScoreKeyAndCheckModelAndReadsHarmony();
if (architecture == null && weights == null) {
setArchitectureAndWeightsFromResources();
}
>>>>>>> Check that AVX (now required) is present.
}

// Start the Python process and initialize a stream writer for streaming data to the Python code
Expand Down

0 comments on commit 73e9efc

Please sign in to comment.