Use GKL's implementation of Vector Logless Pair HMM
Fixed MuTect2 tests by removing old -alwaysloadVectorHmm flag; upgraded to GKL 0.5.2; FASTEST_AVAILABLE pairhmm option; improved documenting comments in code Made FASTEST_AVAIALABLE the default for the pairHMM cmdline argument Make LOGLESS_CACHING the default pairHMM unified cmdline argument, fix error message if choose an unrecognized pairHMM Updae MD5s
This commit is contained in:
parent
70b2575c29
commit
e8b42c4dfd
|
|
@ -101,6 +101,8 @@ import org.broadinstitute.gatk.utils.sam.*;
|
|||
import org.broadinstitute.gatk.utils.variant.GATKVCFConstants;
|
||||
import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines;
|
||||
|
||||
import org.broadinstitute.gatk.nativebindings.pairhmm.PairHMMNativeArguments;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -874,7 +876,7 @@ public class MuTect2 extends ActiveRegionWalker<List<VariantContext>, Integer> i
|
|||
* @return never {@code null}.
|
||||
*/
|
||||
private ReadLikelihoodCalculationEngine createLikelihoodCalculationEngine() {
|
||||
return new PairHMMLikelihoodCalculationEngine( (byte)LEAC.gcpHMM, LEAC.pairHMM, LEAC.pairHMMSub, LEAC.alwaysLoadVectorLoglessPairHMMLib, log10GlobalReadMismappingRate, LEAC.noFpga, pcrErrorModel );
|
||||
return new PairHMMLikelihoodCalculationEngine( (byte)LEAC.gcpHMM, LEAC.pairHMM, LEAC.pairHMMNativeArgs.getPairHMMArgs(), log10GlobalReadMismappingRate, LEAC.noFpga, pcrErrorModel );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ public class UnifiedGenotypingEngine extends GenotypingEngine<UnifiedArgumentCol
|
|||
glcm.put(key, (GenotypeLikelihoodsCalculationModel)c.newInstance(args));
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new UserException("The likelihoods model provided for the -glm argument (" + UAC.GLmodel + ") is not a valid option: " + e.getMessage());
|
||||
throw new UserException("The likelihoods model provided for the -glm argument (" + UAC.GLmodel + ") is not a valid option: " + e.getCause().getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines;
|
|||
import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils;
|
||||
import org.broadinstitute.gatk.utils.variant.HomoSapiensConstants;
|
||||
|
||||
import org.broadinstitute.gatk.nativebindings.pairhmm.PairHMMNativeArguments;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.*;
|
||||
|
|
@ -773,7 +775,7 @@ public class HaplotypeCaller extends ActiveRegionWalker<List<VariantContext>, In
|
|||
private ReadLikelihoodCalculationEngine createLikelihoodCalculationEngine() {
|
||||
switch (likelihoodEngineImplementation) {
|
||||
case PairHMM:
|
||||
return new PairHMMLikelihoodCalculationEngine( (byte) LEAC.gcpHMM, LEAC.pairHMM, LEAC.pairHMMSub, LEAC.alwaysLoadVectorLoglessPairHMMLib, log10GlobalReadMismappingRate, LEAC.noFpga, pcrErrorModel );
|
||||
return new PairHMMLikelihoodCalculationEngine( (byte) LEAC.gcpHMM, LEAC.pairHMM, LEAC.pairHMMNativeArgs.getPairHMMArgs(), log10GlobalReadMismappingRate, LEAC.noFpga, pcrErrorModel );
|
||||
case GraphBased:
|
||||
return new GraphBasedLikelihoodCalculationEngine( (byte) LEAC.gcpHMM,log10GlobalReadMismappingRate, heterogeneousKmerSizeResolution, HCAC.DEBUG, RTAC.debugGraphTransformations);
|
||||
case Random:
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ package org.broadinstitute.gatk.tools.walkers.haplotypecaller;
|
|||
|
||||
import org.broadinstitute.gatk.utils.commandline.Advanced;
|
||||
import org.broadinstitute.gatk.utils.commandline.Argument;
|
||||
import org.broadinstitute.gatk.utils.commandline.ArgumentCollection;
|
||||
import org.broadinstitute.gatk.utils.commandline.Hidden;
|
||||
import org.broadinstitute.gatk.utils.pairhmm.PairHMM;
|
||||
|
||||
|
|
@ -71,29 +72,7 @@ public class LikelihoodEngineArgumentCollection {
|
|||
*/
|
||||
@Hidden
|
||||
@Argument(fullName = "pair_hmm_implementation", shortName = "pairHMM", doc = "The PairHMM implementation to use for genotype likelihood calculations", required = false)
|
||||
public PairHMM.HMM_IMPLEMENTATION pairHMM = PairHMM.HMM_IMPLEMENTATION.VECTOR_LOGLESS_CACHING;
|
||||
|
||||
/**
|
||||
* This argument is intended for use in the test suite only. It gives developers the ability to select of the
|
||||
* hardware dependent vectorized implementation of the vectorized PairHMM library (pairHMM=VECTOR_LOGLESS_CACHING).
|
||||
* For normal usage, you should rely on the architecture auto-detection.
|
||||
*/
|
||||
@Hidden
|
||||
@Advanced
|
||||
@Argument(fullName = "pair_hmm_sub_implementation", shortName = "pairHMMSub", doc = "The PairHMM machine-dependent sub-implementation to use for genotype likelihood calculations", required = false)
|
||||
public PairHMM.HMM_SUB_IMPLEMENTATION pairHMMSub = PairHMM.HMM_SUB_IMPLEMENTATION.ENABLE_ALL;
|
||||
|
||||
/**
|
||||
* This argument is intended for use in the test suite only. It gives developers the ability to load different
|
||||
* hardware dependent sub-implementations (-pairHMMSub) of the vectorized PairHMM library (-pairHMM=VECTOR_LOGLESS_CACHING)
|
||||
* for each test. Without this option, the library is only loaded once (for the first test executed in the suite) even if
|
||||
* subsequent tests specify a different implementation.
|
||||
* Each test will output the corresponding library loading messages.
|
||||
*/
|
||||
@Hidden
|
||||
@Advanced
|
||||
@Argument(fullName = "always_load_vector_logless_PairHMM_lib", shortName = "alwaysloadVectorHMM", doc = "Load the vector logless PairHMM library each time a GATK run is initiated in the test suite", required = false)
|
||||
public boolean alwaysLoadVectorLoglessPairHMMLib = false;
|
||||
public PairHMM.HMM_IMPLEMENTATION pairHMM = PairHMM.HMM_IMPLEMENTATION.FASTEST_AVAILABLE;
|
||||
|
||||
/**
|
||||
* The phredScaledGlobalReadMismappingRate reflects the average global mismapping rate of all reads, regardless of their
|
||||
|
|
@ -115,6 +94,6 @@ public class LikelihoodEngineArgumentCollection {
|
|||
@Argument(fullName="noFpga", shortName="noFpga", doc="Disable the use of the FPGA HMM implementation", required = false)
|
||||
public boolean noFpga = false;
|
||||
|
||||
|
||||
|
||||
@ArgumentCollection
|
||||
public PairHMMNativeArgumentCollection pairHMMNativeArgs = new PairHMMNativeArgumentCollection();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ import org.broadinstitute.gatk.utils.haplotype.Haplotype;
|
|||
import org.broadinstitute.gatk.utils.pairhmm.*;
|
||||
import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
||||
import org.broadinstitute.gatk.utils.variant.TandemRepeatFinder;
|
||||
import org.broadinstitute.gatk.nativebindings.pairhmm.PairHMMNativeArguments;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
@ -82,8 +83,7 @@ public class PairHMMLikelihoodCalculationEngine implements ReadLikelihoodCalcula
|
|||
private final double log10globalReadMismappingRate;
|
||||
|
||||
private final PairHMM.HMM_IMPLEMENTATION hmmType;
|
||||
private final PairHMM.HMM_SUB_IMPLEMENTATION hmmSubType;
|
||||
private final boolean alwaysLoadVectorLoglessPairHMMLib;
|
||||
private final PairHMMNativeArguments pairHmmNativeArgs;
|
||||
private final boolean noFpga;
|
||||
|
||||
private final ThreadLocal<PairHMM> pairHMMThreadLocal = new ThreadLocal<PairHMM>() {
|
||||
|
|
@ -98,24 +98,34 @@ public class PairHMMLikelihoodCalculationEngine implements ReadLikelihoodCalcula
|
|||
else
|
||||
return new CnyPairHMM();
|
||||
case VECTOR_LOGLESS_CACHING:
|
||||
try
|
||||
{
|
||||
return new VectorLoglessPairHMM(hmmSubType, alwaysLoadVectorLoglessPairHMMLib);
|
||||
return new VectorLoglessPairHMM(VectorLoglessPairHMM.Implementation.AVX, pairHmmNativeArgs);
|
||||
case VECTOR_LOGLESS_CACHING_OMP:
|
||||
return new VectorLoglessPairHMM(VectorLoglessPairHMM.Implementation.OMP, pairHmmNativeArgs);
|
||||
case FASTEST_AVAILABLE:
|
||||
try {
|
||||
return new VectorLoglessPairHMM(VectorLoglessPairHMM.Implementation.OMP, pairHmmNativeArgs);
|
||||
}
|
||||
catch(UnsatisfiedLinkError ule)
|
||||
{
|
||||
logger.warn("Failed to load native library for VectorLoglessPairHMM - using Java implementation of LOGLESS_CACHING");
|
||||
catch(UserException.HardwareFeatureException hfe) {
|
||||
logger.warn("OpenMP multi-threaded AVX-accelerated native PairHMM implementation is not supported");
|
||||
}
|
||||
try {
|
||||
return new VectorLoglessPairHMM(VectorLoglessPairHMM.Implementation.AVX, pairHmmNativeArgs);
|
||||
}
|
||||
catch(UserException.HardwareFeatureException hfe) {
|
||||
logger.warn("AVX-accelerated native PairHMM implementation is not supported. Falling back to slower LOGLESS_CACHING implementation");
|
||||
return new LoglessPairHMM();
|
||||
}
|
||||
case DEBUG_VECTOR_LOGLESS_CACHING:
|
||||
return new DebugJNILoglessPairHMM(PairHMM.HMM_IMPLEMENTATION.VECTOR_LOGLESS_CACHING, hmmSubType, alwaysLoadVectorLoglessPairHMMLib);
|
||||
return new DebugJNILoglessPairHMM(PairHMM.HMM_IMPLEMENTATION.VECTOR_LOGLESS_CACHING, pairHmmNativeArgs);
|
||||
case ARRAY_LOGLESS:
|
||||
if (noFpga || !CnyPairHMM.isAvailable())
|
||||
return new ArrayLoglessPairHMM();
|
||||
else
|
||||
return new CnyPairHMM();
|
||||
default:
|
||||
throw new UserException.BadArgumentValue("pairHMM", "Specified pairHMM implementation is unrecognized or incompatible with the HaplotypeCaller. Acceptable options are ORIGINAL, EXACT, CACHING, LOGLESS_CACHING, and ARRAY_LOGLESS.");
|
||||
throw new UserException.BadArgumentValue("pairHMM", "Specified pairHMM implementation is unrecognized or " +
|
||||
"incompatible with the HaplotypeCaller. Acceptable options are ORIGINAL, EXACT, CACHING, LOGLESS_CACHING, " +
|
||||
"VECTOR_LOGLESS_CACHING, VECTOR_LOGLESS_CACHING_OMP, and ARRAY_LOGLESS.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -160,8 +170,7 @@ public class PairHMMLikelihoodCalculationEngine implements ReadLikelihoodCalcula
|
|||
*
|
||||
* @param constantGCP the gap continuation penalty to use with the PairHMM
|
||||
* @param hmmType the type of the HMM to use
|
||||
* @param hmmSubType the type of the machine dependent sub-implementation of HMM to use
|
||||
* @param alwaysLoadVectorLoglessPairHMMLib always load the vector logless HMM library instead of once
|
||||
* @param pairHmmNativeArgs arguments to the vector logless PairHMM implementation
|
||||
* @param log10globalReadMismappingRate the global mismapping probability, in log10(prob) units. A value of
|
||||
* -3 means that the chance that a read doesn't actually belong at this
|
||||
* location in the genome is 1 in 1000. The effect of this parameter is
|
||||
|
|
@ -173,11 +182,9 @@ public class PairHMMLikelihoodCalculationEngine implements ReadLikelihoodCalcula
|
|||
* @param noFpga disable FPGA acceleration
|
||||
* @param pcrErrorModel model to correct for PCR indel artifacts
|
||||
*/
|
||||
public PairHMMLikelihoodCalculationEngine( final byte constantGCP, final PairHMM.HMM_IMPLEMENTATION hmmType, final PairHMM.HMM_SUB_IMPLEMENTATION hmmSubType,
|
||||
final boolean alwaysLoadVectorLoglessPairHMMLib, final double log10globalReadMismappingRate, final boolean noFpga, final PCR_ERROR_MODEL pcrErrorModel ) {
|
||||
public PairHMMLikelihoodCalculationEngine( final byte constantGCP, final PairHMM.HMM_IMPLEMENTATION hmmType, final PairHMMNativeArguments pairHmmNativeArgs, final double log10globalReadMismappingRate, final boolean noFpga, final PCR_ERROR_MODEL pcrErrorModel ) {
|
||||
this.hmmType = hmmType;
|
||||
this.hmmSubType = hmmSubType;
|
||||
this.alwaysLoadVectorLoglessPairHMMLib = alwaysLoadVectorLoglessPairHMMLib;
|
||||
this.pairHmmNativeArgs = pairHmmNativeArgs;
|
||||
this.constantGCP = constantGCP;
|
||||
this.log10globalReadMismappingRate = log10globalReadMismappingRate;
|
||||
this.noFpga = noFpga;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* By downloading the PROGRAM you agree to the following terms of use:
|
||||
*
|
||||
* BROAD INSTITUTE
|
||||
* SOFTWARE LICENSE AGREEMENT
|
||||
* FOR ACADEMIC NON-COMMERCIAL RESEARCH PURPOSES ONLY
|
||||
*
|
||||
* This Agreement is made between the Broad Institute, Inc. with a principal address at 415 Main Street, Cambridge, MA 02142 ("BROAD") and the LICENSEE and is effective at the date the downloading is completed ("EFFECTIVE DATE").
|
||||
*
|
||||
* WHEREAS, LICENSEE desires to license the PROGRAM, as defined hereinafter, and BROAD wishes to have this PROGRAM utilized in the public interest, subject only to the royalty-free, nonexclusive, nontransferable license rights of the United States Government pursuant to 48 CFR 52.227-14; and
|
||||
* WHEREAS, LICENSEE desires to license the PROGRAM and BROAD desires to grant a license on the following terms and conditions.
|
||||
* NOW, THEREFORE, in consideration of the promises and covenants made herein, the parties hereto agree as follows:
|
||||
*
|
||||
* 1. DEFINITIONS
|
||||
* 1.1 PROGRAM shall mean copyright in the object code and source code known as GATK3 and related documentation, if any, as they exist on the EFFECTIVE DATE and can be downloaded from http://www.broadinstitute.org/gatk on the EFFECTIVE DATE.
|
||||
*
|
||||
* 2. LICENSE
|
||||
* 2.1 Grant. Subject to the terms of this Agreement, BROAD hereby grants to LICENSEE, solely for academic non-commercial research purposes, a non-exclusive, non-transferable license to: (a) download, execute and display the PROGRAM and (b) create bug fixes and modify the PROGRAM. LICENSEE hereby automatically grants to BROAD a non-exclusive, royalty-free, irrevocable license to any LICENSEE bug fixes or modifications to the PROGRAM with unlimited rights to sublicense and/or distribute. LICENSEE agrees to provide any such modifications and bug fixes to BROAD promptly upon their creation.
|
||||
* The LICENSEE may apply the PROGRAM in a pipeline to data owned by users other than the LICENSEE and provide these users the results of the PROGRAM provided LICENSEE does so for academic non-commercial purposes only. For clarification purposes, academic sponsored research is not a commercial use under the terms of this Agreement.
|
||||
* 2.2 No Sublicensing or Additional Rights. LICENSEE shall not sublicense or distribute the PROGRAM, in whole or in part, without prior written permission from BROAD. LICENSEE shall ensure that all of its users agree to the terms of this Agreement. LICENSEE further agrees that it shall not put the PROGRAM on a network, server, or other similar technology that may be accessed by anyone other than the LICENSEE and its employees and users who have agreed to the terms of this agreement.
|
||||
* 2.3 License Limitations. Nothing in this Agreement shall be construed to confer any rights upon LICENSEE by implication, estoppel, or otherwise to any computer software, trademark, intellectual property, or patent rights of BROAD, or of any other entity, except as expressly granted herein. LICENSEE agrees that the PROGRAM, in whole or part, shall not be used for any commercial purpose, including without limitation, as the basis of a commercial software or hardware product or to provide services. LICENSEE further agrees that the PROGRAM shall not be copied or otherwise adapted in order to circumvent the need for obtaining a license for use of the PROGRAM.
|
||||
*
|
||||
* 3. PHONE-HOME FEATURE
|
||||
* LICENSEE expressly acknowledges that the PROGRAM contains an embedded automatic reporting system ("PHONE-HOME") which is enabled by default upon download. Unless LICENSEE requests disablement of PHONE-HOME, LICENSEE agrees that BROAD may collect limited information transmitted by PHONE-HOME regarding LICENSEE and its use of the PROGRAM. Such information shall include LICENSEE'S user identification, version number of the PROGRAM and tools being run, mode of analysis employed, and any error reports generated during run-time. Collection of such information is used by BROAD solely to monitor usage rates, fulfill reporting requirements to BROAD funding agencies, drive improvements to the PROGRAM, and facilitate adjustments to PROGRAM-related documentation.
|
||||
*
|
||||
* 4. OWNERSHIP OF INTELLECTUAL PROPERTY
|
||||
* LICENSEE acknowledges that title to the PROGRAM shall remain with BROAD. The PROGRAM is marked with the following BROAD copyright notice and notice of attribution to contributors. LICENSEE shall retain such notice on all copies. LICENSEE agrees to include appropriate attribution if any results obtained from use of the PROGRAM are included in any publication.
|
||||
* Copyright 2012-2016 Broad Institute, Inc.
|
||||
* Notice of attribution: The GATK3 program was made available through the generosity of Medical and Population Genetics program at the Broad Institute, Inc.
|
||||
* LICENSEE shall not use any trademark or trade name of BROAD, or any variation, adaptation, or abbreviation, of such marks or trade names, or any names of officers, faculty, students, employees, or agents of BROAD except as states above for attribution purposes.
|
||||
*
|
||||
* 5. INDEMNIFICATION
|
||||
* LICENSEE shall indemnify, defend, and hold harmless BROAD, and their respective officers, faculty, students, employees, associated investigators and agents, and their respective successors, heirs and assigns, (Indemnitees), against any liability, damage, loss, or expense (including reasonable attorneys fees and expenses) incurred by or imposed upon any of the Indemnitees in connection with any claims, suits, actions, demands or judgments arising out of any theory of liability (including, without limitation, actions in the form of tort, warranty, or strict liability and regardless of whether such action has any factual basis) pursuant to any right or license granted under this Agreement.
|
||||
*
|
||||
* 6. NO REPRESENTATIONS OR WARRANTIES
|
||||
* THE PROGRAM IS DELIVERED AS IS. BROAD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE PROGRAM OR THE COPYRIGHT, EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER OR NOT DISCOVERABLE. BROAD EXTENDS NO WARRANTIES OF ANY KIND AS TO PROGRAM CONFORMITY WITH WHATEVER USER MANUALS OR OTHER LITERATURE MAY BE ISSUED FROM TIME TO TIME.
|
||||
* IN NO EVENT SHALL BROAD OR ITS RESPECTIVE DIRECTORS, OFFICERS, EMPLOYEES, AFFILIATED INVESTIGATORS AND AFFILIATES BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING, WITHOUT LIMITATION, ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER BROAD SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
|
||||
*
|
||||
* 7. ASSIGNMENT
|
||||
* This Agreement is personal to LICENSEE and any rights or obligations assigned by LICENSEE without the prior written consent of BROAD shall be null and void.
|
||||
*
|
||||
* 8. MISCELLANEOUS
|
||||
* 8.1 Export Control. LICENSEE gives assurance that it will comply with all United States export control laws and regulations controlling the export of the PROGRAM, including, without limitation, all Export Administration Regulations of the United States Department of Commerce. Among other things, these laws and regulations prohibit, or require a license for, the export of certain types of software to specified countries.
|
||||
* 8.2 Termination. LICENSEE shall have the right to terminate this Agreement for any reason upon prior written notice to BROAD. If LICENSEE breaches any provision hereunder, and fails to cure such breach within thirty (30) days, BROAD may terminate this Agreement immediately. Upon termination, LICENSEE shall provide BROAD with written assurance that the original and all copies of the PROGRAM have been destroyed, except that, upon prior written authorization from BROAD, LICENSEE may retain a copy for archive purposes.
|
||||
* 8.3 Survival. The following provisions shall survive the expiration or termination of this Agreement: Articles 1, 3, 4, 5 and Sections 2.2, 2.3, 7.3, and 7.4.
|
||||
* 8.4 Notice. Any notices under this Agreement shall be in writing, shall specifically refer to this Agreement, and shall be sent by hand, recognized national overnight courier, confirmed facsimile transmission, confirmed electronic mail, or registered or certified mail, postage prepaid, return receipt requested. All notices under this Agreement shall be deemed effective upon receipt.
|
||||
* 8.5 Amendment and Waiver; Entire Agreement. This Agreement may be amended, supplemented, or otherwise modified only by means of a written instrument signed by all parties. Any waiver of any rights or failure to act in a specific instance shall relate only to such instance and shall not be construed as an agreement to waive any rights or fail to act in any other instance, whether or not similar. This Agreement constitutes the entire agreement among the parties with respect to its subject matter and supersedes prior agreements or understandings between the parties relating to its subject matter.
|
||||
* 8.6 Binding Effect; Headings. This Agreement shall be binding upon and inure to the benefit of the parties and their respective permitted successors and assigns. All headings are for convenience only and shall not affect the meaning of any provision of this Agreement.
|
||||
* 8.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.gatk.tools.walkers.haplotypecaller;
|
||||
|
||||
import org.broadinstitute.gatk.nativebindings.pairhmm.PairHMMNativeArguments;
|
||||
import org.broadinstitute.gatk.utils.commandline.Argument;
|
||||
import org.broadinstitute.gatk.utils.commandline.Hidden;
|
||||
|
||||
/**
|
||||
* Arguments for native PairHMM implementations
|
||||
*/
|
||||
public class PairHMMNativeArgumentCollection {
|
||||
|
||||
@Hidden
|
||||
@Argument(fullName = "nativePairHmmThreads", shortName = "threads", doc="How many threads should a native pairHMM implementation use", required = false)
|
||||
private int pairHmmNativeThreads = 1;
|
||||
|
||||
@Hidden
|
||||
@Argument(fullName = "useDoublePrecision", shortName = "useDoublePrecision", doc="use double precision in the native pairHmm. " +
|
||||
"This is slower but matches the java implementation better", required = false)
|
||||
private boolean useDoublePrecision = false;
|
||||
|
||||
public PairHMMNativeArguments getPairHMMArgs(){
|
||||
final PairHMMNativeArguments args = new PairHMMNativeArguments();
|
||||
args.maxNumberOfThreads = pairHmmNativeThreads;
|
||||
args.useDoublePrecision = useDoublePrecision;
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -59,6 +59,7 @@ import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap;
|
|||
import org.broadinstitute.gatk.utils.genotyper.ReadLikelihoods;
|
||||
import org.broadinstitute.gatk.utils.haplotype.Haplotype;
|
||||
import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
||||
import org.broadinstitute.gatk.nativebindings.pairhmm.PairHMMNativeArguments;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
|
|
@ -92,11 +93,11 @@ public class DebugJNILoglessPairHMM extends LoglessPairHMM {
|
|||
protected HashMap<String, BufferedWriter> filenameToWriter = new HashMap<String, BufferedWriter>();
|
||||
|
||||
private JNILoglessPairHMM jniPairHMM = null;
|
||||
public DebugJNILoglessPairHMM(final PairHMM.HMM_IMPLEMENTATION hmmType, PairHMM.HMM_SUB_IMPLEMENTATION pairHMMSub, final boolean alwaysLoadVectorLoglessPairHMMLib) {
|
||||
public DebugJNILoglessPairHMM(final PairHMM.HMM_IMPLEMENTATION hmmType, PairHMMNativeArguments pairHmmNativeArgs) {
|
||||
super();
|
||||
switch(hmmType) {
|
||||
case VECTOR_LOGLESS_CACHING:
|
||||
jniPairHMM = new VectorLoglessPairHMM(pairHMMSub, alwaysLoadVectorLoglessPairHMMLib);
|
||||
jniPairHMM = new VectorLoglessPairHMM(VectorLoglessPairHMM.Implementation.AVX, pairHmmNativeArgs);
|
||||
break;
|
||||
default:
|
||||
throw new UserException.BadArgumentValue("pairHMM","Specified JNIPairHMM implementation is unrecognized or incompatible with the HaplotypeCaller. Acceptable options are VECTOR_LOGLESS_CACHING");
|
||||
|
|
|
|||
|
|
@ -51,7 +51,13 @@
|
|||
|
||||
package org.broadinstitute.gatk.utils.pairhmm;
|
||||
|
||||
import com.intel.gkl.pairhmm.IntelPairHmm;
|
||||
import com.intel.gkl.pairhmm.IntelPairHmmOMP;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.gatk.nativebindings.pairhmm.HaplotypeDataHolder;
|
||||
import org.broadinstitute.gatk.nativebindings.pairhmm.PairHMMNativeArguments;
|
||||
import org.broadinstitute.gatk.nativebindings.pairhmm.PairHMMNativeBinding;
|
||||
import org.broadinstitute.gatk.nativebindings.pairhmm.ReadDataHolder;
|
||||
import org.broadinstitute.gatk.utils.exceptions.UserException;
|
||||
import org.broadinstitute.gatk.utils.genotyper.ReadLikelihoods;
|
||||
import org.broadinstitute.gatk.utils.haplotype.Haplotype;
|
||||
|
|
@ -71,100 +77,61 @@ import java.util.Map;
|
|||
*/
|
||||
public class VectorLoglessPairHMM extends JNILoglessPairHMM {
|
||||
|
||||
/**
|
||||
* Implementation of PairHMM to use
|
||||
*/
|
||||
public enum Implementation
|
||||
{
|
||||
/* Use AVX acceleration */
|
||||
AVX,
|
||||
/* Use AVX acceleration with mult-threading via OpenMP */
|
||||
OMP
|
||||
}
|
||||
|
||||
protected final static Logger logger = Logger.getLogger(VectorLoglessPairHMM.class);
|
||||
|
||||
//Used to copy references to byteArrays to JNI from reads
|
||||
protected class JNIReadDataHolderClass {
|
||||
public byte[] readBases = null;
|
||||
public byte[] readQuals = null;
|
||||
public byte[] insertionGOP = null;
|
||||
public byte[] deletionGOP = null;
|
||||
public byte[] overallGCP = null;
|
||||
}
|
||||
|
||||
//Used to copy references to byteArrays to JNI from haplotypes
|
||||
protected class JNIHaplotypeDataHolderClass {
|
||||
public byte[] haplotypeBases = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return 64-bit mask representing machine capabilities
|
||||
* Bit 0 is LSB, bit 63 MSB
|
||||
* Bit 0 represents sse4.1 availability
|
||||
* Bit 1 represents sse4.2 availability
|
||||
* Bit 2 represents AVX availability
|
||||
*/
|
||||
public native long jniGetMachineType();
|
||||
|
||||
/**
|
||||
* Function to initialize the fields of JNIReadDataHolderClass and JNIHaplotypeDataHolderClass from JVM.
|
||||
* C++ codegets FieldIDs for these classes once and re-uses these IDs for the remainder of the program. Field IDs do not
|
||||
* change per JVM session
|
||||
*
|
||||
* @param readDataHolderClass class type of JNIReadDataHolderClass
|
||||
* @param haplotypeDataHolderClass class type of JNIHaplotypeDataHolderClass
|
||||
* @param mask a 64 bit integer identical to the one received from jniGetMachineType(). Users can disable usage of some hardware features by zeroing bits in the mask
|
||||
*/
|
||||
private native void jniInitializeClassFieldsAndMachineMask(Class<?> readDataHolderClass, Class<?> haplotypeDataHolderClass, long mask);
|
||||
|
||||
private static Boolean isVectorLoglessPairHMMLibraryLoaded = false;
|
||||
private final PairHMMNativeBinding pairHmm;
|
||||
|
||||
//The constructor is called only once inside PairHMMLikelihoodCalculationEngine
|
||||
public VectorLoglessPairHMM(final PairHMM.HMM_SUB_IMPLEMENTATION pairHMMSub, final boolean alwaysLoadVectorLoglessPairHMMLib) throws UserException.HardwareFeatureException {
|
||||
super();
|
||||
public VectorLoglessPairHMM(Implementation implementation, PairHMMNativeArguments args) throws UserException.HardwareFeatureException {
|
||||
final boolean isSupported;
|
||||
|
||||
synchronized (isVectorLoglessPairHMMLibraryLoaded) {
|
||||
// Get the mask for the requested hardware sub-implementation
|
||||
// If a specifically requested hardware feature can not be supported, throw an exception
|
||||
long mask = pairHMMSub.getMask();
|
||||
throwIfHardwareFeatureNotSupported(mask, pairHMMSub);
|
||||
|
||||
// Load the library and initialize the FieldIDs
|
||||
// Load if not loaded or if the the always load flag is true
|
||||
if (!isVectorLoglessPairHMMLibraryLoaded || alwaysLoadVectorLoglessPairHMMLib) {
|
||||
try
|
||||
{
|
||||
//Try loading from Java's library path first
|
||||
//Useful if someone builds his/her own library and wants to override the bundled
|
||||
//implementation without modifying the Java code
|
||||
System.loadLibrary("VectorLoglessPairHMM");
|
||||
logger.info("libVectorLoglessPairHMM found in JVM library path");
|
||||
} catch (UnsatisfiedLinkError ule) {
|
||||
//Could not load from Java's library path - try unpacking from jar
|
||||
try
|
||||
{
|
||||
logger.debug("libVectorLoglessPairHMM not found in JVM library path - trying to unpack from GATK jar file");
|
||||
loadLibraryFromJar("/org/broadinstitute/gatk/utils/pairhmm/libVectorLoglessPairHMM.so");
|
||||
logger.info("libVectorLoglessPairHMM unpacked successfully from GATK jar file");
|
||||
} catch (IOException ioe) {
|
||||
//Throw the UnsatisfiedLinkError to make it clear to the user what failed
|
||||
throw ule;
|
||||
}
|
||||
switch (implementation) {
|
||||
case AVX:
|
||||
pairHmm = new IntelPairHmm();
|
||||
isSupported = pairHmm.load(null);
|
||||
if (!isSupported) {
|
||||
throw new UserException.HardwareFeatureException("Machine does not support AVX PairHMM.");
|
||||
}
|
||||
logger.info("Using vectorized implementation of PairHMM");
|
||||
isVectorLoglessPairHMMLibraryLoaded = true;
|
||||
logger.info("Using AVX-accelerated native PairHMM implementation");
|
||||
break;
|
||||
|
||||
//need to do this only once
|
||||
jniInitializeClassFieldsAndMachineMask(JNIReadDataHolderClass.class, JNIHaplotypeDataHolderClass.class, mask);
|
||||
}
|
||||
case OMP:
|
||||
pairHmm = new IntelPairHmmOMP();
|
||||
isSupported = pairHmm.load(null);
|
||||
if (!isSupported) {
|
||||
throw new UserException.HardwareFeatureException("Machine does not support OpenMP AVX PairHMM.");
|
||||
}
|
||||
logger.info("Using OpenMP multi-threaded AVX-accelerated native PairHMM implementation");
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UserException.HardwareFeatureException("Unknown PairHMM implementation.");
|
||||
}
|
||||
}
|
||||
|
||||
private native void jniInitializeHaplotypes(final int numHaplotypes, JNIHaplotypeDataHolderClass[] haplotypeDataArray);
|
||||
// instantiate and initialize IntelPairHmm
|
||||
pairHmm.initialize(args);
|
||||
}
|
||||
|
||||
//Hold the mapping between haplotype and index in the list of Haplotypes passed to initialize
|
||||
//Use this mapping in computeLikelihoods to find the likelihood value corresponding to a given Haplotype
|
||||
private HashMap<Haplotype, Integer> haplotypeToHaplotypeListIdxMap = new HashMap<>();
|
||||
private JNIHaplotypeDataHolderClass[] mHaplotypeDataArray;
|
||||
private HaplotypeDataHolder[] mHaplotypeDataArray;
|
||||
|
||||
@Override
|
||||
public HashMap<Haplotype, Integer> getHaplotypeToHaplotypeListIdxMap() {
|
||||
return haplotypeToHaplotypeListIdxMap;
|
||||
}
|
||||
|
||||
//Used to transfer data to JNI
|
||||
//Since the haplotypes are the same for all calls to computeLikelihoods within a region, transfer the haplotypes only once to the JNI per region
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
@ -172,54 +139,35 @@ public class VectorLoglessPairHMM extends JNILoglessPairHMM {
|
|||
public void initialize(final List<Haplotype> haplotypes, final Map<String, List<GATKSAMRecord>> perSampleReadList,
|
||||
final int readMaxLength, final int haplotypeMaxLength) {
|
||||
int numHaplotypes = haplotypes.size();
|
||||
mHaplotypeDataArray = new JNIHaplotypeDataHolderClass[numHaplotypes];
|
||||
mHaplotypeDataArray = new HaplotypeDataHolder[numHaplotypes];
|
||||
int idx = 0;
|
||||
haplotypeToHaplotypeListIdxMap.clear();
|
||||
for (final Haplotype currHaplotype : haplotypes) {
|
||||
mHaplotypeDataArray[idx] = new JNIHaplotypeDataHolderClass();
|
||||
mHaplotypeDataArray[idx] = new HaplotypeDataHolder();
|
||||
mHaplotypeDataArray[idx].haplotypeBases = currHaplotype.getBases();
|
||||
haplotypeToHaplotypeListIdxMap.put(currHaplotype, idx);
|
||||
++idx;
|
||||
}
|
||||
jniInitializeHaplotypes(numHaplotypes, mHaplotypeDataArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell JNI to release arrays - really important if native code is directly accessing Java memory, if not
|
||||
* accessing Java memory directly, still important to release memory from C++
|
||||
*/
|
||||
private native void jniFinalizeRegion();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void finalizeRegion()
|
||||
{
|
||||
jniFinalizeRegion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Real compute kernel
|
||||
*/
|
||||
private native void jniComputeLikelihoods(int numReads, int numHaplotypes, JNIReadDataHolderClass[] readDataArray,
|
||||
JNIHaplotypeDataHolderClass[] haplotypeDataArray, double[] likelihoodArray, int maxNumThreadsToUse);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void computeLikelihoods(final ReadLikelihoods.Matrix<Haplotype> likelihoods, final List<GATKSAMRecord> processedReads, final Map<GATKSAMRecord, byte[]> gcp) {
|
||||
if (processedReads.isEmpty())
|
||||
if (processedReads.isEmpty()) {
|
||||
return;
|
||||
if (doProfiling)
|
||||
}
|
||||
if (doProfiling) {
|
||||
startTime = System.nanoTime();
|
||||
}
|
||||
int readListSize = processedReads.size();
|
||||
int numHaplotypes = likelihoods.alleleCount();
|
||||
JNIReadDataHolderClass[] readDataArray = new JNIReadDataHolderClass[readListSize];
|
||||
|
||||
ReadDataHolder[] readDataArray = new ReadDataHolder[readListSize];
|
||||
int idx = 0;
|
||||
for (GATKSAMRecord read : processedReads) {
|
||||
readDataArray[idx] = new JNIReadDataHolderClass();
|
||||
readDataArray[idx] = new ReadDataHolder();
|
||||
readDataArray[idx].readBases = read.getReadBases();
|
||||
readDataArray[idx].readQuals = read.getBaseQualities();
|
||||
readDataArray[idx].insertionGOP = read.getBaseInsertionQualities();
|
||||
|
|
@ -229,12 +177,13 @@ public class VectorLoglessPairHMM extends JNILoglessPairHMM {
|
|||
}
|
||||
|
||||
mLikelihoodArray = new double[readListSize * numHaplotypes]; //to store results
|
||||
if (doProfiling)
|
||||
if (doProfiling) {
|
||||
threadLocalSetupTimeDiff = (System.nanoTime() - startTime);
|
||||
}
|
||||
//for(reads)
|
||||
// for(haplotypes)
|
||||
// compute_full_prob()
|
||||
jniComputeLikelihoods(readListSize, numHaplotypes, readDataArray, mHaplotypeDataArray, mLikelihoodArray, 12);
|
||||
pairHmm.computeLikelihoods(readDataArray, mHaplotypeDataArray, mLikelihoodArray);
|
||||
|
||||
int readIdx = 0;
|
||||
for (int r = 0; r < readListSize; r++) {
|
||||
|
|
@ -249,6 +198,7 @@ public class VectorLoglessPairHMM extends JNILoglessPairHMM {
|
|||
}
|
||||
readIdx += numHaplotypes;
|
||||
}
|
||||
|
||||
if (doProfiling) {
|
||||
threadLocalPairHMMComputeTimeDiff = (System.nanoTime() - startTime);
|
||||
//synchronized(doProfiling)
|
||||
|
|
@ -259,120 +209,11 @@ public class VectorLoglessPairHMM extends JNILoglessPairHMM {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print final profiling information from native code
|
||||
*/
|
||||
public native void jniClose();
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
pairHmm.done();
|
||||
if (doProfiling)
|
||||
logger.info("Time spent in setup for JNI call : " + (pairHMMSetupTime * 1e-9));
|
||||
super.close();
|
||||
jniClose();
|
||||
}
|
||||
|
||||
//Copied from http://frommyplayground.com/how-to-load-native-jni-library-from-jar
|
||||
|
||||
/**
|
||||
* Loads library from current JAR archive
|
||||
* <p/>
|
||||
* The file from JAR is copied into system temporary directory and then loaded. The temporary file is deleted after exiting.
|
||||
* Method uses String as filename because the pathname is "abstract", not system-dependent.
|
||||
*
|
||||
* @param path The filename inside JAR as absolute path (beginning with '/'), e.g. /package/File.ext
|
||||
* @throws IOException If temporary file creation or read/write operation fails
|
||||
* @throws IllegalArgumentException If source file (param path) does not exist
|
||||
* @throws IllegalArgumentException If the path is not absolute or if the filename is shorter than three characters (restriction of {@see File#createTempFile(java.lang.String, java.lang.String)}).
|
||||
*/
|
||||
public static void loadLibraryFromJar(String path) throws IOException {
|
||||
|
||||
if (!path.startsWith("/")) {
|
||||
throw new IllegalArgumentException("The path to be absolute (start with '/').");
|
||||
}
|
||||
|
||||
// Obtain filename from path
|
||||
String[] parts = path.split("/");
|
||||
String filename = (parts.length > 1) ? parts[parts.length - 1] : null;
|
||||
|
||||
// Split filename to prexif and suffix (extension)
|
||||
String prefix = "";
|
||||
String suffix = null;
|
||||
if (filename != null) {
|
||||
parts = filename.split("\\.", 2);
|
||||
prefix = parts[0];
|
||||
suffix = (parts.length > 1) ? "." + parts[parts.length - 1] : null; // Thanks, davs! :-)
|
||||
}
|
||||
|
||||
// Check if the filename is okay
|
||||
if (filename == null || prefix.length() < 3) {
|
||||
throw new IllegalArgumentException("The filename has to be at least 3 characters long.");
|
||||
}
|
||||
|
||||
// Prepare temporary file
|
||||
File temp = File.createTempFile(prefix, suffix);
|
||||
//System.out.println("Temp lib file "+temp.getAbsolutePath());
|
||||
temp.deleteOnExit();
|
||||
|
||||
if (!temp.exists()) {
|
||||
throw new FileNotFoundException("File " + temp.getAbsolutePath() + " does not exist.");
|
||||
}
|
||||
|
||||
// Prepare buffer for data copying
|
||||
byte[] buffer = new byte[1024];
|
||||
int readBytes;
|
||||
|
||||
// Open and check input stream
|
||||
InputStream is = VectorLoglessPairHMM.class.getResourceAsStream(path);
|
||||
if (is == null) {
|
||||
throw new FileNotFoundException("File " + path + " was not found inside JAR.");
|
||||
}
|
||||
|
||||
// Open output stream and copy data between source file in JAR and the temporary file
|
||||
OutputStream os = new FileOutputStream(temp);
|
||||
try {
|
||||
while ((readBytes = is.read(buffer)) != -1) {
|
||||
os.write(buffer, 0, readBytes);
|
||||
}
|
||||
} finally {
|
||||
// If read/write fails, close streams safely before throwing an exception
|
||||
os.close();
|
||||
is.close();
|
||||
}
|
||||
|
||||
// Finally, load the library
|
||||
System.load(temp.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* If the machine does not support the requested hardware feature, throw an exception
|
||||
* <p/>
|
||||
* If requesting a specific hardware feature, check if the machine supports this feature.
|
||||
* If it does not, throw an exception.
|
||||
*
|
||||
* @param mask a 64 bit integer identical to the one received from jniGetMachineType(). Users can disable usage of some hardware features by zeroing some bits in the mask.
|
||||
* @param pairHMMSub the PairHMM machine dependent sub-implementation to use for genotype likelihood calculations
|
||||
* @throws UserException.HardwareFeatureException if the hardware feature is not supported
|
||||
*/
|
||||
private void throwIfHardwareFeatureNotSupported(long mask, PairHMM.HMM_SUB_IMPLEMENTATION pairHMMSub) throws UserException.HardwareFeatureException
|
||||
{
|
||||
if ( pairHMMSub.getIsSpecificHardwareRequest() ) {
|
||||
if ( !isHardwareFeatureSupported(mask) )
|
||||
throw new UserException.HardwareFeatureException("Machine does not support pairHMM hardware dependent sub-type = " + pairHMMSub);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the machine supports the requested hardware feature
|
||||
* <p/>
|
||||
* Mask the bits for the hardware feature and check if they are set by the machine
|
||||
* If the bits are set, the machine supports this feature
|
||||
*
|
||||
* @param mask a 64 bit integer identical to the one received from jniGetMachineType(). Users can disable usage of some hardware features by zeroing some bits in the mask.
|
||||
* @return true of machine supports the requested hardware feature, false otherwise
|
||||
*/
|
||||
private boolean isHardwareFeatureSupported(long mask)
|
||||
{
|
||||
return (mask & jniGetMachineType()) != 0x0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class MuTect2IntegrationTest extends WalkerTest {
|
|||
final static String DREAM3_FP_INTERVALS_FILE = privateTestDir + "m2_dream3.fp.intervals";
|
||||
|
||||
final String commandLine =
|
||||
"-T MuTect2 --no_cmdline_in_header -dt NONE --disableDithering -alwaysloadVectorHMM -pairHMM LOGLESS_CACHING -ip 50 -R %s --dbsnp %s --cosmic %s --normal_panel %s -I:tumor %s -I:normal %s -L %s";
|
||||
"-T MuTect2 --no_cmdline_in_header -dt NONE --disableDithering -pairHMM LOGLESS_CACHING -ip 50 -R %s --dbsnp %s --cosmic %s --normal_panel %s -I:tumor %s -I:normal %s -L %s";
|
||||
|
||||
private void M2Test(String tumorBam, String normalBam, String intervals, String args, String md5) {
|
||||
final String base = String.format(
|
||||
|
|
@ -90,7 +90,7 @@ public class MuTect2IntegrationTest extends WalkerTest {
|
|||
|
||||
private void m2TumorOnlyTest(String tumorBam, String intervals, String args, String md5) {
|
||||
final String base = String.format(
|
||||
"-T MuTect2 --no_cmdline_in_header -dt NONE --disableDithering -alwaysloadVectorHMM -pairHMM LOGLESS_CACHING -ip 50 -R %s --dbsnp %s --cosmic %s --normal_panel %s -I:tumor %s -L %s",
|
||||
"-T MuTect2 --no_cmdline_in_header -dt NONE --disableDithering -pairHMM LOGLESS_CACHING -ip 50 -R %s --dbsnp %s --cosmic %s --normal_panel %s -I:tumor %s -L %s",
|
||||
hg19Reference, DBSNP, COSMIC, PON, tumorBam, intervals) +
|
||||
" -o %s ";
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ public class HCLikelihoodCalculationEnginesBenchmark extends SimpleBenchmark {
|
|||
public void timeLoglessPairHMM(final int reps) {
|
||||
for (int i = 0; i < reps; i++) {
|
||||
final PairHMMLikelihoodCalculationEngine engine = new PairHMMLikelihoodCalculationEngine((byte) 10,
|
||||
PairHMM.HMM_IMPLEMENTATION.LOGLESS_CACHING, PairHMM.HMM_SUB_IMPLEMENTATION.UNVECTORIZED, true, -3, true, PairHMMLikelihoodCalculationEngine.PCR_ERROR_MODEL.NONE);
|
||||
PairHMM.HMM_IMPLEMENTATION.LOGLESS_CACHING, null, -3, true, PairHMMLikelihoodCalculationEngine.PCR_ERROR_MODEL.NONE);
|
||||
engine.computeReadLikelihoods(dataSet.assemblyResultSet(), SampleListUtils.singletonList("anonymous"), Collections.singletonMap("anonymous", dataSet.readList()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,22 +61,19 @@ import static org.broadinstitute.gatk.tools.walkers.haplotypecaller.HaplotypeCal
|
|||
|
||||
public class HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest extends WalkerTest {
|
||||
|
||||
final static String HMM_SUB_IMPLEMENTATION = "UNVECTORIZED";
|
||||
final static String ALWAYS_LOAD_VECTOR_HMM = "-alwaysloadVectorHMM";
|
||||
|
||||
private void HCTestComplexVariants(String bam, String args, String md5) {
|
||||
final String base = String.format("-T HaplotypeCaller --contamination_fraction_to_filter 0.05 --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, bam) + " -L 20:10028767-10028967 -L 20:10431524-10431924 -L 20:10723661-10724061 -L 20:10903555-10903955 --no_cmdline_in_header -o %s -minPruning 4";
|
||||
final String base = String.format("-T HaplotypeCaller --contamination_fraction_to_filter 0.05 --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, bam) + " -L 20:10028767-10028967 -L 20:10431524-10431924 -L 20:10723661-10724061 -L 20:10903555-10903955 --no_cmdline_in_header -o %s -minPruning 4";
|
||||
final WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(base + " " + args, Arrays.asList(md5));
|
||||
executeTest("testHaplotypeCallerComplexVariants: args=" + args, spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHaplotypeCallerMultiSampleComplex1() {
|
||||
HCTestComplexVariants(privateTestDir + "AFR.complex.variants.bam", "", "590428bdfe466159cb8e1637aaa4f47c");
|
||||
HCTestComplexVariants(privateTestDir + "AFR.complex.variants.bam", "", "93f89c04b4c74463f75da798cdcf5064");
|
||||
}
|
||||
|
||||
private void HCTestSymbolicVariants(String bam, String args, String md5) {
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, bam) + " -L 20:5947969-5948369 -L 20:61091236-61091636 --no_cmdline_in_header -o %s -minPruning 1";
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, bam) + " -L 20:5947969-5948369 -L 20:61091236-61091636 --no_cmdline_in_header -o %s -minPruning 1";
|
||||
final WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(base + " " + args, Arrays.asList(md5));
|
||||
executeTest("testHaplotypeCallerSymbolicVariants: args=" + args, spec);
|
||||
}
|
||||
|
|
@ -88,7 +85,7 @@ public class HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest extends Wa
|
|||
}
|
||||
|
||||
private void HCTestComplexGGA(String bam, String args, String md5) {
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, bam) + " --no_cmdline_in_header -o %s -minPruning 3 -gt_mode GENOTYPE_GIVEN_ALLELES -alleles " + validationDataLocation + "combined.phase1.chr20.raw.indels.sites.vcf";
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, bam) + " --no_cmdline_in_header -o %s -minPruning 3 -gt_mode GENOTYPE_GIVEN_ALLELES -alleles " + validationDataLocation + "combined.phase1.chr20.raw.indels.sites.vcf";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base + " " + args, Arrays.asList(md5));
|
||||
executeTest("testHaplotypeCallerComplexGGA: args=" + args, spec);
|
||||
}
|
||||
|
|
@ -102,11 +99,11 @@ public class HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest extends Wa
|
|||
@Test
|
||||
public void testHaplotypeCallerMultiSampleGGAMultiAllelic() {
|
||||
HCTestComplexGGA(NA12878_CHR20_BAM, "-L 20:133041-133161 -L 20:300207-300337",
|
||||
"82b53501bc3254def885e09866377e7c");
|
||||
"d50cf0d1efd94227e930565a6d31de91");
|
||||
}
|
||||
|
||||
private void HCTestComplexConsensusMode(String bam, String args, String md5) {
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, bam) + " --no_cmdline_in_header -o %s -consensus -alleles " + validationDataLocation + "combined.phase1.chr20.raw.indels.sites.vcf -alleles " + validationDataLocation + "phase1.projectConsensus.chr20.raw.snps.vcf";
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, bam) + " --no_cmdline_in_header -o %s -consensus -alleles " + validationDataLocation + "combined.phase1.chr20.raw.indels.sites.vcf -alleles " + validationDataLocation + "phase1.projectConsensus.chr20.raw.snps.vcf";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base + " " + args, Arrays.asList(md5));
|
||||
executeTest("testHaplotypeCallerComplexConsensusMode: args=" + args, spec);
|
||||
}
|
||||
|
|
@ -114,7 +111,7 @@ public class HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest extends Wa
|
|||
@Test
|
||||
public void testHaplotypeCallerMultiSampleConsensusModeComplex() {
|
||||
HCTestComplexGGA(NA12878_CHR20_BAM, "-L 20:119673-119823 -L 20:121408-121538 -L 20:133041-133161 -L 20:300207-300337",
|
||||
"47894766b0ce7d4aecd89e4938ac1c85");
|
||||
"390236e17de3465c8ba778041f1670ad");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,9 +74,6 @@ import java.util.zip.GZIPInputStream;
|
|||
|
||||
public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
||||
|
||||
final static String HMM_SUB_IMPLEMENTATION = "UNVECTORIZED";
|
||||
final static String ALWAYS_LOAD_VECTOR_HMM = "-alwaysloadVectorHMM";
|
||||
|
||||
@DataProvider(name = "MyDataProviderHaploid")
|
||||
public Object[][] makeMyDataProviderHaploid() {
|
||||
List<Object[]> tests = new ArrayList<>();
|
||||
|
|
@ -164,8 +161,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
*/
|
||||
@Test(dataProvider = "MyDataProvider")
|
||||
public void testHCWithGVCF(String bam, ReferenceConfidenceMode mode, String intervals, String md5) {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s %s -ERC %s --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, bam, intervals, mode, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s %s -ERC %s --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
b37KGReference, bam, intervals, mode, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String name = "testHCWithGVCF bam=" + bam + " intervals= " + intervals + " gvcf= " + mode;
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(md5));
|
||||
executeTest(name, spec);
|
||||
|
|
@ -176,8 +173,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
*/
|
||||
@Test(dataProvider = "MyDataProviderHaploid", enabled=true)
|
||||
public void testHCWithGVCFHaploid(final String bam, final ReferenceConfidenceMode mode, final String intervals, final String md5) {
|
||||
final String commandLine = String.format("-T HaplotypeCaller -ploidy 1 --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s %s -ERC %s --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, bam, intervals, mode, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller -ploidy 1 --disableDithering --pcr_indel_model NONE -R %s -I %s %s -ERC %s --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
b37KGReference, bam, intervals, mode, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String name = "testHCWithGVCFHaploid bam=" + bam + " intervals= " + intervals + " gvcf= " + mode;
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(md5));
|
||||
executeTest(name, spec);
|
||||
|
|
@ -188,8 +185,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
*/
|
||||
@Test(dataProvider = "MyDataProviderTetraploid", enabled=true)
|
||||
public void testHCWithGVCFTetraploid(final String bam, final ReferenceConfidenceMode mode, final String intervals, final String md5) {
|
||||
final String commandLine = String.format("-T HaplotypeCaller -ploidy 4 --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s %s -ERC %s --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, bam, intervals, mode, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller -ploidy 4 --disableDithering --pcr_indel_model NONE -R %s -I %s %s -ERC %s --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
b37KGReference, bam, intervals, mode, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String name = "testHCWithGVCFTetraploid bam=" + bam + " intervals= " + intervals + " gvcf= " + mode;
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(md5));
|
||||
executeTest(name, spec);
|
||||
|
|
@ -200,8 +197,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
*/
|
||||
@Test(dataProvider = "MyDataProviderManyploid", enabled=true)
|
||||
public void testHCWithGVCFManyploid(final String bam, final ReferenceConfidenceMode mode, final String intervals, final String md5) {
|
||||
final String commandLine = String.format("-T HaplotypeCaller -ploidy 33 --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s %s -ERC %s --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, bam, intervals, mode, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller -ploidy 33 --disableDithering --pcr_indel_model NONE -R %s -I %s %s -ERC %s --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
b37KGReference, bam, intervals, mode, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String name = "testHCWithGVCFManyploid bam=" + bam + " intervals= " + intervals + " gvcf= " + mode;
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(md5));
|
||||
executeTest(name, spec);
|
||||
|
|
@ -209,8 +206,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test
|
||||
public void testERCRegionWithNoCalledHaplotypes() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000001-18000001", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF -variant_index_type %s -variant_index_parameter %d",
|
||||
b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000001-18000001", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(""));
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testERCRegionWithNoCalledHaplotypes", spec);
|
||||
|
|
@ -218,8 +215,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test()
|
||||
public void testMissingGVCFIndexException() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000001-18000001");
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF",
|
||||
b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000001-18000001");
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", 1, UserException.GVCFIndexException.class);
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testMissingGVCFIndexingStrategyException", spec);
|
||||
|
|
@ -230,8 +227,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
*/
|
||||
@Test()
|
||||
public void testGVCFIndexNoThrow() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000000-17000100");
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF",
|
||||
b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000000-17000100");
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(GATKVCFUtils.GVCF_EXT), Arrays.asList(""));
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testGVCFIndexNoThrow", spec);
|
||||
|
|
@ -243,8 +240,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
*/
|
||||
@Test()
|
||||
public void testGVCFGzIndexNoThrow() throws IOException {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000000-17000100");
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF",
|
||||
b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000000-17000100");
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine, Arrays.asList(""));
|
||||
final File outputFile = createTempFile("testGVCFGzIndexNoThrow", "." + GATKVCFUtils.GVCF_GZ_EXT);
|
||||
spec.setOutputFileLocation(outputFile);
|
||||
|
|
@ -255,8 +252,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test()
|
||||
public void testWrongParameterGVCFIndexException() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000001-18000001", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER + 1);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF -variant_index_type %s -variant_index_parameter %d",
|
||||
b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000001-18000001", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER + 1);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", 1, UserException.GVCFIndexException.class);
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testMissingGVCFIndexingStrategyException", spec);
|
||||
|
|
@ -269,8 +266,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
if (GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE == GATKVCFIndexType.DYNAMIC_SEEK)
|
||||
type = GATKVCFIndexType.DYNAMIC_SIZE;
|
||||
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000001-18000001", type, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF -variant_index_type %s -variant_index_parameter %d",
|
||||
b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000001-18000001", type, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", 1, UserException.GVCFIndexException.class);
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testMissingGVCFIndexingStrategyException", spec);
|
||||
|
|
@ -281,8 +278,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test()
|
||||
public void testWrongGVCFNonVariantRecordOrderBugFix() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, WRONG_GVCF_RECORD_ORDER_BUGFIX_BAM, WRONG_GVCF_RECORD_ORDER_BUGFIX_INTERVALS, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
b37KGReference, WRONG_GVCF_RECORD_ORDER_BUGFIX_BAM, WRONG_GVCF_RECORD_ORDER_BUGFIX_INTERVALS, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList("f70b7052dfeb065ee8c7d796f1a1f84a"));
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testMissingGVCFIndexingStrategyException", spec);
|
||||
|
|
@ -298,8 +295,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test
|
||||
public void testNoCallGVCFMissingPLsBugFix() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, NOCALL_GVCF_BUGFIX_BAM, NOCALL_GVCF_BUGFIX_INTERVALS, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d",
|
||||
b37KGReference, NOCALL_GVCF_BUGFIX_BAM, NOCALL_GVCF_BUGFIX_INTERVALS, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList("883fdc6c10fd7cbc1de375ed26ce5734"));
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testNoCallGVCFMissingPLsBugFix", spec);
|
||||
|
|
@ -310,8 +307,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
*/
|
||||
@Test(enabled=true)
|
||||
public void testGeneralPloidyArrayIndexBug1Fix() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -ploidy 1 -maxAltAlleles 2 -isr INTERSECTION -L 1:23696115-23696189",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, GENERAL_PLOIDY_BUGFIX1_BAM, GENERAL_PLOIDY_BUGFIX1_INTERVALS, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -ploidy 1 -maxAltAlleles 2 -isr INTERSECTION -L 1:23696115-23696189",
|
||||
b37KGReference, GENERAL_PLOIDY_BUGFIX1_BAM, GENERAL_PLOIDY_BUGFIX1_INTERVALS, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(""));
|
||||
spec.disableShadowBCF();
|
||||
executeTest(" testGeneralPloidyArrayIndexBug1Fix", spec);
|
||||
|
|
@ -322,8 +319,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
*/
|
||||
@Test(enabled=true)
|
||||
public void testGeneralPloidyArrayIndexBug2Fix() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -ploidy 2 -maxAltAlleles 2 -A DepthPerSampleHC -A StrandBiasBySample -L 1:38052860-38052937",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, GENERAL_PLOIDY_BUGFIX2_BAM, GENERAL_PLOIDY_BUGFIX2_INTERVALS, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -ploidy 2 -maxAltAlleles 2 -A DepthPerSampleHC -A StrandBiasBySample -L 1:38052860-38052937",
|
||||
b37KGReference, GENERAL_PLOIDY_BUGFIX2_BAM, GENERAL_PLOIDY_BUGFIX2_INTERVALS, GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(""));
|
||||
spec.disableShadowBCF();
|
||||
executeTest(" testGeneralPloidyArrayIndexBug2Fix", spec);
|
||||
|
|
@ -331,8 +328,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test
|
||||
public void testAlleleSpecificAnnotations() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -G Standard -G AS_Standard --disableDithering",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "NA12878.HiSeq.b37.chr20.10_11mb.bam", "20:10433000-10437000", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -G Standard -G AS_Standard --disableDithering",
|
||||
b37KGReference, privateTestDir + "NA12878.HiSeq.b37.chr20.10_11mb.bam", "20:10433000-10437000", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Collections.singletonList("7e74286e2c412855509ea5312ea0ec57"));
|
||||
spec.disableShadowBCF();
|
||||
executeTest(" testAlleleSpecificAnnotations", spec);
|
||||
|
|
@ -340,8 +337,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test
|
||||
public void testASMQMateRankSumAnnotation() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -A AS_MQMateRankSumTest --disableDithering",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "NA12878.HiSeq.b37.chr20.10_11mb.bam", "20:10433000-10437000", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -A AS_MQMateRankSumTest --disableDithering",
|
||||
b37KGReference, privateTestDir + "NA12878.HiSeq.b37.chr20.10_11mb.bam", "20:10433000-10437000", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Collections.singletonList("e0b9135f68eb0b65cb36721dd3f40f00"));
|
||||
spec.disableShadowBCF();
|
||||
executeTest(" testASMQMateRankSumAnnotation", spec);
|
||||
|
|
@ -349,8 +346,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test
|
||||
public void testBetaTestingAnnotationGroup() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -G BetaTesting --disableDithering",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "NA12878.HiSeq.b37.chr20.10_11mb.bam", "20:10433000-10437000", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -G BetaTesting --disableDithering",
|
||||
b37KGReference, privateTestDir + "NA12878.HiSeq.b37.chr20.10_11mb.bam", "20:10433000-10437000", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Collections.singletonList("81f1fcddfec262a8aaedb9ea37d89873"));
|
||||
spec.disableShadowBCF();
|
||||
executeTest(" testASMQMateRankSumAnnotation", spec);
|
||||
|
|
@ -358,8 +355,8 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test
|
||||
public void testASInsertSizeRankSum() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -G Standard -G AS_Standard --disableDithering -A AS_InsertSizeRankSum",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "NA12878.HiSeq.b37.chr20.10_11mb.bam", "20:10433000-10437000", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -ERC GVCF --no_cmdline_in_header -variant_index_type %s -variant_index_parameter %d -G Standard -G AS_Standard --disableDithering -A AS_InsertSizeRankSum",
|
||||
b37KGReference, privateTestDir + "NA12878.HiSeq.b37.chr20.10_11mb.bam", "20:10433000-10437000", GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Collections.singletonList("96934396683234559827a77c9bb38e21"));
|
||||
spec.disableShadowBCF();
|
||||
executeTest(" testASInsertSizeRankSum", spec);
|
||||
|
|
|
|||
|
|
@ -92,11 +92,9 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
final static String CEUTRIO_MT_TEST_BAM = privateTestDir + "CEUTrio.HiSeq.b37.MT.1_50.bam";
|
||||
final static String INTERVALS_FILE = validationDataLocation + "NA12878.HiSeq.b37.chr20.10_11mb.test.intervals";
|
||||
final static String GGA_INTERVALS_FILE = privateTestDir + "haplotype-caller-reduced-test-interval.list";
|
||||
final static String HMM_SUB_IMPLEMENTATION = "UNVECTORIZED";
|
||||
final static String ALWAYS_LOAD_VECTOR_HMM = "-alwaysloadVectorHMM";
|
||||
|
||||
private void HCTest(String bam, String args, String md5) throws IOException {
|
||||
final String base = String.format("-T HaplotypeCaller --contamination_fraction_to_filter 0.05 --disableDithering --pcr_indel_model NONE --maxReadsInRegionPerSample 1000 --minReadsPerAlignmentStart 5 --maxProbPropagationDistance 50 --activeProbabilityThreshold 0.002 -pairHMMSub %s %s -R %s -I %s -L %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, bam, INTERVALS_FILE) + " --no_cmdline_in_header -o %s -minPruning 3";
|
||||
final String base = String.format("-T HaplotypeCaller --contamination_fraction_to_filter 0.05 --disableDithering --pcr_indel_model NONE --maxReadsInRegionPerSample 1000 --minReadsPerAlignmentStart 5 --maxProbPropagationDistance 50 --activeProbabilityThreshold 0.002 -R %s -I %s -L %s", REF, bam, INTERVALS_FILE) + " --no_cmdline_in_header -o %s -minPruning 3";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base + " " + args, Arrays.asList(md5));
|
||||
final File outputVCF = executeTest("testHaplotypeCaller: args=" + args, spec).getFirst().get(0);
|
||||
Assert.assertFalse(FileUtils.readFileToString(outputVCF).contains(VCFConstants.MAPPING_QUALITY_ZERO_KEY));
|
||||
|
|
@ -229,7 +227,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
}
|
||||
|
||||
private void HCTestIndelQualityScores(String bam, String args, String md5) {
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, bam) + " -L 20:10,005,000-10,025,000 --no_cmdline_in_header -o %s -minPruning 2";
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, bam) + " -L 20:10,005,000-10,025,000 --no_cmdline_in_header -o %s -minPruning 2";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base + " " + args, Arrays.asList(md5));
|
||||
executeTest("testHaplotypeCallerIndelQualityScores: args=" + args, spec);
|
||||
}
|
||||
|
|
@ -244,7 +242,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
final ReferenceSequenceFile fasta = new IndexedFastaSequenceFile(new File(b37KGReference));
|
||||
final GenomeLocParser parser = new GenomeLocParser(fasta.getSequenceDictionary());
|
||||
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, bam) + " -L 20:10,001,603-10,001,642 -L 20:10,001,653-10,001,742 --no_cmdline_in_header -o %s";
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, bam) + " -L 20:10,001,603-10,001,642 -L 20:10,001,653-10,001,742 --no_cmdline_in_header -o %s";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base + " " + args, Arrays.asList(md5));
|
||||
for( final File vcf : executeTest("testHaplotypeCallerNearbySmallIntervals: args=" + args, spec).getFirst() ) {
|
||||
if( containsDuplicateRecord(vcf, parser) ) {
|
||||
|
|
@ -282,14 +280,14 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
// any of the calls in that region because it is so messy.
|
||||
@Test
|
||||
public void HCTestProblematicReadsModifiedInActiveRegions() {
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, privateTestDir + "haplotype-problem-4.bam") + " --no_cmdline_in_header -o %s -minPruning 3 -L 4:49139026-49139965";
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, privateTestDir + "haplotype-problem-4.bam") + " --no_cmdline_in_header -o %s -minPruning 3 -L 4:49139026-49139965";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base, Arrays.asList("eb79b4c0bf9142c955f0a4501e9e6d8f"));
|
||||
executeTest("HCTestProblematicReadsModifiedInActiveRegions: ", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void HCTestStructuralIndels() {
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, privateTestDir + "AFR.structural.indels.bam") + " --no_cmdline_in_header -o %s -minPruning 6 -L 20:8187565-8187800 -L 20:18670537-18670730";
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, privateTestDir + "AFR.structural.indels.bam") + " --no_cmdline_in_header -o %s -minPruning 6 -L 20:8187565-8187800 -L 20:18670537-18670730";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base, Arrays.asList("8bddb7f343302ed20bc549df4b82825a"));
|
||||
executeTest("HCTestStructuralIndels: ", spec);
|
||||
}
|
||||
|
|
@ -298,14 +296,14 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
public void HCTestDoesNotFailOnBadRefBase() {
|
||||
// don't care about the output - just want to make sure it doesn't fail
|
||||
final String outputVCF = createTempFile("temp", ".vcf").getAbsolutePath();
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, privateTestDir + "NA12878.readsOverBadBase.chr3.bam") + " --no_cmdline_in_header -o " + outputVCF + " -L 3:60830000-60840000 --minPruning 3 -stand_call_conf 2";
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering -R %s -I %s", REF, privateTestDir + "NA12878.readsOverBadBase.chr3.bam") + " --no_cmdline_in_header -o " + outputVCF + " -L 3:60830000-60840000 --minPruning 3 -stand_call_conf 2";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base, Collections.<String>emptyList());
|
||||
executeTest("HCTestDoesNotFailOnBadRefBase: ", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void HCTestDanglingTailMergingForDeletions() throws IOException {
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, NA12878_BAM) + " --no_cmdline_in_header -o %s -L 20:10130740-10130800 --allowNonUniqueKmersInRef";
|
||||
final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, NA12878_BAM) + " --no_cmdline_in_header -o %s -L 20:10130740-10130800 --allowNonUniqueKmersInRef";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base, 1, Arrays.asList(""));
|
||||
final File outputVCF = executeTest("HCTestDanglingTailMergingForDeletions", spec).getFirst().get(0);
|
||||
|
||||
|
|
@ -331,7 +329,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
public void testLeftAlignmentBamOutBugFix() throws FileNotFoundException {
|
||||
final String outputVCF = createTempFile("temp", ".vcf").getAbsolutePath();
|
||||
final String md5BAMOut = "27e729df3b166c81792a62a5b57ef7b3";
|
||||
final String base = String.format("-T HaplotypeCaller -pairHMMSub %s %s -R %s -I %s", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, LEFT_ALIGNMENT_BAMOUT_TEST_INPUT)
|
||||
final String base = String.format("-T HaplotypeCaller -R %s -I %s", REF, LEFT_ALIGNMENT_BAMOUT_TEST_INPUT)
|
||||
+ " --no_cmdline_in_header -bamout %s -o " + outputVCF + " -L 1:11740000-11740700 --allowNonUniqueKmersInRef";
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(base, 1, Arrays.asList(md5BAMOut));
|
||||
executeTest("LeftAlignmentBamOutBugFix", spec);
|
||||
|
|
@ -347,7 +345,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void HCTestDBSNPAnnotationWGS() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub " + HMM_SUB_IMPLEMENTATION + " " + ALWAYS_LOAD_VECTOR_HMM + " -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_PCRFREE + " -o %s -L 20:10,090,000-10,100,000 -D " + b37dbSNP132, 1,
|
||||
"-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_PCRFREE + " -o %s -L 20:10,090,000-10,100,000 -D " + b37dbSNP132, 1,
|
||||
Arrays.asList("fc71471b01f93bc531e3cf19cdf78b1f"));
|
||||
executeTest("HC calling with dbSNP ID annotation on WGS intervals", spec);
|
||||
}
|
||||
|
|
@ -355,7 +353,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void HCTestDBSNPAnnotationWEx() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -pairHMMSub " + HMM_SUB_IMPLEMENTATION + " " + ALWAYS_LOAD_VECTOR_HMM + " -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_PCRFREE + " -o %s -L 20:10,100,000-11,000,000 -D " + b37dbSNP132
|
||||
"-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_PCRFREE + " -o %s -L 20:10,100,000-11,000,000 -D " + b37dbSNP132
|
||||
+ " -L " + hg19Intervals + " -isr INTERSECTION", 1,
|
||||
Arrays.asList("bf8bb5d13b01facdf90ec24bfbf82faa"));
|
||||
executeTest("HC calling with dbSNP ID annotation on WEx intervals", spec);
|
||||
|
|
@ -364,7 +362,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void HCTestDBSNPAnnotationWGSGraphBased() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T HaplotypeCaller -likelihoodEngine GraphBased --disableDithering --pcr_indel_model NONE -pairHMMSub " + HMM_SUB_IMPLEMENTATION + " " + ALWAYS_LOAD_VECTOR_HMM + " -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_PCRFREE + " -o %s -L 20:10,090,000-10,100,000 -D " + b37dbSNP132, 1,
|
||||
"-T HaplotypeCaller -likelihoodEngine GraphBased --disableDithering --pcr_indel_model NONE -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_PCRFREE + " -o %s -L 20:10,090,000-10,100,000 -D " + b37dbSNP132, 1,
|
||||
Arrays.asList("dbae51c7903e088b2e62cbada6ea2d50"));
|
||||
executeTest("HC calling with dbSNP ID annotation on WGS intervals", spec);
|
||||
}
|
||||
|
|
@ -372,7 +370,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void HCTestDBSNPAnnotationWExGraphBased() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T HaplotypeCaller -likelihoodEngine GraphBased --disableDithering --pcr_indel_model NONE -pairHMMSub " + HMM_SUB_IMPLEMENTATION + " " + ALWAYS_LOAD_VECTOR_HMM + " -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_PCRFREE + " -o %s -L 20:10,000,000-11,000,000 -D " + b37dbSNP132
|
||||
"-T HaplotypeCaller -likelihoodEngine GraphBased --disableDithering --pcr_indel_model NONE -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_PCRFREE + " -o %s -L 20:10,000,000-11,000,000 -D " + b37dbSNP132
|
||||
+ " -L " + hg19Intervals + " -isr INTERSECTION", 1,
|
||||
Arrays.asList("2ffaf2e9ef293a6d5ce7c00be40edba7"));
|
||||
executeTest("HC calling with dbSNP ID annotation on WEx intervals", spec);
|
||||
|
|
@ -381,7 +379,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void HCTestGraphBasedPCRFreePositiveLogLkFix() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T HaplotypeCaller -likelihoodEngine GraphBased --disableDithering --pcr_indel_model NONE -pairHMMSub " + HMM_SUB_IMPLEMENTATION + " " + ALWAYS_LOAD_VECTOR_HMM + " -R " + hg19Reference + " --no_cmdline_in_header -I " + NA12878_PCRFREE250_ADAPTER_TRIMMED + " -o %s -L 20:10,024,000-10,024,500 "
|
||||
"-T HaplotypeCaller -likelihoodEngine GraphBased --disableDithering --pcr_indel_model NONE -R " + hg19Reference + " --no_cmdline_in_header -I " + NA12878_PCRFREE250_ADAPTER_TRIMMED + " -o %s -L 20:10,024,000-10,024,500 "
|
||||
, 1,
|
||||
Arrays.asList(""));
|
||||
executeTest("HCTestGraphBasedPCRFreePositiveLogLkFix", spec);
|
||||
|
|
@ -396,24 +394,24 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void HCTestAggressivePcrIndelModelWGS() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T HaplotypeCaller --disableDithering --pcr_indel_model AGGRESSIVE -pairHMMSub " + HMM_SUB_IMPLEMENTATION + " " + ALWAYS_LOAD_VECTOR_HMM + " -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_BAM + " -o %s -L 20:10,270,000-10,300,000", 1,
|
||||
Arrays.asList("8c3ae4dc3d8af2aa8c71deaadb26cc14"));
|
||||
"-T HaplotypeCaller --disableDithering --pcr_indel_model AGGRESSIVE -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_BAM + " -o %s -L 20:10,270,000-10,300,000", 1,
|
||||
Arrays.asList("7bd5bdfeb587a4c73f4c1cd8b850524f"));
|
||||
executeTest("HC calling with aggressive indel error modeling on WGS intervals", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void HCTestConservativePcrIndelModelWGS() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T HaplotypeCaller --disableDithering --pcr_indel_model CONSERVATIVE -pairHMMSub " + HMM_SUB_IMPLEMENTATION + " " + ALWAYS_LOAD_VECTOR_HMM + " -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_BAM + " -o %s -L 20:10,270,000-10,300,000", 1,
|
||||
Arrays.asList("61aef3fe9d18eec1df526e99a8456115"));
|
||||
"-T HaplotypeCaller --disableDithering --pcr_indel_model CONSERVATIVE -R " + b37KGReference + " --no_cmdline_in_header -I " + NA12878_BAM + " -o %s -L 20:10,270,000-10,300,000", 1,
|
||||
Arrays.asList("5c1b487b0e7e1353a9a549a50c91d96f"));
|
||||
executeTest("HC calling with conservative indel error modeling on WGS intervals", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoSuchEdgeBugFix() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -dontTrimActiveRegions -ERC GVCF " +
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -dontTrimActiveRegions -ERC GVCF " +
|
||||
"-likelihoodEngine GraphBased -variant_index_type %s -variant_index_parameter %d",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReferenceWithDecoy, privateTestDir + "graphbased_no_such_edge_bug.bam", privateTestDir + "graphbased_no_such_edge_bug.intervals.bed",
|
||||
b37KGReferenceWithDecoy, privateTestDir + "graphbased_no_such_edge_bug.bam", privateTestDir + "graphbased_no_such_edge_bug.intervals.bed",
|
||||
GATKVCFUtils.DEFAULT_GVCF_INDEX_TYPE, GATKVCFUtils.DEFAULT_GVCF_INDEX_PARAMETER);
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(""));
|
||||
spec.disableShadowBCF();
|
||||
|
|
@ -432,8 +430,8 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
// This test takes longer than 15 secs ... ~ 25-35 ,
|
||||
@Test
|
||||
public void testLackSensitivityDueToBadHaplotypeSelectionFix() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller -pairHMMSub %s %s -R %s -I %s -L %s --no_cmdline_in_header --maxNumHaplotypesInPopulation 16",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReferenceWithDecoy, privateTestDir + "hc-lack-sensitivity.bam", privateTestDir + "hc-lack-sensitivity.interval_list");
|
||||
final String commandLine = String.format("-T HaplotypeCaller -R %s -I %s -L %s --no_cmdline_in_header --maxNumHaplotypesInPopulation 16",
|
||||
b37KGReferenceWithDecoy, privateTestDir + "hc-lack-sensitivity.bam", privateTestDir + "hc-lack-sensitivity.interval_list");
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList("5087a8855b3ee9ea1091367674783462"));
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testLackSensitivityDueToBadHaplotypeSelectionFix", spec);
|
||||
|
|
@ -441,8 +439,8 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test
|
||||
public void testMissingKeyAlternativeHaplotypesBugFix() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller -pairHMMSub %s %s -R %s -I %s -L %s --no_cmdline_in_header ",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReferenceWithDecoy, privateTestDir + "lost-alt-key-hap.bam", privateTestDir + "lost-alt-key-hap.interval_list");
|
||||
final String commandLine = String.format("-T HaplotypeCaller -R %s -I %s -L %s --no_cmdline_in_header ",
|
||||
b37KGReferenceWithDecoy, privateTestDir + "lost-alt-key-hap.bam", privateTestDir + "lost-alt-key-hap.interval_list");
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList("e6d8c32585906122a6407cb40261d00d"));
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testMissingKeyAlternativeHaplotypesBugFix", spec);
|
||||
|
|
@ -455,9 +453,9 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
final String TEST_BAM = privateTestDir + "sw_epsilon_test.bam";
|
||||
final String REFERENCE = b37KGReference;
|
||||
final String DBSNP = b37dbSNP138;
|
||||
final String commandLineWithoutInterval = String.format("-T HaplotypeCaller -pairHMMSub %s %s -I %s -R %s -D %s "
|
||||
final String commandLineWithoutInterval = String.format("-T HaplotypeCaller -I %s -R %s -D %s "
|
||||
+ "-variant_index_type LINEAR -variant_index_parameter 128000 --no_cmdline_in_header "
|
||||
+ "-stand_call_conf 10.0", HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, TEST_BAM, REFERENCE, DBSNP);
|
||||
+ "-stand_call_conf 10.0", TEST_BAM, REFERENCE, DBSNP);
|
||||
|
||||
final String commandLineShortInterval = commandLineWithoutInterval + " -L " + SHORT_INTERVAL;
|
||||
final String commandLineLongInterval = commandLineWithoutInterval + " -L " + LONG_INTERVAL;
|
||||
|
|
@ -480,8 +478,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
" -T HaplotypeCaller" +
|
||||
" --contamination_fraction_to_filter 0.05 --disableDithering --pcr_indel_model NONE --maxReadsInRegionPerSample 1000 " +
|
||||
" --minReadsPerAlignmentStart 5 --maxProbPropagationDistance 50 --activeProbabilityThreshold 0.002 " +
|
||||
" --no_cmdline_in_header -minPruning 3 -pairHMM VECTOR_LOGLESS_CACHING -pairHMMSub TEST_BEYOND_CAPABILITIES " +
|
||||
ALWAYS_LOAD_VECTOR_HMM +
|
||||
" --no_cmdline_in_header -minPruning 3 -pairHMM VECTOR_LOGLESS_CACHING " +
|
||||
" -R " + REF +
|
||||
" -I " + NA12878_BAM +
|
||||
" -L " + INTERVALS_FILE +
|
||||
|
|
@ -496,7 +493,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
" -T HaplotypeCaller" +
|
||||
" --contamination_fraction_to_filter 0.05 --disableDithering --pcr_indel_model NONE --maxReadsInRegionPerSample 1000 " +
|
||||
" --minReadsPerAlignmentStart 5 --maxProbPropagationDistance 50 --activeProbabilityThreshold 0.002 " +
|
||||
" --no_cmdline_in_header -minPruning 3 -pairHMM VECTOR_LOGLESS_CACHING -pairHMMSub " + HMM_SUB_IMPLEMENTATION +
|
||||
" --no_cmdline_in_header -minPruning 3 -pairHMM VECTOR_LOGLESS_CACHING " +
|
||||
" -dcov 50" +
|
||||
" -R " + REF +
|
||||
" -I " + NA12878_BAM +
|
||||
|
|
@ -570,8 +567,8 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
final String md5 = "d41d8cd98f00b204e9800998ecf8427e";
|
||||
final String commandLine = String.format("-T HaplotypeCaller --contamination_fraction_to_filter 0.05 --disableDithering --maxReadsInRegionPerSample 1000" +
|
||||
" --minReadsPerAlignmentStart 5 --maxProbPropagationDistance 50 --activeProbabilityThreshold 0.002 --pcr_indel_model NONE" +
|
||||
" -pairHMMSub %s %s -R %s -I %s -L %s -minPruning 3 --no_cmdline_in_header",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, REF, NA12878_BAM, "20:10000000-10100000");
|
||||
" -R %s -I %s -L %s -minPruning 3 --no_cmdline_in_header",
|
||||
REF, NA12878_BAM, "20:10000000-10100000");
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine, Arrays.asList(md5));
|
||||
final File outputFile = createTempFile("testBCFInFileNameGivesVCF", ".bcftoolsFile.vcf");
|
||||
spec.setOutputFileLocation(outputFile);
|
||||
|
|
|
|||
|
|
@ -70,8 +70,6 @@ public class HaplotypeCallerModesIntegrationTest extends WalkerTest {
|
|||
//
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
final static String HMM_SUB_IMPLEMENTATION = "UNVECTORIZED";
|
||||
final static String ALWAYS_LOAD_VECTOR_HMM = "-alwaysloadVectorHMM";
|
||||
|
||||
@Test
|
||||
public void HCTestBamWriterCalledHaplotypes() {
|
||||
|
|
@ -86,7 +84,7 @@ public class HaplotypeCallerModesIntegrationTest extends WalkerTest {
|
|||
public void HCTestBamWriter(final HaplotypeBAMWriter.Type type, final String md5) {
|
||||
final String outputVCF = createTempFile("temp", ".vcf").getAbsolutePath();
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T HaplotypeCaller -pairHMMSub " + HMM_SUB_IMPLEMENTATION + " " + ALWAYS_LOAD_VECTOR_HMM + " -R " + b37KGReference +
|
||||
"-T HaplotypeCaller -R " + b37KGReference +
|
||||
" --no_cmdline_in_header -I " + privateTestDir + "PCRFree.2x250.Illumina.20_10_11.bam -o " + outputVCF +
|
||||
" -bamout %s -L 20:10,000,000-10,010,000 -bamWriterType " + type, 1,
|
||||
Arrays.asList(md5));
|
||||
|
|
|
|||
|
|
@ -61,8 +61,6 @@ import java.util.List;
|
|||
|
||||
public class HaplotypeCallerParallelIntegrationTest extends WalkerTest {
|
||||
|
||||
final static String HMM_SUB_IMPLEMENTATION = "UNVECTORIZED";
|
||||
final static String ALWAYS_LOAD_VECTOR_HMM = "-alwaysloadVectorHMM";
|
||||
|
||||
@DataProvider(name = "NCTDataProvider")
|
||||
public Object[][] makeNCTDataProvider() {
|
||||
|
|
@ -78,7 +76,7 @@ public class HaplotypeCallerParallelIntegrationTest extends WalkerTest {
|
|||
@Test(dataProvider = "NCTDataProvider")
|
||||
public void testHCNCT(final int nct, final String md5) {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub " + HMM_SUB_IMPLEMENTATION + " " + ALWAYS_LOAD_VECTOR_HMM + " -R " + b37KGReference + " --no_cmdline_in_header -I "
|
||||
"-T HaplotypeCaller --pcr_indel_model NONE -R " + b37KGReference + " --no_cmdline_in_header -I "
|
||||
+ privateTestDir + "PCRFree.2x250.Illumina.20_10_11.bam -o %s " +
|
||||
" -L 20:10,000,000-10,100,000 -G none -A none -contamination 0.0 -nct " + nct, 1,
|
||||
Arrays.asList(md5));
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public class PairHMMLikelihoodCalculationEngineUnitTest extends BaseTest {
|
|||
public void createPcrErrorModelTest(final String repeat, final int repeatLength) {
|
||||
|
||||
final PairHMMLikelihoodCalculationEngine engine = new PairHMMLikelihoodCalculationEngine((byte)0,
|
||||
PairHMM.HMM_IMPLEMENTATION.ORIGINAL, PairHMM.HMM_SUB_IMPLEMENTATION.UNVECTORIZED, false, 0.0, true,
|
||||
PairHMM.HMM_IMPLEMENTATION.ORIGINAL, null, 0.0, true,
|
||||
PairHMMLikelihoodCalculationEngine.PCR_ERROR_MODEL.CONSERVATIVE);
|
||||
|
||||
final String readString = Utils.dupString(repeat, repeatLength);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class ReadThreadingLikelihoodCalculationEngineUnitTest extends ActiveRegi
|
|||
//final PairHMMLikelihoodCalculationEngine fullPairHMM = new PairHMMLikelihoodCalculationEngine((byte)10, false,
|
||||
// PairHMM.HMM_IMPLEMENTATION.LOGLESS_CACHING, -3);
|
||||
final PairHMMLikelihoodCalculationEngine fullPairHMM = new PairHMMLikelihoodCalculationEngine((byte)10,
|
||||
PairHMM.HMM_IMPLEMENTATION.LOGLESS_CACHING, PairHMM.HMM_SUB_IMPLEMENTATION.UNVECTORIZED, true, Double.NEGATIVE_INFINITY,
|
||||
PairHMM.HMM_IMPLEMENTATION.LOGLESS_CACHING, null, Double.NEGATIVE_INFINITY,
|
||||
true, PairHMMLikelihoodCalculationEngine.PCR_ERROR_MODEL.NONE);
|
||||
|
||||
// When using likelihoods it should be around 0.05 since
|
||||
|
|
|
|||
|
|
@ -1,72 +0,0 @@
|
|||
Implementation overview:
|
||||
Created a new Java class called VectorLoglessPairHMM which extends LoglessPairHMM and
|
||||
overrides functions from both LoglessPairHMM and PairHMM.
|
||||
1. Constructor: Call base class constructors. Then, load the native library located in this
|
||||
directory and call an init function (with suffix 'jniInitializeClassFieldsAndMachineMask') in the
|
||||
library to determine fields ids for the members of classes JNIReadDataHolder and
|
||||
JNIHaplotypeDataHolders. The native code stores the field ids (struct offsets) for the classes and
|
||||
re-uses them for subsequent computations. Optionally, the user can disable the vector
|
||||
implementation, by using the 'mask' argument (see comments for a more detailed explanation).
|
||||
2. When the library is loaded, it invokes the constructor of the class LoadTimeInitializer (because
|
||||
a global variable g_load_time_initializer is declared in the library). This constructor
|
||||
(LoadTimeInitializer.cc) can be used to perform various initializations. Currently, it initializes
|
||||
two global function pointers to point to the function implementation that is supported on the
|
||||
machine (AVX/SSE/un-vectorized) on which the program is being run. The two pointers are for float
|
||||
and double respectively. The global function pointers are declared in utils.cc and are assigned in
|
||||
the function initialize_function_pointers() defined in utils.cc and invoked from the constructor of
|
||||
LoadTimeInitializer.
|
||||
Other initializations in LoadTimeInitializer:
|
||||
* ConvertChar::init - sets some masks for the vector implementation
|
||||
* FTZ for performance
|
||||
* stat counters = 0
|
||||
* debug structs (which are never used in non-debug mode)
|
||||
This initialization is done only once for the whole program.
|
||||
3. initialize(): To initialize the region for PairHMM. Pass haplotype bases to native code through
|
||||
the JNIHaplotypeDataHolder class. Since the haplotype list is common across multiple samples in
|
||||
computeReadLikelihoods(), we can pass the haplotype bases to the native code once and re-use across
|
||||
multiple samples.
|
||||
4. computeLikelihoods(): Copies array references for readBases/quals etc to array of
|
||||
JNIReadDataHolder objects. Invokes the JNI function to perform the computation and updates the
|
||||
likelihoodMap.
|
||||
The JNI function copies the byte array references into an array of testcase structs and invokes the
|
||||
compute_full_prob function through the function pointers initialized earlier.
|
||||
The primary native function called is
|
||||
Java_org_broadinstitute_sting_utils_pairhmm_VectorLoglessPairHMM_jniComputeLikelihoods. It uses
|
||||
standard JNI calls to get and return data from/to the Java class VectorLoglessPairHMM. The last
|
||||
argument to the function is the maximum number of OpenMP threads to use while computing PairHMM in
|
||||
C++. This option is set when the native function call is made from JNILoglessPairHMM
|
||||
computeLikelihoods - currently it is set to 12 (no logical reason).
|
||||
Note: OpenMP has been disabled for now - insufficient #testcases per call to computeLikelihoods() to
|
||||
justify multi-threading.
|
||||
5. finalizeRegion(): Releases the haplotype arrays initialized in step 3 - should be called at the
|
||||
end of every region (line 351 in PairHMMLikelihoodCalculationEngine).
|
||||
|
||||
Note: Debug code has been moved to a separate class DebugJNILoglessPairHMM.java.
|
||||
|
||||
Compiling:
|
||||
The native library (called libVectorLoglessPairHMM.so) can be compiled with icc (Intel C compiler)
|
||||
or gcc versions >= 4.8.1 that support AVX intrinsics. By default, the make process tries to invoke
|
||||
icc. To use gcc, edit the file 'pom.xml' (in this directory) and enable the environment variables
|
||||
USE_GCC,C_COMPILER and CPP_COMPILER (edit and uncomment lines 60-62).
|
||||
Using Maven:
|
||||
Type 'mvn install' in this directory - this will build the library (by invoking 'make') and copy the
|
||||
native library to the directory
|
||||
${sting-utils.basedir}/src/main/resources/org/broadinstitute/sting/utils/pairhmm
|
||||
The GATK maven build process (when run) will bundle the library into the StingUtils jar file from
|
||||
the copied directory.
|
||||
Simple build:
|
||||
cd src/main/c++
|
||||
make
|
||||
|
||||
Running:
|
||||
The default implementation of PairHMM is now VECTOR_LOGLESS_CACHING in HaplotypeCaller.java. To use
|
||||
the Java version, use the command line argument "--pair_hmm_implementation LOGLESS_CACHING". (see
|
||||
run.sh in src/main/c++).
|
||||
The native library is bundled with the StingUtils jar file. When HaplotypeCaller is invoked, then
|
||||
the library is unpacked from the jar file, copied to the /tmp directory (with a unique id) and
|
||||
loaded by the Java class VectorLoglessPairHMM in the constructor (if it has not been loaded
|
||||
already).
|
||||
The default library can be overridden by using the -Djava.library.path argument (see
|
||||
src/main/c++/run.sh for an example) for the JVM to pass the path to the library. If the library
|
||||
libVectorLoglessPairHMM.so can be found in java.library.path, then it is loaded and the 'packed'
|
||||
library is not used.
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.broadinstitute.gatk</groupId>
|
||||
<artifactId>gatk-root</artifactId>
|
||||
<version>3.8-SNAPSHOT</version>
|
||||
<relativePath>../../public/gatk-root</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>VectorPairHMM</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>Vectorized PairHMM native libraries</name>
|
||||
|
||||
<description>Builds a GNU/Linux x86_64 library of VectorPairHMM using icc (Intel C++ compiler). During install, copies it into gatk-utils. Neither tested nor expected to work on any other platform.</description>
|
||||
|
||||
<properties>
|
||||
<sourceEncoding>UTF-8</sourceEncoding>
|
||||
<project.build.sourceEncoding>${sourceEncoding}</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>${sourceEncoding}</project.reporting.outputEncoding>
|
||||
<gatk.basedir>${project.basedir}/../..</gatk.basedir>
|
||||
<gatk-utils.basedir>${gatk.basedir}/public/gatk-utils</gatk-utils.basedir>
|
||||
<!-- Where to place the library in gatk-utils -->
|
||||
<pairhmm.resources.directory>${gatk-utils.basedir}/src/main/resources/org/broadinstitute/gatk/utils/pairhmm</pairhmm.resources.directory>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Print out the architecture - works only on GNU/Linux x86_64 systems -->
|
||||
<!-- Neither tested nor expected to work on any other platform. -->
|
||||
<!-- Requires icc (Intel C++ compiler) to be in your PATH. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>display-info</goal>
|
||||
</goals>
|
||||
<phase>validate</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Run make -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<phase>compile</phase>
|
||||
<configuration>
|
||||
<executable>make</executable>
|
||||
<workingDirectory>src/main/c++</workingDirectory>
|
||||
<environmentVariables>
|
||||
<JRE_HOME>${java.home}</JRE_HOME>
|
||||
<!--<USE_GCC>1</USE_GCC>-->
|
||||
<!--<C_COMPILER>/opt/gcc-4.8.2/bin/gcc</C_COMPILER>-->
|
||||
<!--<CPP_COMPILER>/opt/gcc-4.8.2/bin/g++</CPP_COMPILER>-->
|
||||
<OUTPUT_DIR>${project.build.directory}</OUTPUT_DIR>
|
||||
</environmentVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Don't actually install this artifact into the user's repo -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Copy the built library into gatk-utils -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-install</id>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<phase>install</phase>
|
||||
<configuration>
|
||||
<outputDirectory>${pairhmm.resources.directory}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- pom.xml cleanup, always sort according to the definitions in gatk-root -->
|
||||
<plugin>
|
||||
<groupId>com.google.code.sortpom</groupId>
|
||||
<artifactId>maven-sortpom-plugin</artifactId>
|
||||
<configuration>
|
||||
<createBackupFile>false</createBackupFile>
|
||||
<predefinedSortOrder>custom_1</predefinedSortOrder>
|
||||
<lineSeparator>\n</lineSeparator>
|
||||
<encoding>${sourceEncoding}</encoding>
|
||||
<keepBlankLines>true</keepBlankLines>
|
||||
<sortDependencies>scope</sortDependencies>
|
||||
<nrOfIndentSpace>4</nrOfIndentSpace>
|
||||
<expandEmptyElements>false</expandEmptyElements>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
.svn
|
||||
*.o
|
||||
*.so
|
||||
tests
|
||||
.deps
|
||||
hmm_Mohammad
|
||||
pairhmm-template-main
|
||||
*.swp
|
||||
*.class
|
||||
checker
|
||||
reformat
|
||||
subdir_checkout.sh
|
||||
avx/
|
||||
sse/
|
||||
triplicate.sh
|
||||
|
||||
|
|
@ -1,205 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "utils.h"
|
||||
#include "LoadTimeInitializer.h"
|
||||
using namespace std;
|
||||
char* LoadTimeInitializerStatsNames[] =
|
||||
{
|
||||
"num_regions",
|
||||
"num_reads",
|
||||
"num_haplotypes",
|
||||
"num_testcases",
|
||||
"num_double_invocations",
|
||||
"haplotype_length",
|
||||
"readlength",
|
||||
"product_read_length_haplotype_length",
|
||||
"dummy"
|
||||
};
|
||||
|
||||
LoadTimeInitializer g_load_time_initializer;
|
||||
|
||||
LoadTimeInitializer::LoadTimeInitializer() //will be called when library is loaded
|
||||
{
|
||||
#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__INTEL_COMPILER)
|
||||
//compiles only with gcc >= 4.8
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
ConvertChar::init();
|
||||
#ifndef DISABLE_FTZ
|
||||
//Very important to get good performance on Intel processors
|
||||
//Function: enabling FTZ converts denormals to 0 in hardware
|
||||
//Denormals cause microcode to insert uops into the core causing big slowdown
|
||||
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
|
||||
//cout << "FTZ enabled - may decrease accuracy if denormal numbers encountered\n";
|
||||
#else
|
||||
cout << "FTZ is not set - may slow down performance if denormal numbers encountered\n";
|
||||
#endif
|
||||
//Profiling: times for compute and transfer (either bytes copied or pointers copied)
|
||||
m_compute_time = 0;
|
||||
m_data_transfer_time = 0;
|
||||
m_bytes_copied = 0;
|
||||
|
||||
//Initialize profiling counters
|
||||
for(unsigned i=0;i<TOTAL_NUMBER_STATS;++i)
|
||||
{
|
||||
m_sum_stats[i] = 0;
|
||||
m_sum_square_stats[i] = 0;
|
||||
m_max_stats[i] = 0;
|
||||
m_min_stats[i] = 0xFFFFFFFFFFFFFFFFull;
|
||||
}
|
||||
|
||||
//for debug dump
|
||||
m_filename_to_fptr.clear();
|
||||
m_written_files_set.clear();
|
||||
|
||||
initialize_function_pointers();
|
||||
|
||||
//Initialize static members of class
|
||||
Context<float>::initializeStaticMembers();
|
||||
Context<double>::initializeStaticMembers();
|
||||
|
||||
cout.flush();
|
||||
}
|
||||
|
||||
void LoadTimeInitializer::print_profiling()
|
||||
{
|
||||
double mean = 0;
|
||||
double variance = 0;
|
||||
uint64_t denominator = 1;
|
||||
cout << "Time spent in compute_testcases "<<m_compute_time*1e-9<<"\n";
|
||||
cout << "Time spent in data transfer (Java <--> C++) "<<m_data_transfer_time*1e-9<<"\n";
|
||||
|
||||
cout << "\nHC input stats\nstat_name,sum,sum_square,mean,variance,min,max\n";
|
||||
for(unsigned i=0;i<TOTAL_NUMBER_STATS;++i)
|
||||
{
|
||||
cout << LoadTimeInitializerStatsNames[i];
|
||||
cout << "," << m_sum_stats[i];
|
||||
cout << "," << std::scientific << m_sum_square_stats[i];
|
||||
denominator = 1;
|
||||
switch(i)
|
||||
{
|
||||
case NUM_READS_IDX:
|
||||
case NUM_HAPLOTYPES_IDX:
|
||||
case NUM_TESTCASES_IDX:
|
||||
denominator = m_sum_stats[NUM_REGIONS_IDX];
|
||||
break;
|
||||
case HAPLOTYPE_LENGTH_IDX:
|
||||
denominator = m_sum_stats[NUM_HAPLOTYPES_IDX];
|
||||
break;
|
||||
case READ_LENGTH_IDX:
|
||||
denominator = m_sum_stats[NUM_READS_IDX];
|
||||
break;
|
||||
case PRODUCT_READ_LENGTH_HAPLOTYPE_LENGTH_IDX:
|
||||
denominator = m_sum_stats[NUM_TESTCASES_IDX];
|
||||
break;
|
||||
default:
|
||||
denominator = 1;
|
||||
break;
|
||||
}
|
||||
mean = ((double)m_sum_stats[i])/denominator;
|
||||
cout << "," << std::scientific << mean;
|
||||
variance = (m_sum_square_stats[i]/denominator) - (mean*mean); //E(X^2)-(E(X))^2
|
||||
cout << "," << std::scientific << variance;
|
||||
cout << "," << m_min_stats[i];
|
||||
cout << "," << m_max_stats[i];
|
||||
cout << "\n";
|
||||
}
|
||||
cout << "\n";
|
||||
cout.flush();
|
||||
}
|
||||
|
||||
void LoadTimeInitializer::debug_dump(string filename, string s, bool to_append, bool add_newline)
|
||||
{
|
||||
map<string, ofstream*>::iterator mI = m_filename_to_fptr.find(filename);
|
||||
ofstream* fptr = 0;
|
||||
if(mI == m_filename_to_fptr.end())
|
||||
{
|
||||
m_filename_to_fptr[filename] = new ofstream();
|
||||
fptr = m_filename_to_fptr[filename];
|
||||
//File never seen before
|
||||
if(m_written_files_set.find(filename) == m_written_files_set.end())
|
||||
{
|
||||
to_append = false;
|
||||
m_written_files_set.insert(filename);
|
||||
}
|
||||
fptr->open(filename.c_str(), to_append ? ios::app : ios::out);
|
||||
assert(fptr->is_open());
|
||||
}
|
||||
else
|
||||
fptr = (*mI).second;
|
||||
//ofstream fptr;
|
||||
//fptr.open(filename.c_str(), to_append ? ofstream::app : ofstream::out);
|
||||
(*fptr) << s;
|
||||
if(add_newline)
|
||||
(*fptr) << "\n";
|
||||
//fptr.close();
|
||||
}
|
||||
void LoadTimeInitializer::debug_close()
|
||||
{
|
||||
for(map<string,ofstream*>::iterator mB = m_filename_to_fptr.begin(), mE = m_filename_to_fptr.end();
|
||||
mB != mE;mB++)
|
||||
{
|
||||
(*mB).second->close();
|
||||
delete (*mB).second;
|
||||
}
|
||||
m_filename_to_fptr.clear();
|
||||
}
|
||||
|
||||
void LoadTimeInitializer::dump_sandbox(testcase& tc, unsigned tc_idx, unsigned numReads, unsigned numHaplotypes)
|
||||
{
|
||||
unsigned haplotypeLength = tc.haplen;
|
||||
unsigned readLength = tc.rslen;
|
||||
ofstream& dumpFptr = m_sandbox_fptr;
|
||||
for(unsigned k=0;k<haplotypeLength;++k)
|
||||
dumpFptr<<(char)(tc.hap[k]);
|
||||
dumpFptr<<" ";
|
||||
for(unsigned k=0;k<readLength;++k)
|
||||
dumpFptr<<(char)(tc.rs[k]);
|
||||
dumpFptr<<" ";
|
||||
for(unsigned k=0;k<readLength;++k)
|
||||
dumpFptr<<(char)(tc.q[k]+33);
|
||||
dumpFptr<<" ";
|
||||
for(unsigned k=0;k<readLength;++k)
|
||||
dumpFptr<<(char)(tc.i[k]+33);
|
||||
dumpFptr<<" ";
|
||||
for(unsigned k=0;k<readLength;++k)
|
||||
dumpFptr<<(char)(tc.d[k]+33);
|
||||
dumpFptr<<" ";
|
||||
for(unsigned k=0;k<readLength;++k)
|
||||
dumpFptr<<(char)(tc.c[k]+33);
|
||||
if(tc_idx == 0) //new region
|
||||
dumpFptr << " "<< numReads << " "<<numHaplotypes;
|
||||
dumpFptr<<"\n";
|
||||
}
|
||||
|
||||
void LoadTimeInitializer::update_stat(LoadTimeInitializerStatsEnum stat_idx, uint64_t value)
|
||||
{
|
||||
m_sum_stats[stat_idx] += value;
|
||||
double v = value;
|
||||
m_sum_square_stats[stat_idx] += (v*v);
|
||||
m_max_stats[stat_idx] = std::max(m_max_stats[stat_idx], value);
|
||||
m_min_stats[stat_idx] = std::min(m_min_stats[stat_idx], value);
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LOAD_TIME_INITIALIZER_H
|
||||
#define LOAD_TIME_INITIALIZER_H
|
||||
#include "headers.h"
|
||||
#include <jni.h>
|
||||
/*#include "template.h"*/
|
||||
|
||||
enum LoadTimeInitializerStatsEnum
|
||||
{
|
||||
NUM_REGIONS_IDX=0,
|
||||
NUM_READS_IDX,
|
||||
NUM_HAPLOTYPES_IDX,
|
||||
NUM_TESTCASES_IDX,
|
||||
NUM_DOUBLE_INVOCATIONS_IDX,
|
||||
HAPLOTYPE_LENGTH_IDX,
|
||||
READ_LENGTH_IDX,
|
||||
PRODUCT_READ_LENGTH_HAPLOTYPE_LENGTH_IDX,
|
||||
TOTAL_NUMBER_STATS
|
||||
};
|
||||
extern char* LoadTimeInitializerStatsNames[];
|
||||
|
||||
class LoadTimeInitializer
|
||||
{
|
||||
public:
|
||||
LoadTimeInitializer(); //will be called when library is loaded
|
||||
void print_profiling();
|
||||
void debug_dump(std::string filename, std::string s, bool to_append, bool add_newline=true);
|
||||
void debug_close();
|
||||
|
||||
void dump_sandbox(testcase& tc, unsigned tc_idx, unsigned numReads, unsigned numHaplotypes);
|
||||
void open_sandbox() { m_sandbox_fptr.open("sandbox.txt", std::ios::app); }
|
||||
void close_sandbox() { m_sandbox_fptr.close(); }
|
||||
|
||||
jfieldID m_readBasesFID;
|
||||
jfieldID m_readQualsFID;
|
||||
jfieldID m_insertionGOPFID;
|
||||
jfieldID m_deletionGOPFID;
|
||||
jfieldID m_overallGCPFID;
|
||||
jfieldID m_haplotypeBasesFID;
|
||||
//profiling - update stats
|
||||
void update_stat(LoadTimeInitializerStatsEnum stat_idx, uint64_t value);
|
||||
//timing in nanoseconds
|
||||
uint64_t m_compute_time;
|
||||
uint64_t m_data_transfer_time;
|
||||
//bytes copied
|
||||
uint64_t m_bytes_copied;
|
||||
private:
|
||||
std::map<std::string, std::ofstream*> m_filename_to_fptr;
|
||||
std::set<std::string> m_written_files_set;
|
||||
std::ofstream m_sandbox_fptr;
|
||||
//used to compute various stats
|
||||
uint64_t m_sum_stats[TOTAL_NUMBER_STATS];
|
||||
double m_sum_square_stats[TOTAL_NUMBER_STATS];
|
||||
uint64_t m_min_stats[TOTAL_NUMBER_STATS];
|
||||
uint64_t m_max_stats[TOTAL_NUMBER_STATS];
|
||||
};
|
||||
extern LoadTimeInitializer g_load_time_initializer;
|
||||
|
||||
#define SIZE_PER_TESTCASE 6*10000
|
||||
#define SIZE_PER_BUFFER 10000
|
||||
|
||||
#endif
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
#Copyright (c) 2012 The Broad Institute
|
||||
|
||||
#Permission is hereby granted, free of charge, to any person
|
||||
#obtaining a copy of this software and associated documentation
|
||||
#files (the "Software"), to deal in the Software without
|
||||
#restriction, including without limitation the rights to use,
|
||||
#copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
#copies of the Software, and to permit persons to whom the
|
||||
#Software is furnished to do so, subject to the following
|
||||
#conditions:
|
||||
|
||||
#The above copyright notice and this permission notice shall be
|
||||
#included in all copies or substantial portions of the Software.
|
||||
|
||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
#OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
#NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
#HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
#WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
#FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
#THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
#OMPCFLAGS=-fopenmp
|
||||
#OMPLFLAGS=-fopenmp #-openmp-link static
|
||||
|
||||
#CFLAGS=-O2 -std=c++11 -W -Wall -march=corei7-avx -Wa,-q -pedantic $(OMPCFLAGS) -Wno-unknown-pragmas
|
||||
#CFLAGS=-O2 -W -Wall -march=corei7 -mfpmath=sse -msse4.2 -pedantic $(OMPCFLAGS) -Wno-unknown-pragmas
|
||||
|
||||
JRE_HOME?=/opt/jdk1.7.0_25/jre
|
||||
JNI_COMPILATION_FLAGS=-D_REENTRANT -fPIC -I${JRE_HOME}/../include -I${JRE_HOME}/../include/linux
|
||||
|
||||
#COMMON_COMPILATION_FLAGS=$(JNI_COMPILATION_FLAGS) -O3 -W -Wall -pedantic $(OMPCFLAGS) -Wno-unknown-pragmas
|
||||
COMMON_COMPILATION_FLAGS=$(JNI_COMPILATION_FLAGS) -O3 -Wall $(OMPCFLAGS) -Wno-unknown-pragmas -Wno-write-strings -Wno-unused-variable -Wno-unused-but-set-variable
|
||||
ifdef DISABLE_FTZ
|
||||
COMMON_COMPILATION_FLAGS+=-DDISABLE_FTZ
|
||||
endif
|
||||
|
||||
ifdef USE_GCC
|
||||
C_COMPILER?=gcc
|
||||
CPP_COMPILER?=g++
|
||||
AVX_FLAGS=-mavx
|
||||
SSE41_FLAGS=-msse4.1
|
||||
COMMON_COMPILATION_FLAGS+=-Wno-char-subscripts
|
||||
else
|
||||
C_COMPILER?=icc
|
||||
CPP_COMPILER?=icc
|
||||
AVX_FLAGS=-xAVX
|
||||
SSE41_FLAGS=-xSSE4.1
|
||||
LIBFLAGS=-static-intel
|
||||
ifdef DISABLE_FTZ
|
||||
COMMON_COMPILATION_FLAGS+=-no-ftz
|
||||
endif
|
||||
endif
|
||||
|
||||
LDFLAGS=-lm -lrt $(OMPLDFLAGS)
|
||||
|
||||
PAPI_DIR=/home/karthikg/softwares/papi-5.3.0
|
||||
ifdef USE_PAPI
|
||||
ifeq ($(USE_PAPI),1)
|
||||
COMMON_COMPILATION_FLAGS+=-I$(PAPI_DIR)/include -DUSE_PAPI
|
||||
LDFLAGS+=-L$(PAPI_DIR)/lib -lpapi
|
||||
endif
|
||||
endif
|
||||
|
||||
BIN=libVectorLoglessPairHMM.so pairhmm-template-main checker
|
||||
#BIN=checker
|
||||
|
||||
DEPDIR=.deps
|
||||
DF=$(DEPDIR)/$(*).d
|
||||
|
||||
#Common across libJNI and sandbox
|
||||
COMMON_SOURCES=utils.cc avx_function_instantiations.cc baseline.cc sse_function_instantiations.cc LoadTimeInitializer.cc
|
||||
#Part of libJNI
|
||||
LIBSOURCES=org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM.cc org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM.cc Sandbox.cc $(COMMON_SOURCES)
|
||||
SOURCES=$(LIBSOURCES) pairhmm-template-main.cc pairhmm-1-base.cc
|
||||
LIBOBJECTS=$(LIBSOURCES:.cc=.o)
|
||||
COMMON_OBJECTS=$(COMMON_SOURCES:.cc=.o)
|
||||
|
||||
|
||||
#No vectorization for these files
|
||||
NO_VECTOR_SOURCES=org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM.cc org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM.cc pairhmm-template-main.cc pairhmm-1-base.cc utils.cc baseline.cc LoadTimeInitializer.cc Sandbox.cc
|
||||
#Use -xAVX for these files
|
||||
AVX_SOURCES=avx_function_instantiations.cc
|
||||
#Use -xSSE4.2 for these files
|
||||
SSE_SOURCES=sse_function_instantiations.cc
|
||||
|
||||
NO_VECTOR_OBJECTS=$(NO_VECTOR_SOURCES:.cc=.o)
|
||||
AVX_OBJECTS=$(AVX_SOURCES:.cc=.o)
|
||||
SSE_OBJECTS=$(SSE_SOURCES:.cc=.o)
|
||||
$(NO_VECTOR_OBJECTS): CXXFLAGS=$(COMMON_COMPILATION_FLAGS)
|
||||
$(AVX_OBJECTS): CXXFLAGS=$(COMMON_COMPILATION_FLAGS) $(AVX_FLAGS)
|
||||
$(SSE_OBJECTS): CXXFLAGS=$(COMMON_COMPILATION_FLAGS) $(SSE41_FLAGS)
|
||||
OBJECTS=$(NO_VECTOR_OBJECTS) $(AVX_OBJECTS) $(SSE_OBJECTS)
|
||||
|
||||
all: $(BIN) Sandbox.class copied_lib
|
||||
|
||||
-include $(addprefix $(DEPDIR)/,$(SOURCES:.cc=.d))
|
||||
|
||||
checker: pairhmm-1-base.o $(COMMON_OBJECTS)
|
||||
$(CPP_COMPILER) $(OMPLFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
pairhmm-template-main: pairhmm-template-main.o $(COMMON_OBJECTS)
|
||||
$(CPP_COMPILER) $(OMPLFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
libVectorLoglessPairHMM.so: $(LIBOBJECTS)
|
||||
$(CPP_COMPILER) $(OMPLFLAGS) -shared $(LIBFLAGS) -o $@ $(LIBOBJECTS) ${LDFLAGS}
|
||||
|
||||
|
||||
$(OBJECTS): %.o: %.cc
|
||||
@mkdir -p $(DEPDIR)
|
||||
$(CPP_COMPILER) -c -MMD -MF $(DF) $(CXXFLAGS) $(OUTPUT_OPTION) $<
|
||||
|
||||
Sandbox.class: Sandbox.java
|
||||
javac Sandbox.java
|
||||
|
||||
copied_lib: libVectorLoglessPairHMM.so
|
||||
ifdef OUTPUT_DIR
|
||||
mkdir -p $(OUTPUT_DIR)
|
||||
rsync -a libVectorLoglessPairHMM.so $(OUTPUT_DIR)/
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -rf $(BIN) *.o $(DEPDIR) *.class
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "Sandbox.h"
|
||||
#include "org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM.h"
|
||||
#include "utils.h"
|
||||
#include "jni_common.h"
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniGetMachineType
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_Sandbox_jniGetMachineType
|
||||
(JNIEnv * env, jobject thisObj)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniInitializeClassFieldsAndMachineMask
|
||||
* Signature: (Ljava/lang/Class;Ljava/lang/Class;J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniInitializeClassFieldsAndMachineMask
|
||||
(JNIEnv* env, jobject thisObject, jclass readDataHolderClass, jclass haplotypeDataHolderClass, jlong mask)
|
||||
{
|
||||
Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniInitializeClassFieldsAndMachineMask(env, thisObject, readDataHolderClass,
|
||||
haplotypeDataHolderClass, mask);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniInitializeHaplotypes
|
||||
* Signature: (I[LSandbox/JNIHaplotypeDataHolderClass;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniInitializeHaplotypes
|
||||
(JNIEnv * env, jobject thisObject, jint numHaplotypes, jobjectArray haplotypeDataArray)
|
||||
{
|
||||
Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniInitializeHaplotypes(env, thisObject, numHaplotypes, haplotypeDataArray);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniFinalizeRegion
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniFinalizeRegion
|
||||
(JNIEnv * env, jobject thisObject)
|
||||
{
|
||||
Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniFinalizeRegion(env, thisObject);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniComputeLikelihoods
|
||||
* Signature: (II[LSandbox/JNIReadDataHolderClass;[LSandbox/JNIHaplotypeDataHolderClass;[DI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniComputeLikelihoods
|
||||
(JNIEnv* env, jobject thisObject, jint numReads, jint numHaplotypes,
|
||||
jobjectArray readDataArray, jobjectArray haplotypeDataArray, jdoubleArray likelihoodArray, jint maxNumThreadsToUse)
|
||||
{
|
||||
Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniComputeLikelihoods(env, thisObject,
|
||||
numReads, numHaplotypes, readDataArray, haplotypeDataArray, likelihoodArray, maxNumThreadsToUse);
|
||||
}
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniClose
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniClose
|
||||
(JNIEnv* env, jobject thisObject)
|
||||
{ Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniClose(env, thisObject); }
|
||||
|
||||
JNIEXPORT void JNICALL Java_Sandbox_doEverythingNative
|
||||
(JNIEnv* env, jobject thisObject, jstring fileNameString)
|
||||
{
|
||||
const char* fileName = env->GetStringUTFChars(fileNameString, 0);
|
||||
char local_array[800];
|
||||
strncpy(local_array, fileName, 200);
|
||||
env->ReleaseStringUTFChars(fileNameString, fileName);
|
||||
do_compute(local_array, true, 10000, false);
|
||||
}
|
||||
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class Sandbox */
|
||||
|
||||
#ifndef _Included_Sandbox
|
||||
#define _Included_Sandbox
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef Sandbox_enableAll
|
||||
#define Sandbox_enableAll -1LL
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniGetMachineType
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_Sandbox_jniGetMachineType
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniInitializeClassFieldsAndMachineMask
|
||||
* Signature: (Ljava/lang/Class;Ljava/lang/Class;J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniInitializeClassFieldsAndMachineMask
|
||||
(JNIEnv *, jobject, jclass, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniInitializeHaplotypes
|
||||
* Signature: (I[LSandbox/JNIHaplotypeDataHolderClass;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniInitializeHaplotypes
|
||||
(JNIEnv *, jobject, jint, jobjectArray);
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniFinalizeRegion
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniFinalizeRegion
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniComputeLikelihoods
|
||||
* Signature: (II[LSandbox/JNIReadDataHolderClass;[LSandbox/JNIHaplotypeDataHolderClass;[DI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniComputeLikelihoods
|
||||
(JNIEnv *, jobject, jint, jint, jobjectArray, jobjectArray, jdoubleArray, jint);
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: jniClose
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_jniClose
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: Sandbox
|
||||
* Method: doEverythingNative
|
||||
* Signature: ([B)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_Sandbox_doEverythingNative
|
||||
(JNIEnv *, jobject, jstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,306 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2016 Broad Institute, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.gatk.utils.vectorpairhmm;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.io.File;
|
||||
import java.util.Scanner;
|
||||
import java.io.IOException;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class Sandbox {
|
||||
|
||||
private long setupTime = 0;
|
||||
private long computeTime = 0;
|
||||
//Used to copy references to byteArrays to JNI from reads
|
||||
protected class JNIReadDataHolderClass {
|
||||
public byte[] readBases = null;
|
||||
public byte[] readQuals = null;
|
||||
public byte[] insertionGOP = null;
|
||||
public byte[] deletionGOP = null;
|
||||
public byte[] overallGCP = null;
|
||||
}
|
||||
|
||||
//Used to copy references to byteArrays to JNI from haplotypes
|
||||
protected class JNIHaplotypeDataHolderClass {
|
||||
public byte[] haplotypeBases = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return 64-bit mask representing machine capabilities
|
||||
* Bit 0 is LSB, bit 63 MSB
|
||||
* Bit 0 represents sse4.2 availability
|
||||
* Bit 1 represents AVX availability
|
||||
*/
|
||||
public native long jniGetMachineType();
|
||||
public static final long enableAll = 0xFFFFFFFFFFFFFFFFl;
|
||||
|
||||
|
||||
/**
|
||||
* Function to initialize the fields of JNIReadDataHolderClass and JNIHaplotypeDataHolderClass from JVM.
|
||||
* C++ codegets FieldIDs for these classes once and re-uses these IDs for the remainder of the program. Field IDs do not
|
||||
* change per JVM session
|
||||
* @param readDataHolderClass class type of JNIReadDataHolderClass
|
||||
* @param haplotypeDataHolderClass class type of JNIHaplotypeDataHolderClass
|
||||
* @param mask 64 bit integer identical to the one received from jniGetMachineType(). Users can disable usage of some hardware features by zeroing bits in the mask
|
||||
* */
|
||||
private native void jniInitializeClassFieldsAndMachineMask(Class<?> readDataHolderClass, Class<?> haplotypeDataHolderClass, long mask);
|
||||
|
||||
private static Boolean isVectorLoglessPairHMMLibraryLoaded = false;
|
||||
//The constructor is called only once inside PairHMMLikelihoodCalculationEngine
|
||||
public Sandbox() {
|
||||
synchronized(isVectorLoglessPairHMMLibraryLoaded) {
|
||||
//Load the library and initialize the FieldIDs
|
||||
if(!isVectorLoglessPairHMMLibraryLoaded) {
|
||||
System.loadLibrary("VectorLoglessPairHMM");
|
||||
isVectorLoglessPairHMMLibraryLoaded = true;
|
||||
jniInitializeClassFieldsAndMachineMask(JNIReadDataHolderClass.class, JNIHaplotypeDataHolderClass.class, enableAll); //need to do this only once
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private native void jniInitializeHaplotypes(final int numHaplotypes, JNIHaplotypeDataHolderClass[] haplotypeDataArray);
|
||||
private JNIHaplotypeDataHolderClass[] mHaplotypeDataArray = null;
|
||||
|
||||
//Used to transfer data to JNI
|
||||
//Since the haplotypes are the same for all calls to computeLikelihoods within a region, transfer the haplotypes only once to the JNI per region
|
||||
public void initialize(final List<JNIHaplotypeDataHolderClass> haplotypes) {
|
||||
int numHaplotypes = haplotypes.size();
|
||||
mHaplotypeDataArray = new JNIHaplotypeDataHolderClass[numHaplotypes];
|
||||
int idx = 0;
|
||||
for(final JNIHaplotypeDataHolderClass currHaplotype : haplotypes)
|
||||
{
|
||||
mHaplotypeDataArray[idx] = new JNIHaplotypeDataHolderClass();
|
||||
mHaplotypeDataArray[idx].haplotypeBases = currHaplotype.haplotypeBases;
|
||||
++idx;
|
||||
}
|
||||
jniInitializeHaplotypes(numHaplotypes, mHaplotypeDataArray);
|
||||
}
|
||||
/**
|
||||
* Tell JNI to release arrays - really important if native code is directly accessing Java memory, if not
|
||||
* accessing Java memory directly, still important to release memory from C++
|
||||
*/
|
||||
private native void jniFinalizeRegion();
|
||||
|
||||
|
||||
public void finalizeRegion()
|
||||
{
|
||||
jniFinalizeRegion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Real compute kernel
|
||||
*/
|
||||
private native void jniComputeLikelihoods(int numReads, int numHaplotypes, JNIReadDataHolderClass[] readDataArray,
|
||||
JNIHaplotypeDataHolderClass[] haplotypeDataArray, double[] likelihoodArray, int maxNumThreadsToUse);
|
||||
|
||||
public void computeLikelihoods(final List<JNIReadDataHolderClass> reads, final List<JNIHaplotypeDataHolderClass> haplotypes) {
|
||||
//System.out.println("Region : "+reads.size()+" x "+haplotypes.size());
|
||||
long startTime = System.nanoTime();
|
||||
int readListSize = reads.size();
|
||||
int numHaplotypes = haplotypes.size();
|
||||
int numTestcases = readListSize*numHaplotypes;
|
||||
JNIReadDataHolderClass[] readDataArray = new JNIReadDataHolderClass[readListSize];
|
||||
int idx = 0;
|
||||
for(JNIReadDataHolderClass read : reads)
|
||||
{
|
||||
readDataArray[idx] = new JNIReadDataHolderClass();
|
||||
readDataArray[idx].readBases = read.readBases;
|
||||
readDataArray[idx].readQuals = read.readQuals;
|
||||
readDataArray[idx].insertionGOP = read.insertionGOP;
|
||||
readDataArray[idx].deletionGOP = read.deletionGOP;
|
||||
readDataArray[idx].overallGCP = read.overallGCP;
|
||||
++idx;
|
||||
}
|
||||
|
||||
double[] mLikelihoodArray = new double[readListSize*numHaplotypes]; //to store results
|
||||
setupTime += (System.nanoTime() - startTime);
|
||||
//for(reads)
|
||||
// for(haplotypes)
|
||||
// compute_full_prob()
|
||||
jniComputeLikelihoods(readListSize, numHaplotypes, readDataArray, mHaplotypeDataArray, mLikelihoodArray, 12);
|
||||
|
||||
computeTime += (System.nanoTime() - startTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print final profiling information from native code
|
||||
*/
|
||||
public native void jniClose();
|
||||
public void close()
|
||||
{
|
||||
System.err.println("Time spent in setup for JNI call : " + (setupTime * 1e-9) + " compute time : " + (computeTime * 1e-9));
|
||||
jniClose();
|
||||
}
|
||||
|
||||
public void parseSandboxFile(String filename)
|
||||
{
|
||||
File file = new File(filename);
|
||||
Scanner input = null;
|
||||
try
|
||||
{
|
||||
input = new Scanner(file);
|
||||
}
|
||||
catch(FileNotFoundException e)
|
||||
{
|
||||
System.err.println("File "+filename + " cannot be found/read");
|
||||
return;
|
||||
}
|
||||
int idx = 0;
|
||||
int numReads = 0;
|
||||
int numHaplotypes = 0;
|
||||
int readIdx = 0, testCaseIdx = 0, haplotypeIdx = 0;
|
||||
LinkedList<JNIHaplotypeDataHolderClass> haplotypeList = new LinkedList<JNIHaplotypeDataHolderClass>();
|
||||
LinkedList<JNIReadDataHolderClass> readList = new LinkedList<JNIReadDataHolderClass>();
|
||||
|
||||
byte[][] byteArray = new byte[6][];
|
||||
boolean firstLine = true;
|
||||
String[] currTokens = new String[8];
|
||||
while(input.hasNextLine())
|
||||
{
|
||||
String line = input.nextLine();
|
||||
Scanner lineScanner = new Scanner(line);
|
||||
idx = 0;
|
||||
while(lineScanner.hasNext())
|
||||
currTokens[idx++] = lineScanner.next();
|
||||
if(idx == 0)
|
||||
break;
|
||||
assert(idx >= 6);
|
||||
//start of new region
|
||||
if(idx == 8)
|
||||
{
|
||||
if(!firstLine)
|
||||
{
|
||||
initialize(haplotypeList);
|
||||
computeLikelihoods(readList, haplotypeList);
|
||||
finalizeRegion();
|
||||
}
|
||||
try
|
||||
{
|
||||
numReads = Integer.parseInt(currTokens[6]);
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
numReads = 1;
|
||||
}
|
||||
try
|
||||
{
|
||||
numHaplotypes = Integer.parseInt(currTokens[7]);
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
numHaplotypes = 1;
|
||||
}
|
||||
haplotypeIdx = readIdx = testCaseIdx = 0;
|
||||
readList.clear();
|
||||
haplotypeList.clear();
|
||||
}
|
||||
if(haplotypeIdx < numHaplotypes)
|
||||
{
|
||||
JNIHaplotypeDataHolderClass X = new JNIHaplotypeDataHolderClass();
|
||||
X.haplotypeBases = currTokens[0].getBytes();
|
||||
haplotypeList.add(X);
|
||||
}
|
||||
if(testCaseIdx%numHaplotypes == 0)
|
||||
{
|
||||
JNIReadDataHolderClass X = new JNIReadDataHolderClass();
|
||||
X.readBases = currTokens[1].getBytes();
|
||||
for(int i=2;i<6;++i)
|
||||
{
|
||||
byteArray[i] = currTokens[i].getBytes();
|
||||
for(int j=0;j<byteArray[i].length;++j)
|
||||
byteArray[i][j] -= 33; //normalize
|
||||
}
|
||||
X.readQuals = byteArray[2];
|
||||
X.insertionGOP = byteArray[3];
|
||||
X.deletionGOP = byteArray[4];
|
||||
X.overallGCP = byteArray[5];
|
||||
readList.add(X);
|
||||
}
|
||||
++testCaseIdx;
|
||||
++haplotypeIdx;
|
||||
|
||||
lineScanner.close();
|
||||
firstLine = false;
|
||||
}
|
||||
if(haplotypeList.size() > 0 && readList.size() > 0)
|
||||
{
|
||||
initialize(haplotypeList);
|
||||
computeLikelihoods(readList, haplotypeList);
|
||||
finalizeRegion();
|
||||
}
|
||||
|
||||
close();
|
||||
input.close();
|
||||
}
|
||||
|
||||
private native void doEverythingNative(String filename);
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
if(args.length <= 0)
|
||||
{
|
||||
System.err.println("Needs 1 argument - <filename>");
|
||||
System.exit(-1);
|
||||
}
|
||||
//// Get runtime
|
||||
//java.lang.Runtime rt = java.lang.Runtime.getRuntime();
|
||||
//// Start a new process: UNIX command ls
|
||||
//String cmd = "/home/karthikg/broad/gsa-unstable/public/c++/VectorPairHMM/checker "+args[0];
|
||||
//try
|
||||
//{
|
||||
//System.out.println(cmd);
|
||||
//java.lang.Process p = rt.exec(cmd);
|
||||
//try
|
||||
//{
|
||||
//p.waitFor();
|
||||
//java.io.InputStream is = p.getInputStream();
|
||||
//java.io.BufferedReader reader = new java.io.BufferedReader(new InputStreamReader(is));
|
||||
//// And print each line
|
||||
//String s = null;
|
||||
//while ((s = reader.readLine()) != null) {
|
||||
//System.out.println(s);
|
||||
//}
|
||||
//is.close();
|
||||
//}
|
||||
//catch(InterruptedException e)
|
||||
//{
|
||||
//System.err.println(e);
|
||||
//}
|
||||
//}
|
||||
//catch(IOException e)
|
||||
//{
|
||||
//System.err.println(e);
|
||||
//}
|
||||
Sandbox t = new Sandbox();
|
||||
//t.doEverythingNative(args[0]);
|
||||
t.parseSandboxFile(args[0]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class Sandbox_JNIHaplotypeDataHolderClass */
|
||||
|
||||
#ifndef _Included_Sandbox_JNIHaplotypeDataHolderClass
|
||||
#define _Included_Sandbox_JNIHaplotypeDataHolderClass
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class Sandbox_JNIReadDataHolderClass */
|
||||
|
||||
#ifndef _Included_Sandbox_JNIReadDataHolderClass
|
||||
#define _Included_Sandbox_JNIReadDataHolderClass
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#undef SIMD_ENGINE
|
||||
#undef SIMD_ENGINE_SSE
|
||||
|
||||
#define SIMD_ENGINE avx
|
||||
#define SIMD_ENGINE_AVX
|
||||
|
||||
#include "template.h"
|
||||
|
||||
#include "define-float.h"
|
||||
#include "shift_template.c"
|
||||
#include "pairhmm-template-kernel.cc"
|
||||
|
||||
#include "define-double.h"
|
||||
#include "shift_template.c"
|
||||
#include "pairhmm-template-kernel.cc"
|
||||
|
||||
template double compute_full_prob_avxd<double>(testcase* tc, double* nextlog);
|
||||
template float compute_full_prob_avxs<float>(testcase* tc, float* nextlog);
|
||||
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "headers.h"
|
||||
#include "common_data_structure.h"
|
||||
#include "utils.h"
|
||||
#include "LoadTimeInitializer.h"
|
||||
using namespace std;
|
||||
|
||||
template<class NUMBER>
|
||||
NUMBER compute_full_prob(testcase *tc, NUMBER *before_last_log)
|
||||
{
|
||||
int r, c;
|
||||
int ROWS = tc->rslen + 1;
|
||||
int COLS = tc->haplen + 1;
|
||||
|
||||
Context<NUMBER> ctx;
|
||||
//#define USE_STACK_ALLOCATION 1
|
||||
#ifdef USE_STACK_ALLOCATION
|
||||
NUMBER M[ROWS][COLS];
|
||||
NUMBER X[ROWS][COLS];
|
||||
NUMBER Y[ROWS][COLS];
|
||||
NUMBER p[ROWS][6];
|
||||
#else
|
||||
//allocate on heap in way that simulates a 2D array. Having a 2D array instead of
|
||||
//a straightforward array of pointers ensures that all data lies 'close' in memory, increasing
|
||||
//the chance of being stored together in the cache. Also, prefetchers can learn memory access
|
||||
//patterns for 2D arrays, not possible for array of pointers
|
||||
//NUMBER* common_buffer = 0;
|
||||
NUMBER* common_buffer = new NUMBER[3*ROWS*COLS + ROWS*6];
|
||||
//pointers to within the allocated buffer
|
||||
NUMBER** common_pointer_buffer = new NUMBER*[4*ROWS];
|
||||
NUMBER* ptr = common_buffer;
|
||||
unsigned i = 0;
|
||||
for(i=0;i<3*ROWS;++i, ptr+=COLS)
|
||||
common_pointer_buffer[i] = ptr;
|
||||
for(;i<4*ROWS;++i, ptr+=6)
|
||||
common_pointer_buffer[i] = ptr;
|
||||
|
||||
NUMBER** M = common_pointer_buffer;
|
||||
NUMBER** X = M + ROWS;
|
||||
NUMBER** Y = X + ROWS;
|
||||
NUMBER** p = Y + ROWS;
|
||||
#endif
|
||||
|
||||
|
||||
p[0][MM] = ctx._(0.0);
|
||||
p[0][GapM] = ctx._(0.0);
|
||||
p[0][MX] = ctx._(0.0);
|
||||
p[0][XX] = ctx._(0.0);
|
||||
p[0][MY] = ctx._(0.0);
|
||||
p[0][YY] = ctx._(0.0);
|
||||
|
||||
for (r = 1; r < ROWS; r++)
|
||||
{
|
||||
int _i = tc->i[r-1] & 127;
|
||||
int _d = tc->d[r-1] & 127;
|
||||
int _c = tc->c[r-1] & 127;
|
||||
//p[r][MM] = ctx._(1.0) - ctx.ph2pr[(_i + _d) & 127];
|
||||
SET_MATCH_TO_MATCH_PROB(p[r][MM], _i, _d);
|
||||
p[r][GapM] = ctx._(1.0) - ctx.ph2pr[_c];
|
||||
p[r][MX] = ctx.ph2pr[_i];
|
||||
p[r][XX] = ctx.ph2pr[_c];
|
||||
p[r][MY] = ctx.ph2pr[_d];
|
||||
p[r][YY] = ctx.ph2pr[_c];
|
||||
//p[r][MY] = (r == ROWS - 1) ? ctx._(1.0) : ctx.ph2pr[_d];
|
||||
//p[r][YY] = (r == ROWS - 1) ? ctx._(1.0) : ctx.ph2pr[_c];
|
||||
}
|
||||
for (c = 0; c < COLS; c++)
|
||||
{
|
||||
M[0][c] = ctx._(0.0);
|
||||
X[0][c] = ctx._(0.0);
|
||||
Y[0][c] = ctx.INITIAL_CONSTANT / (tc->haplen);
|
||||
}
|
||||
|
||||
for (r = 1; r < ROWS; r++)
|
||||
{
|
||||
M[r][0] = ctx._(0.0);
|
||||
X[r][0] = X[r-1][0] * p[r][XX];
|
||||
Y[r][0] = ctx._(0.0);
|
||||
}
|
||||
|
||||
NUMBER result = ctx._(0.0);
|
||||
|
||||
for (r = 1; r < ROWS; r++)
|
||||
for (c = 1; c < COLS; c++)
|
||||
{
|
||||
fexcept_t flagp;
|
||||
char _rs = tc->rs[r-1];
|
||||
char _hap = tc->hap[c-1];
|
||||
int _q = tc->q[r-1] & 127;
|
||||
NUMBER distm = ctx.ph2pr[_q];
|
||||
if (_rs == _hap || _rs == 'N' || _hap == 'N')
|
||||
distm = ctx._(1.0) - distm;
|
||||
else
|
||||
distm = distm/3;
|
||||
|
||||
|
||||
//feclearexcept(FE_ALL_EXCEPT);
|
||||
M[r][c] = distm * (M[r-1][c-1] * p[r][MM] + X[r-1][c-1] * p[r][GapM] + Y[r-1][c-1] * p[r][GapM]);
|
||||
//STORE_FP_EXCEPTIONS(flagp, exceptions_array);
|
||||
|
||||
//feclearexcept(FE_ALL_EXCEPT);
|
||||
X[r][c] = M[r-1][c] * p[r][MX] + X[r-1][c] * p[r][XX];
|
||||
//STORE_FP_EXCEPTIONS(flagp, exceptions_array);
|
||||
|
||||
//feclearexcept(FE_ALL_EXCEPT);
|
||||
Y[r][c] = M[r][c-1] * p[r][MY] + Y[r][c-1] * p[r][YY];
|
||||
//STORE_FP_EXCEPTIONS(flagp, exceptions_array);
|
||||
|
||||
//CONVERT_AND_PRINT(M[r][c]);
|
||||
//CONVERT_AND_PRINT(X[r][c]);
|
||||
//CONVERT_AND_PRINT(Y[r][c]);
|
||||
|
||||
}
|
||||
for (c = 0; c < COLS; c++)
|
||||
{
|
||||
result += M[ROWS-1][c] + X[ROWS-1][c];
|
||||
}
|
||||
|
||||
if (before_last_log != NULL)
|
||||
*before_last_log = result;
|
||||
|
||||
#ifndef USE_STACK_ALLOCATION
|
||||
delete[] common_pointer_buffer;
|
||||
delete[] common_buffer;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
//return ctx.LOG10(result) - ctx.LOG10_INITIAL_CONSTANT;
|
||||
}
|
||||
|
||||
template double compute_full_prob<double>(testcase* tc, double* nextbuf);
|
||||
template float compute_full_prob<float>(testcase* tc, float* nextbuf);
|
||||
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
#ifndef COMMON_DATA_STRUCTURE_H
|
||||
#define COMMON_DATA_STRUCTURE_H
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
#define CAT(X,Y) X####Y
|
||||
#define CONCAT(X,Y) CAT(X,Y)
|
||||
|
||||
#define MM 0
|
||||
#define GapM 1
|
||||
#define MX 2
|
||||
#define XX 3
|
||||
#define MY 4
|
||||
#define YY 5
|
||||
|
||||
//#define MROWS 500
|
||||
//#define MCOLS 1000
|
||||
|
||||
|
||||
#define MAX_QUAL 254
|
||||
#define MAX_JACOBIAN_TOLERANCE 8.0
|
||||
#define JACOBIAN_LOG_TABLE_STEP 0.0001
|
||||
#define JACOBIAN_LOG_TABLE_INV_STEP (1.0 / JACOBIAN_LOG_TABLE_STEP)
|
||||
#define MAXN 70000
|
||||
#define LOG10_CACHE_SIZE (4*MAXN) // we need to be able to go up to 2*(2N) when calculating some of the coefficients
|
||||
#define JACOBIAN_LOG_TABLE_SIZE ((int) (MAX_JACOBIAN_TOLERANCE / JACOBIAN_LOG_TABLE_STEP) + 1)
|
||||
|
||||
template<class NUMBER>
|
||||
struct ContextBase
|
||||
{
|
||||
public:
|
||||
NUMBER ph2pr[128];
|
||||
NUMBER INITIAL_CONSTANT;
|
||||
NUMBER LOG10_INITIAL_CONSTANT;
|
||||
NUMBER RESULT_THRESHOLD;
|
||||
|
||||
static bool staticMembersInitializedFlag;
|
||||
static NUMBER jacobianLogTable[JACOBIAN_LOG_TABLE_SIZE];
|
||||
static NUMBER matchToMatchProb[((MAX_QUAL + 1) * (MAX_QUAL + 2)) >> 1];
|
||||
|
||||
static void initializeStaticMembers()
|
||||
{
|
||||
if(!staticMembersInitializedFlag)
|
||||
{
|
||||
//Order of calls important - Jacobian first, then MatchToMatch
|
||||
initializeJacobianLogTable();
|
||||
initializeMatchToMatchProb();
|
||||
staticMembersInitializedFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void deleteStaticMembers()
|
||||
{
|
||||
if(staticMembersInitializedFlag)
|
||||
{
|
||||
staticMembersInitializedFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Called only once during library load - don't bother to optimize with single precision fp
|
||||
static void initializeJacobianLogTable()
|
||||
{
|
||||
for (int k = 0; k < JACOBIAN_LOG_TABLE_SIZE; k++) {
|
||||
jacobianLogTable[k] = (NUMBER)(log10(1.0 + pow(10.0, -((double) k) * JACOBIAN_LOG_TABLE_STEP)));
|
||||
}
|
||||
}
|
||||
|
||||
//Called only once per library load - don't bother optimizing with single fp
|
||||
static void initializeMatchToMatchProb()
|
||||
{
|
||||
double LN10 = log(10);
|
||||
double INV_LN10 = 1.0/LN10;
|
||||
for (int i = 0, offset = 0; i <= MAX_QUAL; offset += ++i)
|
||||
for (int j = 0; j <= i; j++) {
|
||||
double log10Sum = approximateLog10SumLog10(-0.1*i, -0.1*j);
|
||||
double matchToMatchLog10 =
|
||||
log1p(-std::min(1.0,pow(10,log10Sum))) * INV_LN10;
|
||||
matchToMatchProb[offset + j] = (NUMBER)(pow(10,matchToMatchLog10));
|
||||
}
|
||||
}
|
||||
//Called during computation - use single precision where possible
|
||||
static int fastRound(NUMBER d) {
|
||||
return (d > ((NUMBER)0.0)) ? (int) (d + ((NUMBER)0.5)) : (int) (d - ((NUMBER)0.5));
|
||||
}
|
||||
//Called during computation - use single precision where possible
|
||||
static NUMBER approximateLog10SumLog10(NUMBER small, NUMBER big) {
|
||||
// make sure small is really the smaller value
|
||||
if (small > big) {
|
||||
NUMBER t = big;
|
||||
big = small;
|
||||
small = t;
|
||||
}
|
||||
|
||||
if (isinf(small) == -1 || isinf(big) == -1)
|
||||
return big;
|
||||
|
||||
NUMBER diff = big - small;
|
||||
if (diff >= ((NUMBER)MAX_JACOBIAN_TOLERANCE))
|
||||
return big;
|
||||
|
||||
// OK, so |y-x| < tol: we use the following identity then:
|
||||
// we need to compute log10(10^x + 10^y)
|
||||
// By Jacobian logarithm identity, this is equal to
|
||||
// max(x,y) + log10(1+10^-abs(x-y))
|
||||
// we compute the second term as a table lookup with integer quantization
|
||||
// we have pre-stored correction for 0,0.1,0.2,... 10.0
|
||||
int ind = fastRound((NUMBER)(diff * ((NUMBER)JACOBIAN_LOG_TABLE_INV_STEP))); // hard rounding
|
||||
return big + jacobianLogTable[ind];
|
||||
}
|
||||
};
|
||||
|
||||
template<class NUMBER>
|
||||
struct Context : public ContextBase<NUMBER>
|
||||
{};
|
||||
|
||||
template<>
|
||||
struct Context<double> : public ContextBase<double>
|
||||
{
|
||||
Context():ContextBase<double>()
|
||||
{
|
||||
for (int x = 0; x < 128; x++)
|
||||
ph2pr[x] = pow(10.0, -((double)x) / 10.0);
|
||||
|
||||
INITIAL_CONSTANT = ldexp(1.0, 1020.0);
|
||||
LOG10_INITIAL_CONSTANT = log10(INITIAL_CONSTANT);
|
||||
RESULT_THRESHOLD = 0.0;
|
||||
}
|
||||
|
||||
double LOG10(double v){ return log10(v); }
|
||||
inline double POW(double b, double e) { return pow(b,e); }
|
||||
|
||||
static double _(double n){ return n; }
|
||||
static double _(float n){ return ((double) n); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Context<float> : public ContextBase<float>
|
||||
{
|
||||
Context() : ContextBase<float>()
|
||||
{
|
||||
for (int x = 0; x < 128; x++)
|
||||
{
|
||||
ph2pr[x] = powf(10.f, -((float)x) / 10.f);
|
||||
}
|
||||
|
||||
INITIAL_CONSTANT = ldexpf(1.f, 120.f);
|
||||
LOG10_INITIAL_CONSTANT = log10f(INITIAL_CONSTANT);
|
||||
RESULT_THRESHOLD = ldexpf(1.f, -110.f);
|
||||
}
|
||||
|
||||
float LOG10(float v){ return log10f(v); }
|
||||
inline float POW(float b, float e) { return powf(b,e); }
|
||||
|
||||
static float _(double n){ return ((float) n); }
|
||||
static float _(float n){ return n; }
|
||||
};
|
||||
|
||||
#define SET_MATCH_TO_MATCH_PROB(output, insQual, delQual) \
|
||||
{ \
|
||||
int minQual = delQual; \
|
||||
int maxQual = insQual; \
|
||||
if (insQual <= delQual) \
|
||||
{ \
|
||||
minQual = insQual; \
|
||||
maxQual = delQual; \
|
||||
} \
|
||||
(output) = (MAX_QUAL < maxQual) ? \
|
||||
((NUMBER)1.0) - ctx.POW(((NUMBER)10), ctx.approximateLog10SumLog10(((NUMBER)-0.1)*minQual, ((NUMBER)-0.1)*maxQual)) \
|
||||
: ctx.matchToMatchProb[((maxQual * (maxQual + 1)) >> 1) + minQual]; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int rslen, haplen;
|
||||
/*int *q, *i, *d, *c;*/
|
||||
/*int q[MROWS], i[MROWS], d[MROWS], c[MROWS];*/
|
||||
char *q, *i, *d, *c;
|
||||
char *hap, *rs;
|
||||
int *ihap;
|
||||
int *irs;
|
||||
} testcase;
|
||||
|
||||
#define MIN_ACCEPTED 1e-28f
|
||||
#define NUM_DISTINCT_CHARS 5
|
||||
#define AMBIG_CHAR 4
|
||||
|
||||
class ConvertChar {
|
||||
|
||||
static uint8_t conversionTable[255] ;
|
||||
|
||||
public:
|
||||
|
||||
static void init() {
|
||||
assert (NUM_DISTINCT_CHARS == 5) ;
|
||||
assert (AMBIG_CHAR == 4) ;
|
||||
|
||||
conversionTable['A'] = 0 ;
|
||||
conversionTable['C'] = 1 ;
|
||||
conversionTable['T'] = 2 ;
|
||||
conversionTable['G'] = 3 ;
|
||||
conversionTable['N'] = 4 ;
|
||||
}
|
||||
|
||||
static inline uint8_t get(uint8_t input) {
|
||||
return conversionTable[input] ;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int normalize(char c);
|
||||
int read_testcase(testcase *tc, FILE* ifp=0);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,205 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifdef PRECISION
|
||||
#undef PRECISION
|
||||
#undef MAIN_TYPE
|
||||
#undef MAIN_TYPE_SIZE
|
||||
#undef UNION_TYPE
|
||||
#undef IF_128
|
||||
#undef IF_MAIN_TYPE
|
||||
#undef SHIFT_CONST1
|
||||
#undef SHIFT_CONST2
|
||||
#undef SHIFT_CONST3
|
||||
#undef _128_TYPE
|
||||
#undef SIMD_TYPE
|
||||
#undef AVX_LENGTH
|
||||
#undef HAP_TYPE
|
||||
#undef MASK_TYPE
|
||||
#undef MASK_ALL_ONES
|
||||
|
||||
#undef SET_VEC_ZERO
|
||||
#undef VEC_OR
|
||||
#undef VEC_ADD
|
||||
#undef VEC_SUB
|
||||
#undef VEC_MUL
|
||||
#undef VEC_DIV
|
||||
#undef VEC_BLEND
|
||||
#undef VEC_BLENDV
|
||||
#undef VEC_CAST_256_128
|
||||
#undef VEC_EXTRACT_128
|
||||
#undef VEC_EXTRACT_UNIT
|
||||
#undef VEC_SET1_VAL128
|
||||
#undef VEC_MOVE
|
||||
#undef VEC_CAST_128_256
|
||||
#undef VEC_INSERT_VAL
|
||||
#undef VEC_CVT_128_256
|
||||
#undef VEC_SET1_VAL
|
||||
#undef VEC_POPCVT_CHAR
|
||||
#undef VEC_LDPOPCVT_CHAR
|
||||
#undef VEC_CMP_EQ
|
||||
#undef VEC_SET_LSE
|
||||
#undef SHIFT_HAP
|
||||
#undef MASK_VEC
|
||||
#undef VEC_SSE_TO_AVX
|
||||
#undef VEC_SHIFT_LEFT_1BIT
|
||||
#undef MASK_ALL_ONES
|
||||
#undef COMPARE_VECS
|
||||
#undef _256_INT_TYPE
|
||||
#undef BITMASK_VEC
|
||||
#endif
|
||||
|
||||
#define PRECISION d
|
||||
#define MAIN_TYPE double
|
||||
#define MAIN_TYPE_SIZE 64
|
||||
#define UNION_TYPE mix_D
|
||||
#define IF_128 IF_128d
|
||||
#define IF_MAIN_TYPE IF_64
|
||||
#define SHIFT_CONST1 8
|
||||
#define SHIFT_CONST2 1
|
||||
#define SHIFT_CONST3 8
|
||||
#define _128_TYPE __m128d
|
||||
#define SIMD_TYPE __m256d
|
||||
#define _256_INT_TYPE __m256i
|
||||
#define AVX_LENGTH 4
|
||||
#define HAP_TYPE __m128i
|
||||
#define MASK_TYPE uint64_t
|
||||
#define MASK_ALL_ONES 0xFFFFFFFFFFFFFFFF
|
||||
#define MASK_VEC MaskVec_D
|
||||
|
||||
#define SET_VEC_ZERO(__vec) \
|
||||
__vec= _mm256_setzero_pd()
|
||||
|
||||
#define VEC_OR(__v1, __v2) \
|
||||
_mm256_or_pd(__v1, __v2)
|
||||
|
||||
#define VEC_ADD(__v1, __v2) \
|
||||
_mm256_add_pd(__v1, __v2)
|
||||
|
||||
#define VEC_SUB(__v1, __v2) \
|
||||
_mm256_sub_pd(__v1, __v2)
|
||||
|
||||
#define VEC_MUL(__v1, __v2) \
|
||||
_mm256_mul_pd(__v1, __v2)
|
||||
|
||||
#define VEC_DIV(__v1, __v2) \
|
||||
_mm256_div_pd(__v1, __v2)
|
||||
|
||||
#define VEC_BLEND(__v1, __v2, __mask) \
|
||||
_mm256_blend_pd(__v1, __v2, __mask)
|
||||
|
||||
#define VEC_BLENDV(__v1, __v2, __maskV) \
|
||||
_mm256_blendv_pd(__v1, __v2, __maskV)
|
||||
|
||||
#define VEC_CAST_256_128(__v1) \
|
||||
_mm256_castpd256_pd128 (__v1)
|
||||
|
||||
#define VEC_EXTRACT_128(__v1, __im) \
|
||||
_mm256_extractf128_pd (__v1, __im)
|
||||
|
||||
#define VEC_EXTRACT_UNIT(__v1, __im) \
|
||||
_mm_extract_epi64(__v1, __im)
|
||||
|
||||
#define VEC_SET1_VAL128(__val) \
|
||||
_mm_set1_pd(__val)
|
||||
|
||||
#define VEC_MOVE(__v1, __val) \
|
||||
_mm_move_sd(__v1, __val)
|
||||
|
||||
#define VEC_CAST_128_256(__v1) \
|
||||
_mm256_castpd128_pd256(__v1)
|
||||
|
||||
#define VEC_INSERT_VAL(__v1, __val, __pos) \
|
||||
_mm256_insertf128_pd(__v1, __val, __pos)
|
||||
|
||||
#define VEC_CVT_128_256(__v1) \
|
||||
_mm256_cvtepi32_pd(__v1)
|
||||
|
||||
#define VEC_SET1_VAL(__val) \
|
||||
_mm256_set1_pd(__val)
|
||||
|
||||
#define VEC_POPCVT_CHAR(__ch) \
|
||||
_mm256_cvtepi32_pd(_mm_set1_epi32(__ch))
|
||||
|
||||
#define VEC_LDPOPCVT_CHAR(__addr) \
|
||||
_mm256_cvtepi32_pd(_mm_load_si128((__m128i const *)__addr))
|
||||
|
||||
#define VEC_CMP_EQ(__v1, __v2) \
|
||||
_mm256_cmp_pd(__v1, __v2, _CMP_EQ_OQ)
|
||||
|
||||
#define VEC_SET_LSE(__val) \
|
||||
_mm256_set_pd(zero, zero, zero, __val);
|
||||
|
||||
#define SHIFT_HAP(__v1, __val) \
|
||||
__v1 = _mm_insert_epi32(_mm_slli_si128(__v1, 4), __val.i, 0)
|
||||
|
||||
#define VEC_SSE_TO_AVX(__vsLow, __vsHigh, __vdst) \
|
||||
__vdst = _mm256_castpd128_pd256(__vsLow) ; \
|
||||
__vdst = _mm256_insertf128_pd(__vdst, __vsHigh, 1) ;
|
||||
|
||||
#define VEC_SHIFT_LEFT_1BIT(__vs) \
|
||||
__vs = _mm_slli_epi64(__vs, 1)
|
||||
|
||||
|
||||
#define COMPARE_VECS(__v1, __v2, __first, __last) { \
|
||||
double* ptr1 = (double*) (&__v1) ; \
|
||||
double* ptr2 = (double*) (&__v2) ; \
|
||||
for (int ei=__first; ei <= __last; ++ei) { \
|
||||
if (ptr1[ei] != ptr2[ei]) { \
|
||||
std::cout << "Double Mismatch at " << ei << ": " \
|
||||
<< ptr1[ei] << " vs. " << ptr2[ei] << std::endl ; \
|
||||
exit(0) ; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
class BitMaskVec_double {
|
||||
|
||||
MASK_VEC low_, high_ ;
|
||||
SIMD_TYPE combined_ ;
|
||||
|
||||
public:
|
||||
inline MASK_TYPE& getLowEntry(int index) {
|
||||
return low_.masks[index] ;
|
||||
}
|
||||
inline MASK_TYPE& getHighEntry(int index) {
|
||||
return high_.masks[index] ;
|
||||
}
|
||||
|
||||
inline const SIMD_TYPE& getCombinedMask() {
|
||||
VEC_SSE_TO_AVX(low_.vecf, high_.vecf, combined_) ;
|
||||
return combined_ ;
|
||||
}
|
||||
|
||||
inline void shift_left_1bit() {
|
||||
VEC_SHIFT_LEFT_1BIT(low_.vec) ;
|
||||
VEC_SHIFT_LEFT_1BIT(high_.vec) ;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
#define BITMASK_VEC BitMaskVec_double
|
||||
|
|
@ -1,206 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifdef PRECISION
|
||||
#undef PRECISION
|
||||
#undef MAIN_TYPE
|
||||
#undef MAIN_TYPE_SIZE
|
||||
#undef UNION_TYPE
|
||||
#undef IF_128
|
||||
#undef IF_MAIN_TYPE
|
||||
#undef SHIFT_CONST1
|
||||
#undef SHIFT_CONST2
|
||||
#undef SHIFT_CONST3
|
||||
#undef _128_TYPE
|
||||
#undef SIMD_TYPE
|
||||
#undef AVX_LENGTH
|
||||
#undef HAP_TYPE
|
||||
#undef MASK_TYPE
|
||||
#undef MASK_ALL_ONES
|
||||
|
||||
#undef SET_VEC_ZERO
|
||||
#undef VEC_OR
|
||||
#undef VEC_ADD
|
||||
#undef VEC_SUB
|
||||
#undef VEC_MUL
|
||||
#undef VEC_DIV
|
||||
#undef VEC_BLEND
|
||||
#undef VEC_BLENDV
|
||||
#undef VEC_CAST_256_128
|
||||
#undef VEC_EXTRACT_128
|
||||
#undef VEC_EXTRACT_UNIT
|
||||
#undef VEC_SET1_VAL128
|
||||
#undef VEC_MOVE
|
||||
#undef VEC_CAST_128_256
|
||||
#undef VEC_INSERT_VAL
|
||||
#undef VEC_CVT_128_256
|
||||
#undef VEC_SET1_VAL
|
||||
#undef VEC_POPCVT_CHAR
|
||||
#undef VEC_LDPOPCVT_CHAR
|
||||
#undef VEC_CMP_EQ
|
||||
#undef VEC_SET_LSE
|
||||
#undef SHIFT_HAP
|
||||
#undef MASK_VEC
|
||||
#undef VEC_SSE_TO_AVX
|
||||
#undef VEC_SHIFT_LEFT_1BIT
|
||||
#undef MASK_ALL_ONES
|
||||
#undef COMPARE_VECS
|
||||
#undef _256_INT_TYPE
|
||||
#undef BITMASK_VEC
|
||||
#endif
|
||||
|
||||
#define PRECISION s
|
||||
|
||||
#define MAIN_TYPE float
|
||||
#define MAIN_TYPE_SIZE 32
|
||||
#define UNION_TYPE mix_F
|
||||
#define IF_128 IF_128f
|
||||
#define IF_MAIN_TYPE IF_32
|
||||
#define SHIFT_CONST1 12
|
||||
#define SHIFT_CONST2 3
|
||||
#define SHIFT_CONST3 4
|
||||
#define _128_TYPE __m128
|
||||
#define SIMD_TYPE __m256
|
||||
#define _256_INT_TYPE __m256i
|
||||
#define AVX_LENGTH 8
|
||||
#define HAP_TYPE UNION_TYPE
|
||||
#define MASK_TYPE uint32_t
|
||||
#define MASK_ALL_ONES 0xFFFFFFFF
|
||||
#define MASK_VEC MaskVec_F
|
||||
|
||||
#define SET_VEC_ZERO(__vec) \
|
||||
__vec= _mm256_setzero_ps()
|
||||
|
||||
#define VEC_OR(__v1, __v2) \
|
||||
_mm256_or_ps(__v1, __v2)
|
||||
|
||||
#define VEC_ADD(__v1, __v2) \
|
||||
_mm256_add_ps(__v1, __v2)
|
||||
|
||||
#define VEC_SUB(__v1, __v2) \
|
||||
_mm256_sub_ps(__v1, __v2)
|
||||
|
||||
#define VEC_MUL(__v1, __v2) \
|
||||
_mm256_mul_ps(__v1, __v2)
|
||||
|
||||
#define VEC_DIV(__v1, __v2) \
|
||||
_mm256_div_ps(__v1, __v2)
|
||||
|
||||
#define VEC_BLEND(__v1, __v2, __mask) \
|
||||
_mm256_blend_ps(__v1, __v2, __mask)
|
||||
|
||||
#define VEC_BLENDV(__v1, __v2, __maskV) \
|
||||
_mm256_blendv_ps(__v1, __v2, __maskV)
|
||||
|
||||
#define VEC_CAST_256_128(__v1) \
|
||||
_mm256_castps256_ps128 (__v1)
|
||||
|
||||
#define VEC_EXTRACT_128(__v1, __im) \
|
||||
_mm256_extractf128_ps (__v1, __im)
|
||||
|
||||
#define VEC_EXTRACT_UNIT(__v1, __im) \
|
||||
_mm_extract_epi32(__v1, __im)
|
||||
|
||||
#define VEC_SET1_VAL128(__val) \
|
||||
_mm_set1_ps(__val)
|
||||
|
||||
#define VEC_MOVE(__v1, __val) \
|
||||
_mm_move_ss(__v1, __val)
|
||||
|
||||
#define VEC_CAST_128_256(__v1) \
|
||||
_mm256_castps128_ps256(__v1)
|
||||
|
||||
#define VEC_INSERT_VAL(__v1, __val, __pos) \
|
||||
_mm256_insertf128_ps(__v1, __val, __pos)
|
||||
|
||||
#define VEC_CVT_128_256(__v1) \
|
||||
_mm256_cvtepi32_ps(__v1.i)
|
||||
|
||||
#define VEC_SET1_VAL(__val) \
|
||||
_mm256_set1_ps(__val)
|
||||
|
||||
#define VEC_POPCVT_CHAR(__ch) \
|
||||
_mm256_cvtepi32_ps(_mm256_set1_epi32(__ch))
|
||||
|
||||
#define VEC_LDPOPCVT_CHAR(__addr) \
|
||||
_mm256_cvtepi32_ps(_mm256_loadu_si256((__m256i const *)__addr))
|
||||
|
||||
#define VEC_CMP_EQ(__v1, __v2) \
|
||||
_mm256_cmp_ps(__v1, __v2, _CMP_EQ_OQ)
|
||||
|
||||
#define VEC_SET_LSE(__val) \
|
||||
_mm256_set_ps(zero, zero, zero, zero, zero, zero, zero, __val);
|
||||
|
||||
#define SHIFT_HAP(__v1, __val) \
|
||||
_vector_shift_lastavxs(__v1, __val.f);
|
||||
|
||||
#define VEC_SSE_TO_AVX(__vsLow, __vsHigh, __vdst) \
|
||||
__vdst = _mm256_castps128_ps256(__vsLow) ; \
|
||||
__vdst = _mm256_insertf128_ps(__vdst, __vsHigh, 1) ;
|
||||
|
||||
#define VEC_SHIFT_LEFT_1BIT(__vs) \
|
||||
__vs = _mm_slli_epi32(__vs, 1)
|
||||
|
||||
#define COMPARE_VECS(__v1, __v2, __first, __last) { \
|
||||
float* ptr1 = (float*) (&__v1) ; \
|
||||
float* ptr2 = (float*) (&__v2) ; \
|
||||
for (int ei=__first; ei <= __last; ++ei) { \
|
||||
if (ptr1[ei] != ptr2[ei]) { \
|
||||
std::cout << "Float Mismatch at " << ei << ": " \
|
||||
<< ptr1[ei] << " vs. " << ptr2[ei] << std::endl ; \
|
||||
exit(0) ; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
class BitMaskVec_float {
|
||||
|
||||
MASK_VEC low_, high_ ;
|
||||
SIMD_TYPE combined_ ;
|
||||
|
||||
public:
|
||||
|
||||
inline MASK_TYPE& getLowEntry(int index) {
|
||||
return low_.masks[index] ;
|
||||
}
|
||||
inline MASK_TYPE& getHighEntry(int index) {
|
||||
return high_.masks[index] ;
|
||||
}
|
||||
|
||||
inline const SIMD_TYPE& getCombinedMask() {
|
||||
VEC_SSE_TO_AVX(low_.vecf, high_.vecf, combined_) ;
|
||||
return combined_ ;
|
||||
}
|
||||
|
||||
inline void shift_left_1bit() {
|
||||
VEC_SHIFT_LEFT_1BIT(low_.vec) ;
|
||||
VEC_SHIFT_LEFT_1BIT(high_.vec) ;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
#define BITMASK_VEC BitMaskVec_float
|
||||
|
|
@ -1,173 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PRECISION
|
||||
#undef PRECISION
|
||||
#undef MAIN_TYPE
|
||||
#undef MAIN_TYPE_SIZE
|
||||
#undef UNION_TYPE
|
||||
#undef IF_128
|
||||
#undef IF_MAIN_TYPE
|
||||
#undef SHIFT_CONST1
|
||||
#undef SHIFT_CONST2
|
||||
#undef SHIFT_CONST3
|
||||
#undef _128_TYPE
|
||||
#undef SIMD_TYPE
|
||||
#undef AVX_LENGTH
|
||||
#undef HAP_TYPE
|
||||
#undef MASK_TYPE
|
||||
#undef MASK_ALL_ONES
|
||||
|
||||
#undef VEC_EXTRACT_UNIT
|
||||
#undef VEC_INSERT_UNIT
|
||||
#undef SET_VEC_ZERO
|
||||
#undef VEC_OR
|
||||
#undef VEC_ADD
|
||||
#undef VEC_SUB
|
||||
#undef VEC_MUL
|
||||
#undef VEC_DIV
|
||||
#undef VEC_BLEND
|
||||
#undef VEC_BLENDV
|
||||
#undef VEC_CAST_256_128
|
||||
#undef VEC_EXTRACT_128
|
||||
#undef VEC_EXTRACT_UNIT
|
||||
#undef VEC_SET1_VAL128
|
||||
#undef VEC_MOVE
|
||||
#undef VEC_CAST_128_256
|
||||
#undef VEC_INSERT_VAL
|
||||
#undef VEC_CVT_128_256
|
||||
#undef VEC_SET1_VAL
|
||||
#undef VEC_POPCVT_CHAR
|
||||
#undef VEC_LDPOPCVT_CHAR
|
||||
#undef VEC_CMP_EQ
|
||||
#undef VEC_SET_LSE
|
||||
#undef SHIFT_HAP
|
||||
#undef MASK_VEC
|
||||
#undef VEC_SSE_TO_AVX
|
||||
#undef VEC_SHIFT_LEFT_1BIT
|
||||
#undef MASK_ALL_ONES
|
||||
#undef COMPARE_VECS
|
||||
#undef _256_INT_TYPE
|
||||
#undef BITMASK_VEC
|
||||
#endif
|
||||
|
||||
#define SSE
|
||||
#define PRECISION d
|
||||
|
||||
#define MAIN_TYPE double
|
||||
#define MAIN_TYPE_SIZE 64
|
||||
#define UNION_TYPE mix_D128
|
||||
#define IF_128 IF_128d
|
||||
#define IF_MAIN_TYPE IF_64
|
||||
#define SHIFT_CONST1 1
|
||||
#define SHIFT_CONST2 8
|
||||
#define SHIFT_CONST3 0
|
||||
#define _128_TYPE __m128d
|
||||
#define SIMD_TYPE __m128d
|
||||
#define _256_INT_TYPE __m128i
|
||||
#define AVX_LENGTH 2
|
||||
#define HAP_TYPE __m128i
|
||||
#define MASK_TYPE uint64_t
|
||||
#define MASK_ALL_ONES 0xFFFFFFFFFFFFFFFFL
|
||||
#define MASK_VEC MaskVec_D
|
||||
|
||||
#define VEC_EXTRACT_UNIT(__v1, __im) \
|
||||
_mm_extract_epi64(__v1, __im)
|
||||
|
||||
#define VEC_INSERT_UNIT(__v1,__ins,__im) \
|
||||
_mm_insert_epi64(__v1,__ins,__im)
|
||||
|
||||
#define VEC_OR(__v1, __v2) \
|
||||
_mm_or_pd(__v1, __v2)
|
||||
|
||||
#define VEC_ADD(__v1, __v2) \
|
||||
_mm_add_pd(__v1, __v2)
|
||||
|
||||
#define VEC_SUB(__v1, __v2) \
|
||||
_mm_sub_pd(__v1, __v2)
|
||||
|
||||
#define VEC_MUL(__v1, __v2) \
|
||||
_mm_mul_pd(__v1, __v2)
|
||||
|
||||
#define VEC_DIV(__v1, __v2) \
|
||||
_mm_div_pd(__v1, __v2)
|
||||
|
||||
#define VEC_CMP_EQ(__v1, __v2) \
|
||||
_mm_cmpeq_pd(__v1, __v2)
|
||||
|
||||
#define VEC_BLEND(__v1, __v2, __mask) \
|
||||
_mm_blend_pd(__v1, __v2, __mask)
|
||||
|
||||
#define VEC_BLENDV(__v1, __v2, __maskV) \
|
||||
_mm_blendv_pd(__v1, __v2, __maskV)
|
||||
|
||||
#define SHIFT_HAP(__v1, __val) \
|
||||
__v1 = _mm_insert_epi32(_mm_slli_si128(__v1, 4), __val.i, 0)
|
||||
|
||||
#define VEC_CVT_128_256(__v1) \
|
||||
_mm_cvtepi32_pd(__v1)
|
||||
|
||||
#define VEC_SET1_VAL(__val) \
|
||||
_mm_set1_pd(__val)
|
||||
|
||||
#define VEC_POPCVT_CHAR(__ch) \
|
||||
_mm_cvtepi32_pd(_mm_set1_epi32(__ch))
|
||||
|
||||
#define VEC_SET_LSE(__val) \
|
||||
_mm_set_pd(zero, __val);
|
||||
|
||||
#define VEC_LDPOPCVT_CHAR(__addr) \
|
||||
_mm_cvtepi32_pd(_mm_loadu_si128((__m128i const *)__addr))
|
||||
|
||||
#define VEC_SSE_TO_AVX(__vsLow, __vsHigh, __vdst) \
|
||||
__vdst = _mm_castsi128_pd(_mm_set_epi64(__vsHigh, __vsLow))
|
||||
|
||||
#define VEC_SHIFT_LEFT_1BIT(__vs) \
|
||||
__vs = _mm_slli_epi64(__vs, 1)
|
||||
|
||||
|
||||
class BitMaskVec_sse_double {
|
||||
|
||||
MASK_VEC combined_ ;
|
||||
public:
|
||||
inline MASK_TYPE& getLowEntry(int index) {
|
||||
return combined_.masks[index] ;
|
||||
}
|
||||
inline MASK_TYPE& getHighEntry(int index) {
|
||||
return combined_.masks[AVX_LENGTH/2+index] ;
|
||||
}
|
||||
|
||||
inline const SIMD_TYPE& getCombinedMask() {
|
||||
return combined_.vecf ;
|
||||
}
|
||||
|
||||
inline void shift_left_1bit() {
|
||||
VEC_SHIFT_LEFT_1BIT(combined_.vec) ;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
#define BITMASK_VEC BitMaskVec_sse_double
|
||||
|
||||
|
|
@ -1,173 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PRECISION
|
||||
#undef PRECISION
|
||||
#undef MAIN_TYPE
|
||||
#undef MAIN_TYPE_SIZE
|
||||
#undef UNION_TYPE
|
||||
#undef IF_128
|
||||
#undef IF_MAIN_TYPE
|
||||
#undef SHIFT_CONST1
|
||||
#undef SHIFT_CONST2
|
||||
#undef SHIFT_CONST3
|
||||
#undef _128_TYPE
|
||||
#undef SIMD_TYPE
|
||||
#undef AVX_LENGTH
|
||||
#undef HAP_TYPE
|
||||
#undef MASK_TYPE
|
||||
#undef MASK_ALL_ONES
|
||||
|
||||
#undef VEC_EXTRACT_UNIT
|
||||
#undef VEC_INSERT_UNIT
|
||||
#undef SET_VEC_ZERO
|
||||
#undef VEC_OR
|
||||
#undef VEC_ADD
|
||||
#undef VEC_SUB
|
||||
#undef VEC_MUL
|
||||
#undef VEC_DIV
|
||||
#undef VEC_BLEND
|
||||
#undef VEC_BLENDV
|
||||
#undef VEC_CAST_256_128
|
||||
#undef VEC_EXTRACT_128
|
||||
#undef VEC_EXTRACT_UNIT
|
||||
#undef VEC_SET1_VAL128
|
||||
#undef VEC_MOVE
|
||||
#undef VEC_CAST_128_256
|
||||
#undef VEC_INSERT_VAL
|
||||
#undef VEC_CVT_128_256
|
||||
#undef VEC_SET1_VAL
|
||||
#undef VEC_POPCVT_CHAR
|
||||
#undef VEC_LDPOPCVT_CHAR
|
||||
#undef VEC_CMP_EQ
|
||||
#undef VEC_SET_LSE
|
||||
#undef SHIFT_HAP
|
||||
#undef MASK_VEC
|
||||
#undef VEC_SSE_TO_AVX
|
||||
#undef VEC_SHIFT_LEFT_1BIT
|
||||
#undef MASK_ALL_ONES
|
||||
#undef COMPARE_VECS
|
||||
#undef _256_INT_TYPE
|
||||
#undef BITMASK_VEC
|
||||
#endif
|
||||
|
||||
#define SSE
|
||||
#define PRECISION s
|
||||
|
||||
#define MAIN_TYPE float
|
||||
#define MAIN_TYPE_SIZE 32
|
||||
#define UNION_TYPE mix_F128
|
||||
#define IF_128 IF_128f
|
||||
#define IF_MAIN_TYPE IF_32
|
||||
#define SHIFT_CONST1 3
|
||||
#define SHIFT_CONST2 4
|
||||
#define SHIFT_CONST3 0
|
||||
#define _128_TYPE __m128
|
||||
#define SIMD_TYPE __m128
|
||||
#define _256_INT_TYPE __m128i
|
||||
#define AVX_LENGTH 4
|
||||
//#define MAVX_COUNT (MROWS+3)/AVX_LENGTH
|
||||
#define HAP_TYPE UNION_TYPE
|
||||
#define MASK_TYPE uint32_t
|
||||
#define MASK_ALL_ONES 0xFFFFFFFF
|
||||
#define MASK_VEC MaskVec_F
|
||||
|
||||
#define VEC_EXTRACT_UNIT(__v1, __im) \
|
||||
_mm_extract_epi32(__v1, __im)
|
||||
|
||||
#define VEC_INSERT_UNIT(__v1,__ins,__im) \
|
||||
_mm_insert_epi32(__v1,__ins,__im)
|
||||
|
||||
#define VEC_OR(__v1, __v2) \
|
||||
_mm_or_ps(__v1, __v2)
|
||||
|
||||
#define VEC_ADD(__v1, __v2) \
|
||||
_mm_add_ps(__v1, __v2)
|
||||
|
||||
#define VEC_SUB(__v1, __v2) \
|
||||
_mm_sub_ps(__v1, __v2)
|
||||
|
||||
#define VEC_MUL(__v1, __v2) \
|
||||
_mm_mul_ps(__v1, __v2)
|
||||
|
||||
#define VEC_DIV(__v1, __v2) \
|
||||
_mm_div_ps(__v1, __v2)
|
||||
|
||||
#define VEC_CMP_EQ(__v1, __v2) \
|
||||
_mm_cmpeq_ps(__v1, __v2)
|
||||
|
||||
#define VEC_BLEND(__v1, __v2, __mask) \
|
||||
_mm_blend_ps(__v1, __v2, __mask)
|
||||
|
||||
#define VEC_BLENDV(__v1, __v2, __maskV) \
|
||||
_mm_blendv_ps(__v1, __v2, __maskV)
|
||||
|
||||
#define SHIFT_HAP(__v1, __val) \
|
||||
_vector_shift_lastsses(__v1, __val.f)
|
||||
|
||||
#define VEC_CVT_128_256(__v1) \
|
||||
_mm_cvtepi32_ps(__v1.i)
|
||||
|
||||
#define VEC_SET1_VAL(__val) \
|
||||
_mm_set1_ps(__val)
|
||||
|
||||
#define VEC_POPCVT_CHAR(__ch) \
|
||||
_mm_cvtepi32_ps(_mm_set1_epi32(__ch))
|
||||
|
||||
#define VEC_SET_LSE(__val) \
|
||||
_mm_set_ps(zero, zero, zero, __val);
|
||||
|
||||
#define VEC_LDPOPCVT_CHAR(__addr) \
|
||||
_mm_cvtepi32_ps(_mm_loadu_si128((__m128i const *)__addr))
|
||||
|
||||
#define VEC_SSE_TO_AVX(__vsLow, __vsHigh, __vdst) \
|
||||
__vdst = _mm_cvtpi32x2_ps(__vsLow, __vsHigh)
|
||||
|
||||
#define VEC_SHIFT_LEFT_1BIT(__vs) \
|
||||
__vs = _mm_slli_epi32(__vs, 1)
|
||||
|
||||
class BitMaskVec_sse_float {
|
||||
|
||||
MASK_VEC combined_ ;
|
||||
|
||||
public:
|
||||
inline MASK_TYPE& getLowEntry(int index) {
|
||||
return combined_.masks[index] ;
|
||||
}
|
||||
inline MASK_TYPE& getHighEntry(int index) {
|
||||
return combined_.masks[AVX_LENGTH/2+index] ;
|
||||
}
|
||||
|
||||
inline const SIMD_TYPE& getCombinedMask() {
|
||||
return combined_.vecf ;
|
||||
}
|
||||
|
||||
inline void shift_left_1bit() {
|
||||
VEC_SHIFT_LEFT_1BIT(combined_.vec) ;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
#define BITMASK_VEC BitMaskVec_sse_float
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef COMMON_HEADERS_H
|
||||
#define COMMON_HEADERS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <immintrin.h>
|
||||
#include <emmintrin.h>
|
||||
#include <omp.h>
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <fenv.h>
|
||||
|
||||
extern uint64_t exceptions_array[128];
|
||||
extern FILE* g_debug_fptr;
|
||||
#define STORE_FP_EXCEPTIONS(flagp, exceptions_array) \
|
||||
fegetexceptflag(&flagp, FE_ALL_EXCEPT | __FE_DENORM); \
|
||||
exceptions_array[FE_INVALID] += ((flagp & FE_INVALID)); \
|
||||
exceptions_array[__FE_DENORM] += ((flagp & __FE_DENORM) >> 1); \
|
||||
exceptions_array[FE_DIVBYZERO] += ((flagp & FE_DIVBYZERO) >> 2); \
|
||||
exceptions_array[FE_OVERFLOW] += ((flagp & FE_OVERFLOW) >> 3); \
|
||||
exceptions_array[FE_UNDERFLOW] += ((flagp & FE_UNDERFLOW) >> 4); \
|
||||
feclearexcept(FE_ALL_EXCEPT | __FE_DENORM);
|
||||
|
||||
#define CONVERT_AND_PRINT(X) \
|
||||
g_converter.f = (X); \
|
||||
fwrite(&(g_converter.i),4,1,g_debug_fptr); \
|
||||
|
||||
#endif
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef JNI_COMMON_H
|
||||
#define JNI_COMMON_H
|
||||
|
||||
/*#define SINGLE_THREADED_ONLY 1*/
|
||||
#include <jni.h>
|
||||
/*#define ENABLE_ASSERTIONS 1*/
|
||||
#ifdef SINGLE_THREADED_ONLY
|
||||
#define DO_PROFILING 1
|
||||
#endif
|
||||
/*#define DEBUG0_1 1*/
|
||||
/*#define DEBUG3 1*/
|
||||
/*#define DUMP_TO_SANDBOX 1*/
|
||||
|
||||
|
||||
/*#define DIRECT_ACCESS_TO_JAVA_HEAP_MEMORY 1*/
|
||||
|
||||
#ifdef DIRECT_ACCESS_TO_JAVA_HEAP_MEMORY
|
||||
//Gets direct access to Java arrays
|
||||
#define GET_BYTE_ARRAY_ELEMENTS env->GetPrimitiveArrayCritical
|
||||
#define RELEASE_BYTE_ARRAY_ELEMENTS env->ReleasePrimitiveArrayCritical
|
||||
#define JNI_RO_RELEASE_MODE JNI_ABORT
|
||||
#define GET_DOUBLE_ARRAY_ELEMENTS env->GetPrimitiveArrayCritical
|
||||
#define RELEASE_DOUBLE_ARRAY_ELEMENTS env->ReleasePrimitiveArrayCritical
|
||||
|
||||
#else
|
||||
//Likely makes copy of Java arrays to JNI C++ space
|
||||
#define GET_BYTE_ARRAY_ELEMENTS env->GetByteArrayElements
|
||||
#define RELEASE_BYTE_ARRAY_ELEMENTS env->ReleaseByteArrayElements
|
||||
#define JNI_RO_RELEASE_MODE JNI_ABORT
|
||||
#define GET_DOUBLE_ARRAY_ELEMENTS env->GetDoubleArrayElements
|
||||
#define RELEASE_DOUBLE_ARRAY_ELEMENTS env->ReleaseDoubleArrayElements
|
||||
|
||||
#endif //ifdef DIRECT_ACCESS_TO_JAVA_HEAP_MEMORY
|
||||
|
||||
#endif //ifndef JNI_COMMON_H
|
||||
|
|
@ -1,191 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef JNI_DEBUG_H
|
||||
#define JNI_DEBUG_H
|
||||
|
||||
template<class NUMBER>
|
||||
class DataHolder
|
||||
{
|
||||
#define INIT_MATRIX(X) \
|
||||
X = new NUMBER*[m_paddedMaxReadLength]; \
|
||||
for(int i=0;i<m_paddedMaxReadLength;++i) \
|
||||
{ \
|
||||
X[i] = new NUMBER[m_paddedMaxHaplotypeLength]; \
|
||||
for(int j=0;j<m_paddedMaxHaplotypeLength;++j) \
|
||||
X[i][j] = (NUMBER)0; \
|
||||
}
|
||||
|
||||
#define FREE_MATRIX(X) \
|
||||
for(int i=0;i<m_paddedMaxReadLength;++i) \
|
||||
delete[] X[i]; \
|
||||
delete[] X;
|
||||
|
||||
public:
|
||||
DataHolder() { m_is_initialized = false; }
|
||||
void initialize(int readMaxLength, int haplotypeMaxLength)
|
||||
{
|
||||
if(m_is_initialized)
|
||||
{
|
||||
FREE_MATRIX(m_matchMatrix);
|
||||
FREE_MATRIX(m_insertionMatrix);
|
||||
FREE_MATRIX(m_deletionMatrix);
|
||||
FREE_MATRIX(m_prior);
|
||||
delete[] m_transition;
|
||||
}
|
||||
|
||||
m_readMaxLength = readMaxLength;
|
||||
m_haplotypeMaxLength = haplotypeMaxLength;
|
||||
m_paddedMaxReadLength = readMaxLength + 1;
|
||||
m_paddedMaxHaplotypeLength = haplotypeMaxLength + 1;
|
||||
|
||||
INIT_MATRIX(m_matchMatrix);
|
||||
INIT_MATRIX(m_insertionMatrix);
|
||||
INIT_MATRIX(m_deletionMatrix);
|
||||
INIT_MATRIX(m_prior);
|
||||
m_transition = new NUMBER[m_paddedMaxReadLength][6];
|
||||
for(int i=0;i<m_paddedMaxReadLength;++i)
|
||||
for(int j=0;j<6;++j)
|
||||
m_transition[i][j] = (NUMBER)0;
|
||||
m_is_initialized = true;
|
||||
}
|
||||
|
||||
//Corresponds to initializeProbabilities
|
||||
void initializeProbabilities(jint length, jbyte* insertionGOP, jbyte* deletionGOP, jbyte* overallGCP)
|
||||
{
|
||||
static unsigned g_num_prob_init = 0;
|
||||
Context<NUMBER> ctx;
|
||||
for (int r = 1; r <= length;r++) //in original code, r < ROWS (where ROWS = paddedReadLength)
|
||||
{
|
||||
int _i = insertionGOP[r-1]; //insertionGOP
|
||||
int _d = deletionGOP[r-1]; //deletionGOP
|
||||
int _c = overallGCP[r-1]; //overallGCP
|
||||
m_transition[r][MM] = ctx._(1.0) - ctx.ph2pr[(_i + _d) & 127]; //lines 161-162
|
||||
m_transition[r][GapM] = ctx._(1.0) - ctx.ph2pr[_c]; //line 163
|
||||
m_transition[r][MX] = ctx.ph2pr[_i]; //164
|
||||
m_transition[r][XX] = ctx.ph2pr[_c]; //165
|
||||
m_transition[r][MY] = ctx.ph2pr[_d];//last row seems different, compared to line 166
|
||||
m_transition[r][YY] = ctx.ph2pr[_c];//same as above for line 167
|
||||
//m_transition[r][MY] = (r == length) ? ctx._(1.0) : ctx.ph2pr[_d];//last row seems different, compared to line 166
|
||||
//m_transition[r][YY] = (r == length) ? ctx._(1.0) : ctx.ph2pr[_c];//same as above for line 167
|
||||
#ifdef DEBUG3
|
||||
for(int j=0;j<6;++j)
|
||||
debug_dump("transitions_jni.txt", to_string(m_transition[r][j]),true);
|
||||
#endif
|
||||
}
|
||||
++g_num_prob_init;
|
||||
}
|
||||
bool m_is_initialized;
|
||||
int m_readMaxLength;
|
||||
int m_haplotypeMaxLength;
|
||||
int m_paddedMaxReadLength;
|
||||
int m_paddedMaxHaplotypeLength;
|
||||
NUMBER** m_matchMatrix;
|
||||
NUMBER** m_insertionMatrix;
|
||||
NUMBER** m_deletionMatrix;
|
||||
NUMBER** m_prior;
|
||||
NUMBER (*m_transition)[6];
|
||||
};
|
||||
extern DataHolder<double> g_double_dataholder;
|
||||
|
||||
template<class NUMBER>
|
||||
NUMBER compute_full_prob(testcase *tc, NUMBER** M, NUMBER** X, NUMBER** Y, NUMBER (*p)[6],
|
||||
bool do_initialization, jint hapStartIndex, NUMBER *before_last_log = NULL)
|
||||
{
|
||||
int r, c;
|
||||
int ROWS = tc->rslen + 1; //ROWS = paddedReadLength
|
||||
int COLS = tc->haplen + 1; //COLS = paddedHaplotypeLength
|
||||
|
||||
Context<NUMBER> ctx;
|
||||
//////NOTES
|
||||
////ctx.ph2pr[quality]; //This quantity is QualityUtils.qualToErrorProb(quality)
|
||||
////1-ctx.ph2pr[quality]; //This corresponds to QualityUtils.qualToProb(quality);
|
||||
|
||||
//Initialization
|
||||
if(do_initialization)
|
||||
{
|
||||
for (c = 0; c < COLS; c++)
|
||||
{
|
||||
M[0][c] = ctx._(0.0);
|
||||
X[0][c] = ctx._(0.0);
|
||||
Y[0][c] = ctx.INITIAL_CONSTANT / (tc->haplen); //code from 87-90 in LoglessPairHMM
|
||||
}
|
||||
|
||||
for (r = 1; r < ROWS; r++)
|
||||
{
|
||||
M[r][0] = ctx._(0.0);
|
||||
//deletionMatrix row 0 in above nest is initialized in the Java code
|
||||
//However, insertionMatrix column 0 is not initialized in Java code, could it be that
|
||||
//values are re-used from a previous iteration?
|
||||
//Why even do this, X[0][0] = 0 from above loop nest, X[idx][0] = 0 from this computation
|
||||
X[r][0] = X[r-1][0] * p[r][XX];
|
||||
Y[r][0] = ctx._(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
for (r = 1; r < ROWS; r++)
|
||||
for (c = hapStartIndex+1; c < COLS; c++)
|
||||
{
|
||||
//The following lines correspond to initializePriors()
|
||||
char _rs = tc->rs[r-1]; //line 137
|
||||
char _hap = tc->hap[c-1]; //line 140
|
||||
//int _q = tc->q[r-1] & 127; //line 138 - q is the quality (qual), should be byte hence int ANDed with 0xFF
|
||||
int _q = tc->q[r-1]; //line 138 - q is the quality (qual), should be byte hence int ANDed with 0xFF
|
||||
NUMBER distm = ctx.ph2pr[_q]; //This quantity is QualityUtils.qualToErrorProb(_q)
|
||||
//The assumption here is that doNotUseTristateCorrection is true
|
||||
//TOASK
|
||||
if (_rs == _hap || _rs == 'N' || _hap == 'N')
|
||||
distm = ctx._(1.0) - distm; //This is the quantity QualityUtils.qualToProb(qual)
|
||||
else
|
||||
distm = distm/3;
|
||||
#ifdef DEBUG3
|
||||
debug_dump("priors_jni.txt",to_string(distm),true);
|
||||
#endif
|
||||
|
||||
//Computation inside updateCell
|
||||
M[r][c] = distm * (M[r-1][c-1] * p[r][MM] + X[r-1][c-1] * p[r][GapM] + Y[r-1][c-1] * p[r][GapM]);
|
||||
X[r][c] = M[r-1][c] * p[r][MX] + X[r-1][c] * p[r][XX];
|
||||
Y[r][c] = M[r][c-1] * p[r][MY] + Y[r][c-1] * p[r][YY];
|
||||
#ifdef DEBUG3
|
||||
debug_dump("matrices_jni.txt",to_string(M[r][c]),true);
|
||||
debug_dump("matrices_jni.txt",to_string(X[r][c]),true);
|
||||
debug_dump("matrices_jni.txt",to_string(Y[r][c]),true);
|
||||
#endif
|
||||
}
|
||||
|
||||
NUMBER result = ctx._(0.0);
|
||||
for (c = 0; c < COLS; c++)
|
||||
result += M[ROWS-1][c] + X[ROWS-1][c];
|
||||
|
||||
if (before_last_log != NULL)
|
||||
*before_last_log = result;
|
||||
|
||||
#ifdef DEBUG
|
||||
debug_dump("return_values_jni.txt",to_string(ctx.LOG10(result) - ctx.LOG10_INITIAL_CONSTANT),true);
|
||||
#endif
|
||||
return ctx.LOG10(result) - ctx.LOG10_INITIAL_CONSTANT;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,175 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "headers.h"
|
||||
#include "jni_common.h"
|
||||
#include "org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM.h"
|
||||
#include "utils.h"
|
||||
#include "LoadTimeInitializer.h"
|
||||
#include "jnidebug.h"
|
||||
DataHolder<double> g_double_dataholder;
|
||||
|
||||
using namespace std;
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_jniInitialize
|
||||
(JNIEnv* env, jobject thisObject,
|
||||
jint readMaxLength, jint haplotypeMaxLength)
|
||||
{
|
||||
static int g_num_init_calls = 0;
|
||||
#ifdef DEBUG3
|
||||
cout << "Entered alloc initialized .. readMaxLength "<<readMaxLength<<" haplotypeMaxLength "<<haplotypeMaxLength<<"\n";
|
||||
#endif
|
||||
g_double_dataholder.initialize(readMaxLength, haplotypeMaxLength);
|
||||
#ifdef DEBUG3
|
||||
debug_dump("lengths_jni.txt", to_string(readMaxLength)+" "+to_string(haplotypeMaxLength),true);
|
||||
#endif
|
||||
++g_num_init_calls;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_jniInitializeProbabilities
|
||||
(JNIEnv* env, jclass thisObject,
|
||||
jobjectArray transition, jbyteArray insertionGOP, jbyteArray deletionGOP, jbyteArray overallGCP
|
||||
)
|
||||
{
|
||||
jboolean is_copy = JNI_FALSE;
|
||||
jsize length = (env)->GetArrayLength(insertionGOP);
|
||||
#ifdef DEBUG3
|
||||
cout << "Entered initializeProbabilities .. length "<<length<<"\n";
|
||||
#endif
|
||||
jbyte* insertionGOPArray = (env)->GetByteArrayElements(insertionGOP, &is_copy);
|
||||
jbyte* deletionGOPArray = (env)->GetByteArrayElements(deletionGOP, &is_copy);
|
||||
jbyte* overallGCPArray = (env)->GetByteArrayElements(overallGCP, &is_copy);
|
||||
#ifdef DEBUG
|
||||
if(insertionGOPArray == 0)
|
||||
cerr << "insertionGOP array not initialized in JNI\n";
|
||||
////assert(insertionGOPArray && "insertionGOP array not initialized in JNI");
|
||||
if(deletionGOPArray == 0)
|
||||
cerr << "deletionGOP array not initialized in JNI\n";
|
||||
////assert(deletionGOPArray && "deletionGOP array not initialized in JNI");
|
||||
assert(overallGCPArray && "OverallGCP array not initialized in JNI");
|
||||
#endif
|
||||
|
||||
g_double_dataholder.initializeProbabilities(length, insertionGOPArray, deletionGOPArray, overallGCPArray);
|
||||
|
||||
env->ReleaseByteArrayElements(overallGCP, overallGCPArray, JNI_ABORT);
|
||||
env->ReleaseByteArrayElements(deletionGOP, deletionGOPArray, JNI_ABORT);
|
||||
env->ReleaseByteArrayElements(insertionGOP, insertionGOPArray, JNI_ABORT);
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_jniInitializePriorsAndUpdateCells(
|
||||
JNIEnv* env, jobject thisObject,
|
||||
jboolean doInitialization, jint paddedReadLength, jint paddedHaplotypeLength,
|
||||
jbyteArray readBases, jbyteArray haplotypeBases, jbyteArray readQuals,
|
||||
jint hapStartIndex
|
||||
)
|
||||
{
|
||||
#ifdef DEBUG3
|
||||
cout << "Entered mainCompute .. doInitialization "<<(doInitialization == JNI_TRUE)<<" hapStartIndex "<<hapStartIndex<<"\n";
|
||||
cout << "mainCompute padded lengths "<< paddedReadLength << " " << paddedHaplotypeLength <<"\n";
|
||||
#endif
|
||||
jboolean is_copy = JNI_FALSE;
|
||||
jbyte* readBasesArray = (env)->GetByteArrayElements(readBases, &is_copy);
|
||||
jbyte* haplotypeBasesArray = (env)->GetByteArrayElements(haplotypeBases, &is_copy);
|
||||
jbyte* readQualsArray = (env)->GetByteArrayElements(readQuals, &is_copy);
|
||||
#ifdef DEBUG
|
||||
assert(readBasesArray && "readBasesArray not initialized in JNI");
|
||||
assert(haplotypeBasesArray && "haplotypeBasesArray not initialized in JNI");
|
||||
assert(readQualsArray && "readQualsArray not initialized in JNI");
|
||||
#endif
|
||||
testcase tc;
|
||||
|
||||
tc.rslen = paddedReadLength-1;
|
||||
tc.haplen = paddedHaplotypeLength-1;
|
||||
|
||||
tc.rs = (char*)readBasesArray;
|
||||
tc.hap = (char*)haplotypeBasesArray;
|
||||
tc.q = (char*)readQualsArray; //TOASK - q is now char*
|
||||
|
||||
compute_full_prob<double>(&tc, g_double_dataholder.m_matchMatrix, g_double_dataholder.m_insertionMatrix,
|
||||
g_double_dataholder.m_deletionMatrix, g_double_dataholder.m_transition,
|
||||
doInitialization == JNI_TRUE, hapStartIndex, NULL);
|
||||
|
||||
env->ReleaseByteArrayElements(readBases, readBasesArray, JNI_ABORT);
|
||||
env->ReleaseByteArrayElements(haplotypeBases, haplotypeBasesArray, JNI_ABORT);
|
||||
env->ReleaseByteArrayElements(readQuals, readQualsArray, JNI_ABORT);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_jniSubComputeReadLikelihoodGivenHaplotypeLog10(
|
||||
JNIEnv* env, jobject thisObject,
|
||||
jint readLength, jint haplotypeLength,
|
||||
jbyteArray readBases, jbyteArray haplotypeBases, jbyteArray readQuals,
|
||||
jbyteArray insertionGOP, jbyteArray deletionGOP, jbyteArray overallGCP,
|
||||
jint hapStartIndex
|
||||
)
|
||||
{
|
||||
jboolean is_copy = JNI_FALSE;
|
||||
jbyte* readBasesArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(readBases, &is_copy);
|
||||
jbyte* haplotypeBasesArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(haplotypeBases, &is_copy);
|
||||
jbyte* readQualsArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(readQuals, &is_copy);
|
||||
jbyte* insertionGOPArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(insertionGOP, &is_copy);
|
||||
jbyte* deletionGOPArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(deletionGOP, &is_copy);
|
||||
jbyte* overallGCPArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(overallGCP, &is_copy);
|
||||
#ifdef DEBUG
|
||||
assert(readBasesArray && "readBasesArray not initialized in JNI");
|
||||
assert(haplotypeBasesArray && "haplotypeBasesArray not initialized in JNI");
|
||||
assert(readQualsArray && "readQualsArray not initialized in JNI");
|
||||
assert(insertionGOPArray && "insertionGOP array not initialized in JNI");
|
||||
assert(deletionGOPArray && "deletionGOP array not initialized in JNI");
|
||||
assert(overallGCPArray && "OverallGCP array not initialized in JNI");
|
||||
//assert(readLength < MROWS);
|
||||
#endif
|
||||
testcase tc;
|
||||
tc.rslen = readLength;
|
||||
tc.haplen = haplotypeLength;
|
||||
tc.rs = (char*)readBasesArray;
|
||||
tc.hap = (char*)haplotypeBasesArray;
|
||||
for(unsigned i=0;i<readLength;++i)
|
||||
{
|
||||
tc.q[i] = (int)readQualsArray[i];
|
||||
tc.i[i] = (int)insertionGOPArray[i];
|
||||
tc.d[i] = (int)deletionGOPArray[i];
|
||||
tc.c[i] = (int)overallGCPArray[i];
|
||||
}
|
||||
|
||||
double result_avxd = g_compute_full_prob_double(&tc, 0);
|
||||
double result = log10(result_avxd) - log10(ldexp(1.0, 1020));
|
||||
#ifdef DEBUG
|
||||
g_load_time_initializer.debug_dump("return_values_jni.txt",to_string(result),true);
|
||||
#endif
|
||||
|
||||
|
||||
RELEASE_BYTE_ARRAY_ELEMENTS(overallGCP, overallGCPArray, JNI_RO_RELEASE_MODE);
|
||||
RELEASE_BYTE_ARRAY_ELEMENTS(deletionGOP, deletionGOPArray, JNI_RO_RELEASE_MODE);
|
||||
RELEASE_BYTE_ARRAY_ELEMENTS(insertionGOP, insertionGOPArray, JNI_RO_RELEASE_MODE);
|
||||
RELEASE_BYTE_ARRAY_ELEMENTS(readQuals, readQualsArray, JNI_RO_RELEASE_MODE);
|
||||
RELEASE_BYTE_ARRAY_ELEMENTS(haplotypeBases, haplotypeBasesArray, JNI_RO_RELEASE_MODE);
|
||||
RELEASE_BYTE_ARRAY_ELEMENTS(readBases, readBasesArray, JNI_RO_RELEASE_MODE);
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM */
|
||||
|
||||
#ifndef _Included_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM
|
||||
#define _Included_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_TRISTATE_CORRECTION
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_TRISTATE_CORRECTION 3.0
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_dumpSandboxOnly
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_dumpSandboxOnly 0L
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug 0L
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_verify
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_verify 1L
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug0_1
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug0_1 0L
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug1
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug1 0L
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug2
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug2 0L
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug3
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_debug3 0L
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM
|
||||
* Method: jniInitialize
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_jniInitialize
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM
|
||||
* Method: jniInitializeProbabilities
|
||||
* Signature: ([[D[B[B[B)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_jniInitializeProbabilities
|
||||
(JNIEnv *, jclass, jobjectArray, jbyteArray, jbyteArray, jbyteArray);
|
||||
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM
|
||||
* Method: jniInitializePriorsAndUpdateCells
|
||||
* Signature: (ZII[B[B[BI)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_jniInitializePriorsAndUpdateCells
|
||||
(JNIEnv *, jobject, jboolean, jint, jint, jbyteArray, jbyteArray, jbyteArray, jint);
|
||||
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM
|
||||
* Method: jniSubComputeReadLikelihoodGivenHaplotypeLog10
|
||||
* Signature: (II[B[B[B[B[B[BI)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_DebugJNILoglessPairHMM_jniSubComputeReadLikelihoodGivenHaplotypeLog10
|
||||
(JNIEnv *, jobject, jint, jint, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,416 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "headers.h"
|
||||
#include "jni_common.h"
|
||||
#include "org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM.h"
|
||||
//#include "template.h"
|
||||
#include "utils.h"
|
||||
#include "LoadTimeInitializer.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniGetMachineType
|
||||
(JNIEnv* env, jobject thisObject)
|
||||
{
|
||||
return (jlong)get_machine_capabilities();
|
||||
}
|
||||
|
||||
//Should be called only once for the whole Java process - initializes field ids for the classes JNIReadDataHolderClass
|
||||
//and JNIHaplotypeDataHolderClass
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniInitializeClassFieldsAndMachineMask
|
||||
(JNIEnv* env, jobject thisObject, jclass readDataHolderClass, jclass haplotypeDataHolderClass, jlong mask)
|
||||
{
|
||||
assert(readDataHolderClass);
|
||||
assert(haplotypeDataHolderClass);
|
||||
jfieldID fid;
|
||||
fid = env->GetFieldID(readDataHolderClass, "readBases", "[B");
|
||||
assert(fid && "JNI pairHMM: Could not get FID for readBases");
|
||||
g_load_time_initializer.m_readBasesFID = fid;
|
||||
fid = env->GetFieldID(readDataHolderClass, "readQuals", "[B");
|
||||
assert(fid && "JNI pairHMM: Could not get FID for readQuals");
|
||||
g_load_time_initializer.m_readQualsFID = fid;
|
||||
fid = env->GetFieldID(readDataHolderClass, "insertionGOP", "[B");
|
||||
assert(fid && "JNI pairHMM: Could not get FID for insertionGOP");
|
||||
g_load_time_initializer.m_insertionGOPFID = fid;
|
||||
fid = env->GetFieldID(readDataHolderClass, "deletionGOP", "[B");
|
||||
assert(fid && "JNI pairHMM: Could not get FID for deletionGOP");
|
||||
g_load_time_initializer.m_deletionGOPFID = fid;
|
||||
fid = env->GetFieldID(readDataHolderClass, "overallGCP", "[B");
|
||||
assert(fid && "JNI pairHMM: Could not get FID for overallGCP");
|
||||
g_load_time_initializer.m_overallGCPFID = fid;
|
||||
|
||||
fid = env->GetFieldID(haplotypeDataHolderClass, "haplotypeBases", "[B");
|
||||
assert(fid && "JNI pairHMM: Could not get FID for haplotypeBases");
|
||||
g_load_time_initializer.m_haplotypeBasesFID = fid;
|
||||
if(mask != ENABLE_ALL_HARDWARE_FEATURES)
|
||||
{
|
||||
cout << "Using user supplied hardware mask to re-initialize function pointers for PairHMM\n";
|
||||
initialize_function_pointers((uint64_t)mask);
|
||||
cout.flush();
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL initializeHaplotypes
|
||||
(JNIEnv * env, jobject& thisObject, jint numHaplotypes, jobjectArray& haplotypeDataArray,
|
||||
vector<pair<jbyteArray, jbyte*> >& haplotypeBasesArrayVector, vector<unsigned>& haplotypeBasesLengths)
|
||||
{
|
||||
jboolean is_copy = JNI_FALSE;
|
||||
haplotypeBasesArrayVector.clear();
|
||||
haplotypeBasesLengths.clear();
|
||||
haplotypeBasesArrayVector.resize(numHaplotypes);
|
||||
haplotypeBasesLengths.resize(numHaplotypes);
|
||||
jsize haplotypeBasesLength = 0;
|
||||
for(unsigned j=0;j<numHaplotypes;++j)
|
||||
{
|
||||
jobject haplotypeObject = env->GetObjectArrayElement(haplotypeDataArray, j);
|
||||
jbyteArray haplotypeBases = (jbyteArray)env->GetObjectField(haplotypeObject, g_load_time_initializer.m_haplotypeBasesFID);
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
assert(haplotypeBases && ("haplotypeBases is NULL at index : "+to_string(j)+"\n").c_str());
|
||||
#endif
|
||||
//Need a global reference as this will be accessed across multiple JNI calls to JNIComputeLikelihoods()
|
||||
jbyteArray haplotypeBasesGlobalRef = (jbyteArray)env->NewGlobalRef(haplotypeBases);
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
assert(haplotypeBasesGlobalRef && ("Could not get global ref to haplotypeBases at index : "+to_string(j)+"\n").c_str());
|
||||
#endif
|
||||
env->DeleteLocalRef(haplotypeBases); //free the local reference
|
||||
jbyte* haplotypeBasesArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(haplotypeBasesGlobalRef, &is_copy);
|
||||
haplotypeBasesLength = env->GetArrayLength(haplotypeBasesGlobalRef);
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
assert(haplotypeBasesArray && "haplotypeBasesArray not initialized in JNI");
|
||||
//assert(haplotypeBasesLength < MCOLS);
|
||||
#endif
|
||||
#ifdef DEBUG0_1
|
||||
cout << "JNI haplotype length "<<haplotypeBasesLength<<"\n";
|
||||
#endif
|
||||
haplotypeBasesArrayVector[j] = make_pair(haplotypeBasesGlobalRef, haplotypeBasesArray);
|
||||
haplotypeBasesLengths[j] = haplotypeBasesLength;
|
||||
#ifdef DEBUG3
|
||||
for(unsigned k=0;k<haplotypeBasesLength;++k)
|
||||
g_load_time_initializer.debug_dump("haplotype_bases_jni.txt",to_string((int)haplotypeBasesArray[k]),true);
|
||||
#endif
|
||||
#ifdef DO_PROFILING
|
||||
g_load_time_initializer.update_stat(HAPLOTYPE_LENGTH_IDX, haplotypeBasesLength);
|
||||
g_load_time_initializer.m_bytes_copied += (is_copy ? haplotypeBasesLength : 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL releaseHaplotypes(JNIEnv * env, jobject thisObject,
|
||||
vector<pair<jbyteArray, jbyte*> >& haplotypeBasesArrayVector, vector<unsigned>& haplotypeBasesLengths
|
||||
)
|
||||
{
|
||||
//Now release haplotype arrays
|
||||
for(int j=haplotypeBasesArrayVector.size()-1;j>=0;--j) //note the order - reverse of GET
|
||||
{
|
||||
RELEASE_BYTE_ARRAY_ELEMENTS(haplotypeBasesArrayVector[j].first, haplotypeBasesArrayVector[j].second, JNI_RO_RELEASE_MODE);
|
||||
env->DeleteGlobalRef(haplotypeBasesArrayVector[j].first); //free the global reference
|
||||
}
|
||||
haplotypeBasesArrayVector.clear();
|
||||
haplotypeBasesLengths.clear();
|
||||
}
|
||||
|
||||
|
||||
vector<pair<jbyteArray, jbyte*> > g_haplotypeBasesArrayVector;
|
||||
vector<unsigned> g_haplotypeBasesLengths;
|
||||
//Since the list of haplotypes against which the reads are evaluated in PairHMM is the same for a region,
|
||||
//transfer the list only once
|
||||
//Works only for ST case as the haplotype data is stored in global variables
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniInitializeHaplotypes
|
||||
(JNIEnv * env, jobject thisObject, jint numHaplotypes, jobjectArray haplotypeDataArray)
|
||||
{
|
||||
#ifdef SINGLE_THREADED_ONLY
|
||||
//To ensure, GET_BYTE_ARRAY_ELEMENTS is invoked only once for each haplotype, store bytearrays in a vector
|
||||
initializeHaplotypes(env, thisObject, numHaplotypes, haplotypeDataArray, g_haplotypeBasesArrayVector, g_haplotypeBasesLengths);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//Create a vector of testcases for computation - copy the references to bytearrays read/readQuals etc into the appropriate
|
||||
//testcase struct
|
||||
inline JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniInitializeTestcasesVector
|
||||
(JNIEnv* env, jint numReads, jint numHaplotypes, jobjectArray& readDataArray,
|
||||
vector<vector<pair<jbyteArray,jbyte*> > >& readBasesArrayVector,
|
||||
vector<pair<jbyteArray, jbyte*> >& haplotypeBasesArrayVector, vector<unsigned>& haplotypeBasesLengths,
|
||||
vector<testcase>& tc_array)
|
||||
{
|
||||
jboolean is_copy = JNI_FALSE;
|
||||
unsigned tc_idx = 0;
|
||||
for(unsigned i=0;i<numReads;++i)
|
||||
{
|
||||
//Get bytearray fields from read
|
||||
jobject readObject = env->GetObjectArrayElement(readDataArray, i);
|
||||
jbyteArray readBases = (jbyteArray)env->GetObjectField(readObject, g_load_time_initializer.m_readBasesFID);
|
||||
jbyteArray insertionGOP = (jbyteArray)env->GetObjectField(readObject, g_load_time_initializer.m_insertionGOPFID);
|
||||
jbyteArray deletionGOP = (jbyteArray)env->GetObjectField(readObject, g_load_time_initializer.m_deletionGOPFID);
|
||||
jbyteArray overallGCP = (jbyteArray)env->GetObjectField(readObject, g_load_time_initializer.m_overallGCPFID);
|
||||
jbyteArray readQuals = (jbyteArray)env->GetObjectField(readObject, g_load_time_initializer.m_readQualsFID);
|
||||
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
assert(readBases && ("readBases is NULL at index : "+to_string(i)+"\n").c_str());
|
||||
assert(insertionGOP && ("insertionGOP is NULL at index : "+to_string(i)+"\n").c_str());
|
||||
assert(deletionGOP && ("deletionGOP is NULL at index : "+to_string(i)+"\n").c_str());
|
||||
assert(overallGCP && ("overallGCP is NULL at index : "+to_string(i)+"\n").c_str());
|
||||
assert(readQuals && ("readQuals is NULL at index : "+to_string(i)+"\n").c_str());
|
||||
#endif
|
||||
jsize readLength = env->GetArrayLength(readBases);
|
||||
|
||||
jbyte* readBasesArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(readBases, &is_copy); //order of GET-RELEASE is important
|
||||
jbyte* readQualsArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(readQuals, &is_copy);
|
||||
jbyte* insertionGOPArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(insertionGOP, &is_copy);
|
||||
jbyte* deletionGOPArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(deletionGOP, &is_copy);
|
||||
jbyte* overallGCPArray = (jbyte*)GET_BYTE_ARRAY_ELEMENTS(overallGCP, &is_copy);
|
||||
#ifdef DO_PROFILING
|
||||
g_load_time_initializer.m_bytes_copied += (is_copy ? readLength*5 : 0);
|
||||
g_load_time_initializer.update_stat(READ_LENGTH_IDX, readLength);
|
||||
#endif
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
assert(readBasesArray && "readBasesArray not initialized in JNI");
|
||||
assert(readQualsArray && "readQualsArray not initialized in JNI");
|
||||
assert(insertionGOPArray && "insertionGOP array not initialized in JNI");
|
||||
assert(deletionGOPArray && "deletionGOP array not initialized in JNI");
|
||||
assert(overallGCPArray && "overallGCP array not initialized in JNI");
|
||||
//assert(readLength < MROWS);
|
||||
assert(readLength == env->GetArrayLength(readQuals));
|
||||
assert(readLength == env->GetArrayLength(insertionGOP));
|
||||
assert(readLength == env->GetArrayLength(deletionGOP));
|
||||
assert(readLength == env->GetArrayLength(overallGCP));
|
||||
#endif
|
||||
#ifdef DEBUG0_1
|
||||
cout << "JNI read length "<<readLength<<"\n";
|
||||
#endif
|
||||
#ifdef DEBUG3
|
||||
for(unsigned j=0;j<readLength;++j)
|
||||
{
|
||||
g_load_time_initializer.debug_dump("reads_jni.txt",to_string((int)readBasesArray[j]),true);
|
||||
g_load_time_initializer.debug_dump("reads_jni.txt",to_string((int)readQualsArray[j]),true);
|
||||
g_load_time_initializer.debug_dump("reads_jni.txt",to_string((int)insertionGOPArray[j]),true);
|
||||
g_load_time_initializer.debug_dump("reads_jni.txt",to_string((int)deletionGOPArray[j]),true);
|
||||
g_load_time_initializer.debug_dump("reads_jni.txt",to_string((int)overallGCPArray[j]),true);
|
||||
}
|
||||
#endif
|
||||
for(unsigned j=0;j<numHaplotypes;++j)
|
||||
{
|
||||
jsize haplotypeLength = (jsize)haplotypeBasesLengths[j];
|
||||
jbyte* haplotypeBasesArray = haplotypeBasesArrayVector[j].second;
|
||||
tc_array[tc_idx].rslen = (int)readLength;
|
||||
tc_array[tc_idx].haplen = (int)haplotypeLength;
|
||||
tc_array[tc_idx].hap = (char*)haplotypeBasesArray;
|
||||
tc_array[tc_idx].rs = (char*)readBasesArray;
|
||||
tc_array[tc_idx].q = (char*)readQualsArray;
|
||||
tc_array[tc_idx].i = (char*)insertionGOPArray;
|
||||
tc_array[tc_idx].d = (char*)deletionGOPArray;
|
||||
tc_array[tc_idx].c = (char*)overallGCPArray;
|
||||
#ifdef DO_PROFILING
|
||||
g_load_time_initializer.update_stat(PRODUCT_READ_LENGTH_HAPLOTYPE_LENGTH_IDX, ((uint64_t)readLength)*((uint64_t)haplotypeLength));
|
||||
#endif
|
||||
#ifdef DUMP_TO_SANDBOX
|
||||
g_load_time_initializer.dump_sandbox(tc_array[tc_idx], tc_idx, numReads, numHaplotypes);
|
||||
#endif
|
||||
++tc_idx;
|
||||
}
|
||||
//Store the read array references and release them at the end because they are used by compute_full_prob
|
||||
//Maintain order in which GET_BYTE_ARRAY_ELEMENTS called
|
||||
readBasesArrayVector[i].clear();
|
||||
readBasesArrayVector[i].resize(5);
|
||||
readBasesArrayVector[i][0] = make_pair(readBases, readBasesArray);
|
||||
readBasesArrayVector[i][1] = make_pair(readQuals, readQualsArray);
|
||||
readBasesArrayVector[i][2] = make_pair(insertionGOP, insertionGOPArray);
|
||||
readBasesArrayVector[i][3] = make_pair(deletionGOP, deletionGOPArray);
|
||||
readBasesArrayVector[i][4] = make_pair(overallGCP, overallGCPArray);
|
||||
}
|
||||
}
|
||||
|
||||
//Do compute over vector of testcase structs
|
||||
inline void compute_testcases(vector<testcase>& tc_array, unsigned numTestCases, double* likelihoodDoubleArray,
|
||||
unsigned maxNumThreadsToUse)
|
||||
{
|
||||
#ifdef DO_REPEAT_PROFILING
|
||||
for(unsigned i=0;i<10;++i)
|
||||
#endif
|
||||
{
|
||||
#pragma omp parallel for schedule (dynamic,10000) num_threads(maxNumThreadsToUse)
|
||||
for(unsigned tc_idx=0;tc_idx<numTestCases;++tc_idx)
|
||||
{
|
||||
float result_avxf = g_compute_full_prob_float(&(tc_array[tc_idx]), 0);
|
||||
double result = 0;
|
||||
if (result_avxf < MIN_ACCEPTED) {
|
||||
double result_avxd = g_compute_full_prob_double(&(tc_array[tc_idx]), 0);
|
||||
result = log10(result_avxd) - log10(ldexp(1.0, 1020.0));
|
||||
#ifdef DO_PROFILING
|
||||
g_load_time_initializer.update_stat(NUM_DOUBLE_INVOCATIONS_IDX, 1);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
result = (double)(log10f(result_avxf) - log10f(ldexpf(1.f, 120.f)));
|
||||
likelihoodDoubleArray[tc_idx] = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Inform the Java VM that we no longer need access to the read arrays (and free memory)
|
||||
inline JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniReleaseReadArrays
|
||||
(JNIEnv* env, vector<vector<pair<jbyteArray,jbyte*> > >& readBasesArrayVector)
|
||||
{
|
||||
//Release read arrays first
|
||||
for(int i=readBasesArrayVector.size()-1;i>=0;--i)//note the order - reverse of GET
|
||||
{
|
||||
for(int j=readBasesArrayVector[i].size()-1;j>=0;--j)
|
||||
RELEASE_BYTE_ARRAY_ELEMENTS(readBasesArrayVector[i][j].first, readBasesArrayVector[i][j].second, JNI_RO_RELEASE_MODE);
|
||||
readBasesArrayVector[i].clear();
|
||||
}
|
||||
readBasesArrayVector.clear();
|
||||
}
|
||||
|
||||
|
||||
#ifdef DO_WARMUP
|
||||
uint64_t g_sum = 0;
|
||||
#endif
|
||||
//JNI function to invoke compute_full_prob_avx
|
||||
//readDataArray - array of JNIReadDataHolderClass objects which contain the readBases, readQuals etc
|
||||
//haplotypeDataArray - array of JNIHaplotypeDataHolderClass objects which contain the haplotypeBases
|
||||
//likelihoodArray - array of doubles to return results back to Java. Memory allocated by Java prior to JNI call
|
||||
//maxNumThreadsToUse - Max number of threads that OpenMP can use for the HMM computation
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniComputeLikelihoods
|
||||
(JNIEnv* env, jobject thisObject, jint numReads, jint numHaplotypes,
|
||||
jobjectArray readDataArray, jobjectArray haplotypeDataArray, jdoubleArray likelihoodArray, jint maxNumThreadsToUse)
|
||||
{
|
||||
#ifdef DEBUG0_1
|
||||
cout << "JNI numReads "<<numReads<<" numHaplotypes "<<numHaplotypes<<"\n";
|
||||
#endif
|
||||
jboolean is_copy = JNI_FALSE;
|
||||
struct timespec start_time;
|
||||
unsigned numTestCases = numReads*numHaplotypes;
|
||||
//vector to store testcases
|
||||
vector<testcase> tc_array;
|
||||
tc_array.clear();
|
||||
tc_array.resize(numTestCases);
|
||||
//Store read arrays for release later
|
||||
vector<vector<pair<jbyteArray,jbyte*> > > readBasesArrayVector;
|
||||
readBasesArrayVector.clear();
|
||||
readBasesArrayVector.resize(numReads);
|
||||
#ifdef DUMP_TO_SANDBOX
|
||||
g_load_time_initializer.open_sandbox();
|
||||
#endif
|
||||
#ifdef DO_PROFILING
|
||||
get_time(&start_time);
|
||||
#endif
|
||||
|
||||
#ifdef SINGLE_THREADED_ONLY
|
||||
vector<pair<jbyteArray, jbyte*> >& haplotypeBasesArrayVector = g_haplotypeBasesArrayVector;
|
||||
vector<unsigned>& haplotypeBasesLengths = g_haplotypeBasesLengths;
|
||||
#else
|
||||
vector<pair<jbyteArray, jbyte*> > l_haplotypeBasesArrayVector;
|
||||
vector<pair<jbyteArray, jbyte*> >& haplotypeBasesArrayVector = l_haplotypeBasesArrayVector;
|
||||
vector<unsigned> l_haplotypeBasesLengths;
|
||||
vector<unsigned>& haplotypeBasesLengths = l_haplotypeBasesLengths;
|
||||
initializeHaplotypes(env, thisObject, numHaplotypes, haplotypeDataArray, haplotypeBasesArrayVector, haplotypeBasesLengths);
|
||||
#endif
|
||||
//Copy byte array references from Java memory into vector of testcase structs
|
||||
Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniInitializeTestcasesVector(env,
|
||||
numReads, numHaplotypes, readDataArray, readBasesArrayVector, haplotypeBasesArrayVector, haplotypeBasesLengths, tc_array);
|
||||
|
||||
#ifdef DO_PROFILING
|
||||
g_load_time_initializer.m_data_transfer_time += diff_time(start_time);
|
||||
#endif
|
||||
|
||||
//Get double array where results are stored (to pass back to java)
|
||||
jdouble* likelihoodDoubleArray = (jdouble*)GET_DOUBLE_ARRAY_ELEMENTS(likelihoodArray, &is_copy);
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
assert(likelihoodDoubleArray && "likelihoodArray is NULL");
|
||||
assert(env->GetArrayLength(likelihoodArray) == numTestCases);
|
||||
#endif
|
||||
#ifdef DO_WARMUP //ignore - only for crazy profiling
|
||||
for(unsigned i=0;i<haplotypeBasesArrayVector.size();++i)
|
||||
{
|
||||
unsigned curr_size = env->GetArrayLength(haplotypeBasesArrayVector[i].first);
|
||||
for(unsigned j=0;j<curr_size;++j)
|
||||
g_sum += ((uint64_t)((haplotypeBasesArrayVector[i].second)[j]));
|
||||
}
|
||||
for(unsigned i=0;i<readBasesArrayVector.size();++i)
|
||||
{
|
||||
for(unsigned j=0;j<readBasesArrayVector[i].size();++j)
|
||||
{
|
||||
unsigned curr_size = env->GetArrayLength(readBasesArrayVector[i][j].first);
|
||||
for(unsigned k=0;k<curr_size;++k)
|
||||
g_sum += ((uint64_t)((readBasesArrayVector[i][j].second)[k]));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef DO_PROFILING
|
||||
g_load_time_initializer.m_bytes_copied += (is_copy ? numTestCases*sizeof(double) : 0);
|
||||
get_time(&start_time);
|
||||
#endif
|
||||
compute_testcases(tc_array, numTestCases, likelihoodDoubleArray, maxNumThreadsToUse); //actual computation
|
||||
#ifdef DO_PROFILING
|
||||
g_load_time_initializer.m_compute_time += diff_time(start_time);
|
||||
#endif
|
||||
#ifdef DUMP_COMPUTE_VALUES
|
||||
for(unsigned tc_idx=0;tc_idx<numTestCases;++tc_idx)
|
||||
g_load_time_initializer.debug_dump("return_values_jni.txt",to_string(likelihoodDoubleArray[tc_idx]),true);
|
||||
#endif
|
||||
#ifdef DO_PROFILING
|
||||
get_time(&start_time);
|
||||
#endif
|
||||
RELEASE_DOUBLE_ARRAY_ELEMENTS(likelihoodArray, likelihoodDoubleArray, 0); //release mode 0, copy back results to Java memory (if copy made)
|
||||
Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniReleaseReadArrays(env, readBasesArrayVector);
|
||||
#ifndef SINGLE_THREADED_ONLY
|
||||
releaseHaplotypes(env, thisObject, haplotypeBasesArrayVector, haplotypeBasesLengths);
|
||||
#endif
|
||||
|
||||
#ifdef DO_PROFILING
|
||||
g_load_time_initializer.m_data_transfer_time += diff_time(start_time);
|
||||
g_load_time_initializer.update_stat(NUM_REGIONS_IDX, 1);
|
||||
g_load_time_initializer.update_stat(NUM_READS_IDX, numReads);
|
||||
g_load_time_initializer.update_stat(NUM_HAPLOTYPES_IDX, numHaplotypes);
|
||||
g_load_time_initializer.update_stat(NUM_TESTCASES_IDX, numTestCases);
|
||||
#endif
|
||||
tc_array.clear();
|
||||
#ifdef DUMP_TO_SANDBOX
|
||||
g_load_time_initializer.close_sandbox();
|
||||
#endif
|
||||
}
|
||||
|
||||
//If single threaded, release haplotypes at the end of a region
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniFinalizeRegion
|
||||
(JNIEnv * env, jobject thisObject)
|
||||
{
|
||||
#ifdef SINGLE_THREADED_ONLY
|
||||
releaseHaplotypes(env, thisObject, g_haplotypeBasesArrayVector, g_haplotypeBasesLengths);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniClose
|
||||
(JNIEnv* env, jobject thisObject)
|
||||
{
|
||||
#ifdef DO_PROFILING
|
||||
g_load_time_initializer.print_profiling();
|
||||
#endif
|
||||
#ifdef DUMP_COMPUTE_VALUES
|
||||
g_load_time_initializer.debug_close();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM */
|
||||
|
||||
#ifndef _Included_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM
|
||||
#define _Included_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_TRISTATE_CORRECTION
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_TRISTATE_CORRECTION 3.0
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_sse41Mask
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_sse41Mask 1LL
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_sse42Mask
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_sse42Mask 2LL
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_avxMask
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_avxMask 4LL
|
||||
#undef org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_enableAll
|
||||
#define org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_enableAll -1LL
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM
|
||||
* Method: jniGetMachineType
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniGetMachineType
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM
|
||||
* Method: jniInitializeClassFieldsAndMachineMask
|
||||
* Signature: (Ljava/lang/Class;Ljava/lang/Class;J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniInitializeClassFieldsAndMachineMask
|
||||
(JNIEnv *, jobject, jclass, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM
|
||||
* Method: jniInitializeHaplotypes
|
||||
* Signature: (I[Lorg/broadinstitute/gatk/utils/pairhmm/VectorLoglessPairHMM/JNIHaplotypeDataHolderClass;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniInitializeHaplotypes
|
||||
(JNIEnv *, jobject, jint, jobjectArray);
|
||||
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM
|
||||
* Method: jniFinalizeRegion
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniFinalizeRegion
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM
|
||||
* Method: jniComputeLikelihoods
|
||||
* Signature: (II[Lorg/broadinstitute/gatk/utils/pairhmm/VectorLoglessPairHMM/JNIReadDataHolderClass;[Lorg/broadinstitute/gatk/utils/pairhmm/VectorLoglessPairHMM/JNIHaplotypeDataHolderClass;[DI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniComputeLikelihoods
|
||||
(JNIEnv *, jobject, jint, jint, jobjectArray, jobjectArray, jdoubleArray, jint);
|
||||
|
||||
/*
|
||||
* Class: org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM
|
||||
* Method: jniClose
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_broadinstitute_gatk_utils_pairhmm_VectorLoglessPairHMM_jniClose
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "headers.h"
|
||||
#include "utils.h"
|
||||
#include "LoadTimeInitializer.h"
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
cerr << "Needs path to input file as argument\n";
|
||||
exit(0);
|
||||
}
|
||||
bool use_old_read_testcase = false;
|
||||
if(argc >= 3 && string(argv[2]) == "1")
|
||||
use_old_read_testcase = true;
|
||||
unsigned chunk_size = 10000;
|
||||
bool do_check = true;
|
||||
uint64_t mask = ~(0ull);
|
||||
for(int i=3;i<argc;++i)
|
||||
{
|
||||
if(strncmp(argv[i], "-chunk_size", 15) == 0)
|
||||
{
|
||||
++i;
|
||||
chunk_size = strtol(argv[i],0,10);
|
||||
}
|
||||
else
|
||||
if(strncmp(argv[i], "-mask", 15) == 0)
|
||||
{
|
||||
++i;
|
||||
mask = strtoll(argv[i],0,16);
|
||||
}
|
||||
else
|
||||
if(strncmp(argv[i], "-no-check", 15) == 0)
|
||||
do_check = false;
|
||||
}
|
||||
if(mask != (~0ull))
|
||||
initialize_function_pointers(mask);
|
||||
do_compute(argv[1], use_old_read_testcase, chunk_size, do_check);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,380 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PRECISION
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
void CONCAT(CONCAT(precompute_masks_,SIMD_ENGINE), PRECISION)(const testcase& tc, int COLS, int numMaskVecs, MASK_TYPE (*maskArr)[NUM_DISTINCT_CHARS]) {
|
||||
|
||||
const int maskBitCnt = MAIN_TYPE_SIZE ;
|
||||
|
||||
for (int vi=0; vi < numMaskVecs; ++vi) {
|
||||
for (int rs=0; rs < NUM_DISTINCT_CHARS; ++rs) {
|
||||
maskArr[vi][rs] = 0 ;
|
||||
}
|
||||
maskArr[vi][AMBIG_CHAR] = MASK_ALL_ONES ;
|
||||
}
|
||||
|
||||
for (int col=1; col < COLS; ++col) {
|
||||
int mIndex = (col-1) / maskBitCnt ;
|
||||
int mOffset = (col-1) % maskBitCnt ;
|
||||
MASK_TYPE bitMask = ((MASK_TYPE)0x1) << (maskBitCnt-1-mOffset) ;
|
||||
|
||||
char hapChar = ConvertChar::get(tc.hap[col-1]);
|
||||
|
||||
if (hapChar == AMBIG_CHAR) {
|
||||
for (int ci=0; ci < NUM_DISTINCT_CHARS; ++ci)
|
||||
maskArr[mIndex][ci] |= bitMask ;
|
||||
}
|
||||
|
||||
maskArr[mIndex][hapChar] |= bitMask ;
|
||||
// bit corresponding to col 1 will be the MSB of the mask 0
|
||||
// bit corresponding to col 2 will be the MSB-1 of the mask 0
|
||||
// ...
|
||||
// bit corresponding to col 32 will be the LSB of the mask 0
|
||||
// bit corresponding to col 33 will be the MSB of the mask 1
|
||||
// ...
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CONCAT(CONCAT(init_masks_for_row_,SIMD_ENGINE), PRECISION)(const testcase& tc, char* rsArr, MASK_TYPE* lastMaskShiftOut, int beginRowIndex, int numRowsToProcess) {
|
||||
|
||||
for (int ri=0; ri < numRowsToProcess; ++ri) {
|
||||
rsArr[ri] = ConvertChar::get(tc.rs[ri+beginRowIndex-1]) ;
|
||||
}
|
||||
|
||||
for (int ei=0; ei < AVX_LENGTH; ++ei) {
|
||||
lastMaskShiftOut[ei] = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
#define SET_MASK_WORD(__dstMask, __srcMask, __lastShiftOut, __shiftBy, __maskBitCnt){ \
|
||||
MASK_TYPE __bitMask = (((MASK_TYPE)0x1) << __shiftBy) - 1 ; \
|
||||
MASK_TYPE __nextShiftOut = (__srcMask & __bitMask) << (__maskBitCnt - __shiftBy) ; \
|
||||
__dstMask = (__srcMask >> __shiftBy) | __lastShiftOut ; \
|
||||
__lastShiftOut = __nextShiftOut ; \
|
||||
}
|
||||
|
||||
|
||||
void CONCAT(CONCAT(update_masks_for_cols_,SIMD_ENGINE), PRECISION)(int maskIndex, BITMASK_VEC& bitMaskVec, MASK_TYPE (*maskArr) [NUM_DISTINCT_CHARS], char* rsArr, MASK_TYPE* lastMaskShiftOut, int maskBitCnt) {
|
||||
|
||||
for (int ei=0; ei < AVX_LENGTH/2; ++ei) {
|
||||
SET_MASK_WORD(bitMaskVec.getLowEntry(ei), maskArr[maskIndex][rsArr[ei]],
|
||||
lastMaskShiftOut[ei], ei, maskBitCnt) ;
|
||||
|
||||
int ei2 = ei + AVX_LENGTH/2 ; // the second entry index
|
||||
SET_MASK_WORD(bitMaskVec.getHighEntry(ei), maskArr[maskIndex][rsArr[ei2]],
|
||||
lastMaskShiftOut[ei2], ei2, maskBitCnt) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
inline void CONCAT(CONCAT(computeDistVec,SIMD_ENGINE), PRECISION) (BITMASK_VEC& bitMaskVec, SIMD_TYPE& distm, SIMD_TYPE& _1_distm, SIMD_TYPE& distmChosen) {
|
||||
|
||||
distmChosen = VEC_BLENDV(distm, _1_distm, bitMaskVec.getCombinedMask()) ;
|
||||
|
||||
bitMaskVec.shift_left_1bit() ;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function:
|
||||
* 1- Intializes probability values p_MM, p_XX, P_YY, p_MX, p_GAPM and pack them into vectors (SSE or AVX)
|
||||
* 2- Precompute parts of "distm" which only depeneds on a row number and pack it into vector
|
||||
*/
|
||||
|
||||
template<class NUMBER> void CONCAT(CONCAT(initializeVectors,SIMD_ENGINE), PRECISION)(int ROWS, int COLS, NUMBER* shiftOutM, NUMBER *shiftOutX, NUMBER *shiftOutY, Context<NUMBER> ctx, testcase *tc, SIMD_TYPE *p_MM, SIMD_TYPE *p_GAPM, SIMD_TYPE *p_MX, SIMD_TYPE *p_XX, SIMD_TYPE *p_MY, SIMD_TYPE *p_YY, SIMD_TYPE *distm1D)
|
||||
{
|
||||
NUMBER zero = ctx._(0.0);
|
||||
NUMBER init_Y = ctx.INITIAL_CONSTANT / (tc->haplen);
|
||||
for (int s=0;s<ROWS+COLS+AVX_LENGTH;s++)
|
||||
{
|
||||
shiftOutM[s] = zero;
|
||||
shiftOutX[s] = zero;
|
||||
shiftOutY[s] = init_Y;
|
||||
}
|
||||
|
||||
NUMBER *ptr_p_MM = (NUMBER *)p_MM;
|
||||
NUMBER *ptr_p_XX = (NUMBER *)p_XX;
|
||||
NUMBER *ptr_p_YY = (NUMBER *)p_YY;
|
||||
NUMBER *ptr_p_MX = (NUMBER *)p_MX;
|
||||
NUMBER *ptr_p_MY = (NUMBER *)p_MY;
|
||||
NUMBER *ptr_p_GAPM = (NUMBER *)p_GAPM;
|
||||
|
||||
*ptr_p_MM = ctx._(0.0);
|
||||
*ptr_p_XX = ctx._(0.0);
|
||||
*ptr_p_YY = ctx._(0.0);
|
||||
*ptr_p_MX = ctx._(0.0);
|
||||
*ptr_p_MY = ctx._(0.0);
|
||||
*ptr_p_GAPM = ctx._(0.0);
|
||||
|
||||
for (int r = 1; r < ROWS; r++)
|
||||
{
|
||||
int _i = tc->i[r-1] & 127;
|
||||
int _d = tc->d[r-1] & 127;
|
||||
int _c = tc->c[r-1] & 127;
|
||||
|
||||
//*(ptr_p_MM+r-1) = ctx._(1.0) - ctx.ph2pr[(_i + _d) & 127];
|
||||
SET_MATCH_TO_MATCH_PROB(*(ptr_p_MM+r-1), _i, _d);
|
||||
*(ptr_p_GAPM+r-1) = ctx._(1.0) - ctx.ph2pr[_c];
|
||||
*(ptr_p_MX+r-1) = ctx.ph2pr[_i];
|
||||
*(ptr_p_XX+r-1) = ctx.ph2pr[_c];
|
||||
*(ptr_p_MY+r-1) = ctx.ph2pr[_d];
|
||||
*(ptr_p_YY+r-1) = ctx.ph2pr[_c];
|
||||
}
|
||||
|
||||
NUMBER *ptr_distm1D = (NUMBER *)distm1D;
|
||||
for (int r = 1; r < ROWS; r++)
|
||||
{
|
||||
int _q = tc->q[r-1] & 127;
|
||||
ptr_distm1D[r-1] = ctx.ph2pr[_q];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function handles pre-stripe computation:
|
||||
* 1- Retrieve probaility vectors from memory
|
||||
* 2- Initialize M, X, Y vectors with all 0's (for the first stripe) and shifting the last row from previous stripe for the rest
|
||||
*/
|
||||
|
||||
template<class NUMBER> inline void CONCAT(CONCAT(stripeINITIALIZATION,SIMD_ENGINE), PRECISION)(
|
||||
int stripeIdx, Context<NUMBER> ctx, testcase *tc, SIMD_TYPE &pGAPM, SIMD_TYPE &pMM, SIMD_TYPE &pMX, SIMD_TYPE &pXX, SIMD_TYPE &pMY, SIMD_TYPE &pYY,
|
||||
SIMD_TYPE &rs, UNION_TYPE &rsN, SIMD_TYPE &distm, SIMD_TYPE &_1_distm, SIMD_TYPE *distm1D, SIMD_TYPE N_packed256, SIMD_TYPE *p_MM , SIMD_TYPE *p_GAPM ,
|
||||
SIMD_TYPE *p_MX, SIMD_TYPE *p_XX , SIMD_TYPE *p_MY, SIMD_TYPE *p_YY, UNION_TYPE &M_t_2, UNION_TYPE &X_t_2, UNION_TYPE &M_t_1, UNION_TYPE &X_t_1,
|
||||
UNION_TYPE &Y_t_2, UNION_TYPE &Y_t_1, UNION_TYPE &M_t_1_y, NUMBER* shiftOutX, NUMBER* shiftOutM)
|
||||
{
|
||||
int i = stripeIdx;
|
||||
pGAPM = p_GAPM[i];
|
||||
pMM = p_MM[i];
|
||||
pMX = p_MX[i];
|
||||
pXX = p_XX[i];
|
||||
pMY = p_MY[i];
|
||||
pYY = p_YY[i];
|
||||
|
||||
NUMBER zero = ctx._(0.0);
|
||||
NUMBER init_Y = ctx.INITIAL_CONSTANT / (tc->haplen);
|
||||
UNION_TYPE packed1; packed1.d = VEC_SET1_VAL(1.0);
|
||||
UNION_TYPE packed3; packed3.d = VEC_SET1_VAL(3.0);
|
||||
|
||||
distm = distm1D[i];
|
||||
_1_distm = VEC_SUB(packed1.d, distm);
|
||||
|
||||
distm = VEC_DIV(distm, packed3.d);
|
||||
|
||||
/* initialize M_t_2, M_t_1, X_t_2, X_t_1, Y_t_2, Y_t_1 */
|
||||
M_t_2.d = VEC_SET1_VAL(zero);
|
||||
X_t_2.d = VEC_SET1_VAL(zero);
|
||||
|
||||
if (i==0) {
|
||||
M_t_1.d = VEC_SET1_VAL(zero);
|
||||
X_t_1.d = VEC_SET1_VAL(zero);
|
||||
Y_t_2.d = VEC_SET_LSE(init_Y);
|
||||
Y_t_1.d = VEC_SET1_VAL(zero);
|
||||
}
|
||||
else {
|
||||
X_t_1.d = VEC_SET_LSE(shiftOutX[AVX_LENGTH]);
|
||||
M_t_1.d = VEC_SET_LSE(shiftOutM[AVX_LENGTH]);
|
||||
Y_t_2.d = VEC_SET1_VAL(zero);
|
||||
Y_t_1.d = VEC_SET1_VAL(zero);
|
||||
}
|
||||
M_t_1_y = M_t_1;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is the main compute kernel to compute M, X and Y
|
||||
*/
|
||||
|
||||
inline void CONCAT(CONCAT(computeMXY,SIMD_ENGINE), PRECISION)(UNION_TYPE &M_t, UNION_TYPE &X_t, UNION_TYPE &Y_t, UNION_TYPE &M_t_y,
|
||||
UNION_TYPE M_t_2, UNION_TYPE X_t_2, UNION_TYPE Y_t_2, UNION_TYPE M_t_1, UNION_TYPE X_t_1, UNION_TYPE M_t_1_y, UNION_TYPE Y_t_1,
|
||||
SIMD_TYPE pMM, SIMD_TYPE pGAPM, SIMD_TYPE pMX, SIMD_TYPE pXX, SIMD_TYPE pMY, SIMD_TYPE pYY, SIMD_TYPE distmSel)
|
||||
{
|
||||
/* Compute M_t <= distm * (p_MM*M_t_2 + p_GAPM*X_t_2 + p_GAPM*Y_t_2) */
|
||||
M_t.d = VEC_MUL(VEC_ADD(VEC_ADD(VEC_MUL(M_t_2.d, pMM), VEC_MUL(X_t_2.d, pGAPM)), VEC_MUL(Y_t_2.d, pGAPM)), distmSel);
|
||||
//M_t.d = VEC_MUL( VEC_ADD(VEC_MUL(M_t_2.d, pMM), VEC_MUL(VEC_ADD(X_t_2.d, Y_t_2.d), pGAPM)), distmSel);
|
||||
|
||||
M_t_y = M_t;
|
||||
|
||||
/* Compute X_t */
|
||||
X_t.d = VEC_ADD(VEC_MUL(M_t_1.d, pMX) , VEC_MUL(X_t_1.d, pXX));
|
||||
|
||||
/* Compute Y_t */
|
||||
Y_t.d = VEC_ADD(VEC_MUL(M_t_1_y.d, pMY) , VEC_MUL(Y_t_1.d, pYY));
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the main compute function. It operates on the matrix in s stripe manner.
|
||||
* The stripe height is determined by the SIMD engine type.
|
||||
* Stripe height: "AVX float": 8, "AVX double": 4, "SSE float": 4, "SSE double": 2
|
||||
* For each stripe the operations are anti-diagonal based.
|
||||
* Each anti-diagonal (M_t, Y_t, X_t) depends on the two previous anti-diagonals (M_t_2, X_t_2, Y_t_2, M_t_1, X_t_1, Y_t_1).
|
||||
* Each stripe (except the fist one) depends on the last row of the previous stripe.
|
||||
* The last stripe computation handles the addition of the last row of M and X, that's the reason for loop spliting.
|
||||
*/
|
||||
|
||||
template<class NUMBER> NUMBER CONCAT(CONCAT(compute_full_prob_,SIMD_ENGINE), PRECISION) (testcase *tc, NUMBER *before_last_log = NULL)
|
||||
{
|
||||
int ROWS = tc->rslen + 1;
|
||||
int COLS = tc->haplen + 1;
|
||||
int MAVX_COUNT = (ROWS+AVX_LENGTH-1)/AVX_LENGTH;
|
||||
|
||||
/* Probaility arrays */
|
||||
SIMD_TYPE p_MM [MAVX_COUNT], p_GAPM [MAVX_COUNT], p_MX [MAVX_COUNT];
|
||||
SIMD_TYPE p_XX [MAVX_COUNT], p_MY [MAVX_COUNT], p_YY [MAVX_COUNT];
|
||||
|
||||
/* For distm precomputation */
|
||||
SIMD_TYPE distm1D[MAVX_COUNT];
|
||||
|
||||
/* Carries the values from each stripe to the next stripe */
|
||||
NUMBER shiftOutM[ROWS+COLS+AVX_LENGTH], shiftOutX[ROWS+COLS+AVX_LENGTH], shiftOutY[ROWS+COLS+AVX_LENGTH];
|
||||
|
||||
/* The vector to keep the anti-diagonals of M, X, Y*/
|
||||
/* Current: M_t, X_t, Y_t */
|
||||
/* Previous: M_t_1, X_t_1, Y_t_1 */
|
||||
/* Previous to previous: M_t_2, X_t_2, Y_t_2 */
|
||||
UNION_TYPE M_t, M_t_1, M_t_2, X_t, X_t_1, X_t_2, Y_t, Y_t_1, Y_t_2, M_t_y, M_t_1_y;
|
||||
|
||||
/* Probality vectors */
|
||||
SIMD_TYPE pGAPM, pMM, pMX, pXX, pMY, pYY;
|
||||
|
||||
struct timeval start, end;
|
||||
NUMBER result_avx2;
|
||||
Context<NUMBER> ctx;
|
||||
UNION_TYPE rs , rsN;
|
||||
HAP_TYPE hap;
|
||||
SIMD_TYPE distmSel, distmChosen ;
|
||||
SIMD_TYPE distm, _1_distm;
|
||||
|
||||
int r, c;
|
||||
NUMBER zero = ctx._(0.0);
|
||||
UNION_TYPE packed1; packed1.d = VEC_SET1_VAL(1.0);
|
||||
SIMD_TYPE N_packed256 = VEC_POPCVT_CHAR('N');
|
||||
NUMBER init_Y = ctx.INITIAL_CONSTANT / (tc->haplen);
|
||||
int remainingRows = (ROWS-1) % AVX_LENGTH;
|
||||
int stripe_cnt = ((ROWS-1) / AVX_LENGTH) + (remainingRows!=0);
|
||||
|
||||
const int maskBitCnt = MAIN_TYPE_SIZE ;
|
||||
const int numMaskVecs = (COLS+ROWS+maskBitCnt-1)/maskBitCnt ; // ceil function
|
||||
|
||||
/* Mask precomputation for distm*/
|
||||
MASK_TYPE maskArr[numMaskVecs][NUM_DISTINCT_CHARS] ;
|
||||
CONCAT(CONCAT(precompute_masks_,SIMD_ENGINE), PRECISION)(*tc, COLS, numMaskVecs, maskArr) ;
|
||||
|
||||
char rsArr[AVX_LENGTH] ;
|
||||
MASK_TYPE lastMaskShiftOut[AVX_LENGTH] ;
|
||||
|
||||
/* Precompute initialization for probabilities and shift vector*/
|
||||
CONCAT(CONCAT(initializeVectors,SIMD_ENGINE), PRECISION)<NUMBER>(ROWS, COLS, shiftOutM, shiftOutX, shiftOutY,
|
||||
ctx, tc, p_MM, p_GAPM, p_MX, p_XX, p_MY, p_YY, distm1D);
|
||||
|
||||
for (int i=0;i<stripe_cnt-1;i++)
|
||||
{
|
||||
//STRIPE_INITIALIZATION
|
||||
CONCAT(CONCAT(stripeINITIALIZATION,SIMD_ENGINE), PRECISION)(i, ctx, tc, pGAPM, pMM, pMX, pXX, pMY, pYY, rs.d, rsN, distm, _1_distm, distm1D, N_packed256, p_MM , p_GAPM ,
|
||||
p_MX, p_XX , p_MY, p_YY, M_t_2, X_t_2, M_t_1, X_t_1, Y_t_2, Y_t_1, M_t_1_y, shiftOutX, shiftOutM);
|
||||
CONCAT(CONCAT(init_masks_for_row_,SIMD_ENGINE), PRECISION)(*tc, rsArr, lastMaskShiftOut, i*AVX_LENGTH+1, AVX_LENGTH) ;
|
||||
// Since there are no shift intrinsics in AVX, keep the masks in 2 SSE vectors
|
||||
|
||||
BITMASK_VEC bitMaskVec ;
|
||||
|
||||
for (int begin_d=1;begin_d<COLS+AVX_LENGTH;begin_d+=MAIN_TYPE_SIZE)
|
||||
{
|
||||
int numMaskBitsToProcess = std::min(MAIN_TYPE_SIZE, COLS+AVX_LENGTH-begin_d) ;
|
||||
CONCAT(CONCAT(update_masks_for_cols_,SIMD_ENGINE), PRECISION)((begin_d-1)/MAIN_TYPE_SIZE, bitMaskVec, maskArr, rsArr, lastMaskShiftOut, maskBitCnt) ;
|
||||
|
||||
for (int mbi=0; mbi < numMaskBitsToProcess; ++mbi) {
|
||||
CONCAT(CONCAT(computeDistVec,SIMD_ENGINE), PRECISION) (bitMaskVec, distm, _1_distm, distmChosen) ;
|
||||
int ShiftIdx = begin_d + mbi + AVX_LENGTH;
|
||||
|
||||
CONCAT(CONCAT(computeMXY,SIMD_ENGINE), PRECISION)(M_t, X_t, Y_t, M_t_y, M_t_2, X_t_2, Y_t_2, M_t_1, X_t_1, M_t_1_y, Y_t_1,
|
||||
pMM, pGAPM, pMX, pXX, pMY, pYY, distmChosen);
|
||||
|
||||
CONCAT(CONCAT(_vector_shift,SIMD_ENGINE), PRECISION)(M_t, shiftOutM[ShiftIdx], shiftOutM[begin_d+mbi]);
|
||||
|
||||
CONCAT(CONCAT(_vector_shift,SIMD_ENGINE), PRECISION)(X_t, shiftOutX[ShiftIdx], shiftOutX[begin_d+mbi]);
|
||||
|
||||
CONCAT(CONCAT(_vector_shift,SIMD_ENGINE), PRECISION)(Y_t_1, shiftOutY[ShiftIdx], shiftOutY[begin_d+mbi]);
|
||||
|
||||
M_t_2 = M_t_1; M_t_1 = M_t; X_t_2 = X_t_1; X_t_1 = X_t;
|
||||
Y_t_2 = Y_t_1; Y_t_1 = Y_t; M_t_1_y = M_t_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int i = stripe_cnt-1;
|
||||
{
|
||||
//STRIPE_INITIALIZATION
|
||||
CONCAT(CONCAT(stripeINITIALIZATION,SIMD_ENGINE), PRECISION)(i, ctx, tc, pGAPM, pMM, pMX, pXX, pMY, pYY, rs.d, rsN, distm, _1_distm, distm1D, N_packed256, p_MM , p_GAPM ,
|
||||
p_MX, p_XX , p_MY, p_YY, M_t_2, X_t_2, M_t_1, X_t_1, Y_t_2, Y_t_1, M_t_1_y, shiftOutX, shiftOutM);
|
||||
|
||||
if (remainingRows==0) remainingRows=AVX_LENGTH;
|
||||
CONCAT(CONCAT(init_masks_for_row_,SIMD_ENGINE), PRECISION)(*tc, rsArr, lastMaskShiftOut, i*AVX_LENGTH+1, remainingRows) ;
|
||||
|
||||
SIMD_TYPE sumM, sumX;
|
||||
sumM = VEC_SET1_VAL(zero);
|
||||
sumX = VEC_SET1_VAL(zero);
|
||||
|
||||
// Since there are no shift intrinsics in AVX, keep the masks in 2 SSE vectors
|
||||
BITMASK_VEC bitMaskVec ;
|
||||
|
||||
for (int begin_d=1;begin_d<COLS+remainingRows-1;begin_d+=MAIN_TYPE_SIZE)
|
||||
{
|
||||
int numMaskBitsToProcess = std::min(MAIN_TYPE_SIZE, COLS+remainingRows-1-begin_d) ;
|
||||
CONCAT(CONCAT(update_masks_for_cols_,SIMD_ENGINE),PRECISION)((begin_d-1)/MAIN_TYPE_SIZE, bitMaskVec, maskArr, rsArr, lastMaskShiftOut, maskBitCnt) ;
|
||||
|
||||
for (int mbi=0; mbi < numMaskBitsToProcess; ++mbi) {
|
||||
|
||||
CONCAT(CONCAT(computeDistVec,SIMD_ENGINE), PRECISION) (bitMaskVec, distm, _1_distm, distmChosen) ;
|
||||
int ShiftIdx = begin_d + mbi +AVX_LENGTH;
|
||||
|
||||
CONCAT(CONCAT(computeMXY,SIMD_ENGINE), PRECISION)(M_t, X_t, Y_t, M_t_y, M_t_2, X_t_2, Y_t_2, M_t_1, X_t_1, M_t_1_y, Y_t_1,
|
||||
pMM, pGAPM, pMX, pXX, pMY, pYY, distmChosen);
|
||||
|
||||
sumM = VEC_ADD(sumM, M_t.d);
|
||||
CONCAT(CONCAT(_vector_shift_last,SIMD_ENGINE), PRECISION)(M_t, shiftOutM[ShiftIdx]);
|
||||
|
||||
sumX = VEC_ADD(sumX, X_t.d);
|
||||
CONCAT(CONCAT(_vector_shift_last,SIMD_ENGINE), PRECISION)(X_t, shiftOutX[ShiftIdx]);
|
||||
|
||||
CONCAT(CONCAT(_vector_shift_last,SIMD_ENGINE), PRECISION)(Y_t_1, shiftOutY[ShiftIdx]);
|
||||
|
||||
M_t_2 = M_t_1; M_t_1 = M_t; X_t_2 = X_t_1; X_t_1 = X_t;
|
||||
Y_t_2 = Y_t_1; Y_t_1 = Y_t; M_t_1_y = M_t_y;
|
||||
|
||||
}
|
||||
}
|
||||
UNION_TYPE sumMX;
|
||||
sumMX.d = VEC_ADD(sumM, sumX);
|
||||
result_avx2 = sumMX.f[remainingRows-1];
|
||||
}
|
||||
return result_avx2;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
#define SIMD_ENGINE avx
|
||||
#define SIMD_ENGINE_AVX
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#define BATCH_SIZE 10000
|
||||
#define RUN_HYBRID
|
||||
|
||||
double getCurrClk();
|
||||
int thread_level_parallelism_enabled = false ;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
testcase* tc = new testcase[BATCH_SIZE];
|
||||
float result[BATCH_SIZE], result_avxf;
|
||||
double result_avxd;
|
||||
double lastClk = 0.0 ;
|
||||
double aggregateTimeRead = 0.0;
|
||||
double aggregateTimeCompute = 0.0;
|
||||
double aggregateTimeWrite = 0.0;
|
||||
|
||||
// Need to call it once to initialize the static array
|
||||
ConvertChar::init() ;
|
||||
|
||||
// char* ompEnvVar = getenv("OMP_NUM_THREADS") ;
|
||||
// if (ompEnvVar != NULL && ompEnvVar != "" && ompEnvVar != "1" ) {
|
||||
// thread_level_parallelism_enabled = true ;
|
||||
// }
|
||||
|
||||
bool noMoreData = false;
|
||||
int count =0;
|
||||
while (!noMoreData)
|
||||
{
|
||||
int read_count = BATCH_SIZE;
|
||||
|
||||
lastClk = getCurrClk() ;
|
||||
for (int b=0;b<BATCH_SIZE;b++)
|
||||
if (read_testcase(&tc[b])==-1)
|
||||
{
|
||||
read_count = b;
|
||||
noMoreData = true;
|
||||
break;
|
||||
}
|
||||
aggregateTimeRead += (getCurrClk() - lastClk) ;
|
||||
lastClk = getCurrClk() ;
|
||||
|
||||
//#pragma omp parallel for schedule(dynamic) if(thread_level_parallelism_enabled)
|
||||
for (int b=0;b<read_count;b++)
|
||||
{
|
||||
result_avxf = CONCAT(CONCAT(compute_full_prob_,SIMD_ENGINE), s)<float>(&tc[b]);
|
||||
|
||||
#ifdef RUN_HYBRID
|
||||
#define MIN_ACCEPTED 1e-28f
|
||||
if (result_avxf < MIN_ACCEPTED) {
|
||||
count++;
|
||||
result_avxd = CONCAT(CONCAT(compute_full_prob_,SIMD_ENGINE), d)<double>(&tc[b]);
|
||||
result[b] = log10(result_avxd) - log10(ldexp(1.0, 1020.f));
|
||||
}
|
||||
else
|
||||
result[b] = log10f(result_avxf) - log10f(ldexpf(1.f, 120.f));
|
||||
#endif
|
||||
|
||||
#ifndef RUN_HYBRID
|
||||
result[b] = log10f(result_avxf) - log10f(ldexpf(1.f, 120.f));
|
||||
#endif
|
||||
}
|
||||
aggregateTimeCompute += (getCurrClk() - lastClk) ;
|
||||
lastClk = getCurrClk() ;
|
||||
for (int b=0;b<read_count;b++)
|
||||
printf("%E\n", result[b]);
|
||||
aggregateTimeWrite += (getCurrClk() - lastClk) ;
|
||||
}
|
||||
|
||||
delete[] tc;
|
||||
printf("AVX Read Time: %.2f\n", aggregateTimeRead);
|
||||
printf("AVX Compute Time: %.2f\n", aggregateTimeCompute);
|
||||
printf("AVX Write Time: %.2f\n", aggregateTimeWrite);
|
||||
printf("AVX Total Time: %.2f\n", aggregateTimeRead + aggregateTimeCompute + aggregateTimeWrite);
|
||||
printf("# Double called: %d\n", count);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/bash
|
||||
rm -f *.txt *.log
|
||||
GSA_ROOT_DIR=/home/karthikg/broad/gsa-unstable
|
||||
pair_hmm_implementation="VECTOR_LOGLESS_CACHING";
|
||||
if [ "$#" -ge 1 ];
|
||||
then
|
||||
pair_hmm_implementation=$1;
|
||||
fi
|
||||
|
||||
#-Djava.library.path is needed if you wish to override the default 'packed' library
|
||||
#java -jar $GSA_ROOT_DIR/target/GenomeAnalysisTK.jar -T HaplotypeCaller \
|
||||
java -Djava.library.path=${GSA_ROOT_DIR}/public/VectorPairHMM/src/main/c++ -jar $GSA_ROOT_DIR/target/GenomeAnalysisTK.jar -T HaplotypeCaller \
|
||||
--dbsnp /data/broad/samples/joint_variant_calling/dbSNP/00-All.vcf \
|
||||
-R /opt/Genomics/ohsu/dnapipeline/humanrefgenome/human_g1k_v37.fasta \
|
||||
-I /data/simulated/sim1M_pairs_final.bam \
|
||||
-stand_call_conf 50.0 \
|
||||
-stand_emit_conf 10.0 \
|
||||
--pair_hmm_implementation $pair_hmm_implementation \
|
||||
-o output.raw.snps.indels.vcf
|
||||
|
||||
#--pair_hmm_implementation JNI_LOGLESS_CACHING \
|
||||
#-XL unmapped \
|
||||
#-I /data/simulated/sim1M_pairs_final.bam \
|
||||
#-I /data/broad/samples/joint_variant_calling/NA12878_low_coverage_alignment/NA12878.chrom11.ILLUMINA.bwa.CEU.low_coverage.20121211.bam \
|
||||
#-I /data/broad/samples/joint_variant_calling/NA12878_high_coverage_alignment/NA12878.mapped.ILLUMINA.bwa.CEU.high_coverage_pcr_free.20130906.bam \
|
||||
#-R /data/broad/samples/joint_variant_calling/broad_reference/Homo_sapiens_assembly18.fasta \
|
||||
#-R /data/broad/samples/joint_variant_calling/broad_reference/Homo_sapiens_assembly19.fasta \
|
||||
#-R /data/broad/samples/joint_variant_calling/broad_reference/ucsc.hg19.fasta \
|
||||
#-R /opt/Genomics/ohsu/dnapipeline/humanrefgenome/human_g1k_v37.fasta \
|
||||
#-R /data/broad/samples/joint_variant_calling/broad_reference/human_g1k_v37_decoy.fasta \
|
||||
#--dbsnp /data/broad/samples/joint_variant_calling/dbSNP/00-All.vcf \
|
||||
#--dbsnp /data/broad/samples/joint_variant_calling/dbSNP/dbsnp_138.hg19.vcf \
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PRECISION
|
||||
|
||||
#ifdef SIMD_ENGINE_AVX
|
||||
|
||||
inline void CONCAT(CONCAT(_vector_shift,SIMD_ENGINE), PRECISION) (UNION_TYPE &x, MAIN_TYPE shiftIn, MAIN_TYPE &shiftOut)
|
||||
{
|
||||
IF_128 xlow , xhigh;
|
||||
/* cast x to xlow */
|
||||
xlow.f = VEC_CAST_256_128(x.d);
|
||||
/* extract x,1 to xhigh */
|
||||
xhigh.f = VEC_EXTRACT_128(x.d, 1);
|
||||
/* extract xlow[3] */
|
||||
IF_128 shiftOutL128;
|
||||
shiftOutL128.i = _mm_srli_si128(xlow.i, SHIFT_CONST1);
|
||||
/* extract xhigh[3] */
|
||||
IF_MAIN_TYPE shiftOutH;
|
||||
shiftOutH.i = VEC_EXTRACT_UNIT(xhigh.i, SHIFT_CONST2);
|
||||
shiftOut = shiftOutH.f;
|
||||
/* shift xlow */
|
||||
xlow.i = _mm_slli_si128 (xlow.i, SHIFT_CONST3);
|
||||
/* shift xhigh */
|
||||
xhigh.i = _mm_slli_si128 (xhigh.i, SHIFT_CONST3);
|
||||
/*movss shiftIn to xlow[0] */
|
||||
_128_TYPE shiftIn128 = VEC_SET1_VAL128(shiftIn);
|
||||
xlow.f = VEC_MOVE(xlow.f , shiftIn128);
|
||||
/*movss xlow[3] to xhigh[0] */
|
||||
xhigh.f = VEC_MOVE(xhigh.f, shiftOutL128.f);
|
||||
/* cast xlow to x */
|
||||
x.d = VEC_CAST_128_256(xlow.f);
|
||||
/* insert xhigh to x,1 */
|
||||
x.d = VEC_INSERT_VAL(x.d, xhigh.f, 1);
|
||||
}
|
||||
|
||||
|
||||
inline void CONCAT(CONCAT(_vector_shift_last,SIMD_ENGINE), PRECISION) (UNION_TYPE &x, MAIN_TYPE shiftIn)
|
||||
{
|
||||
IF_128 xlow , xhigh;
|
||||
/* cast x to xlow */
|
||||
xlow.f = VEC_CAST_256_128(x.d);
|
||||
/* extract x,1 to xhigh */
|
||||
xhigh.f = VEC_EXTRACT_128(x.d, 1);
|
||||
/* extract xlow[3] */
|
||||
IF_128 shiftOutL128;
|
||||
shiftOutL128.i = _mm_srli_si128(xlow.i, SHIFT_CONST1);
|
||||
/* shift xlow */
|
||||
xlow.i = _mm_slli_si128 (xlow.i, SHIFT_CONST3);
|
||||
/* shift xhigh */
|
||||
xhigh.i = _mm_slli_si128 (xhigh.i, SHIFT_CONST3);
|
||||
/*movss shiftIn to xlow[0] */
|
||||
_128_TYPE shiftIn128 = VEC_SET1_VAL128(shiftIn);
|
||||
xlow.f = VEC_MOVE(xlow.f , shiftIn128);
|
||||
/*movss xlow[3] to xhigh[0] */
|
||||
xhigh.f = VEC_MOVE(xhigh.f, shiftOutL128.f);
|
||||
/* cast xlow to x */
|
||||
x.d = VEC_CAST_128_256(xlow.f);
|
||||
/* insert xhigh to x,1 */
|
||||
x.d = VEC_INSERT_VAL(x.d, xhigh.f, 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SIMD_ENGINE_SSE
|
||||
|
||||
inline void CONCAT(CONCAT(_vector_shift,SIMD_ENGINE), PRECISION) (UNION_TYPE &x, MAIN_TYPE shiftIn, MAIN_TYPE &shiftOut)
|
||||
{
|
||||
IF_MAIN_TYPE tempIn, tempOut;
|
||||
tempIn.f = shiftIn;
|
||||
/* extratc H */
|
||||
tempOut.i = VEC_EXTRACT_UNIT(x.i, SHIFT_CONST1);
|
||||
shiftOut = tempOut.f;
|
||||
/* shift */
|
||||
x.i = _mm_slli_si128(x.i, SHIFT_CONST2);
|
||||
/* insert L */
|
||||
x.i = VEC_INSERT_UNIT(x.i , tempIn.i, SHIFT_CONST3);
|
||||
}
|
||||
|
||||
inline void CONCAT(CONCAT(_vector_shift_last,SIMD_ENGINE), PRECISION) (UNION_TYPE &x, MAIN_TYPE shiftIn)
|
||||
{
|
||||
IF_MAIN_TYPE temp; temp.f = shiftIn;
|
||||
/* shift */
|
||||
x.i = _mm_slli_si128(x.i, SHIFT_CONST2);
|
||||
/* insert L */
|
||||
x.i = VEC_INSERT_UNIT(x.i , temp.i, SHIFT_CONST3);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#undef SIMD_ENGINE
|
||||
#undef SIMD_ENGINE_AVX
|
||||
|
||||
#define SIMD_ENGINE sse
|
||||
#define SIMD_ENGINE_SSE
|
||||
|
||||
#include "template.h"
|
||||
|
||||
#include "define-sse-float.h"
|
||||
#include "shift_template.c"
|
||||
#include "pairhmm-template-kernel.cc"
|
||||
|
||||
#include "define-sse-double.h"
|
||||
#include "shift_template.c"
|
||||
#include "pairhmm-template-kernel.cc"
|
||||
|
||||
template double compute_full_prob_ssed<double>(testcase* tc, double* nextlog);
|
||||
template float compute_full_prob_sses<float>(testcase* tc, float* nextlog);
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TEMPLATES_H_
|
||||
#define TEMPLATES_H_
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
|
||||
#define ALIGNED __attribute__((aligned(32)))
|
||||
|
||||
#ifdef SIMD_ENGINE_AVX
|
||||
typedef union __attribute__((aligned(32))) {
|
||||
ALIGNED __m256 ALIGNED d;
|
||||
ALIGNED __m128i ALIGNED s[2];
|
||||
ALIGNED float ALIGNED f[8];
|
||||
ALIGNED __m256i ALIGNED i;
|
||||
} ALIGNED mix_F ALIGNED;
|
||||
#endif
|
||||
|
||||
typedef union __attribute__((aligned(32))) {
|
||||
ALIGNED __m128 ALIGNED d;
|
||||
ALIGNED __m64 ALIGNED s[2];
|
||||
ALIGNED float ALIGNED f[4];
|
||||
ALIGNED __m128i ALIGNED i;
|
||||
} ALIGNED mix_F128 ALIGNED;
|
||||
|
||||
typedef union ALIGNED {
|
||||
__m128i vec ;
|
||||
__m128 vecf ;
|
||||
uint32_t masks[4] ;
|
||||
} MaskVec_F ;
|
||||
|
||||
typedef union ALIGNED {
|
||||
__m64 vec ;
|
||||
__m64 vecf ;
|
||||
uint32_t masks[2] ;
|
||||
} MaskVec_F128 ;
|
||||
|
||||
typedef union ALIGNED
|
||||
{
|
||||
ALIGNED __m128i ALIGNED i;
|
||||
ALIGNED __m128 ALIGNED f;
|
||||
} ALIGNED IF_128f ALIGNED;
|
||||
|
||||
typedef union ALIGNED
|
||||
{
|
||||
ALIGNED int ALIGNED i;
|
||||
ALIGNED float ALIGNED f;
|
||||
} ALIGNED IF_32 ALIGNED;
|
||||
|
||||
#ifdef SIMD_ENGINE_AVX
|
||||
typedef union __attribute__((aligned(32))) {
|
||||
ALIGNED __m256d ALIGNED d;
|
||||
ALIGNED __m128i ALIGNED s[2];
|
||||
ALIGNED double ALIGNED f[4];
|
||||
ALIGNED __m256i ALIGNED i;
|
||||
} ALIGNED mix_D ALIGNED;
|
||||
#endif
|
||||
|
||||
typedef union __attribute__((aligned(32))) {
|
||||
ALIGNED __m128d ALIGNED d;
|
||||
ALIGNED __m64 ALIGNED s[2];
|
||||
ALIGNED double ALIGNED f[2];
|
||||
ALIGNED __m128i ALIGNED i;
|
||||
} ALIGNED mix_D128 ALIGNED;
|
||||
|
||||
typedef union ALIGNED {
|
||||
__m128i vec ;
|
||||
__m128d vecf ;
|
||||
uint64_t masks[2] ;
|
||||
} MaskVec_D ;
|
||||
|
||||
typedef union ALIGNED {
|
||||
__m64 vec ;
|
||||
__m64 vecf ;
|
||||
uint64_t masks[1] ;
|
||||
} MaskVec_D128 ;
|
||||
|
||||
typedef union ALIGNED
|
||||
{
|
||||
ALIGNED __m128i ALIGNED i;
|
||||
ALIGNED __m128d ALIGNED f;
|
||||
} ALIGNED IF_128d ALIGNED;
|
||||
|
||||
typedef union ALIGNED
|
||||
{
|
||||
ALIGNED int64_t ALIGNED i;
|
||||
ALIGNED double ALIGNED f;
|
||||
} ALIGNED IF_64 ALIGNED;
|
||||
|
||||
|
||||
#include "common_data_structure.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -1,567 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "headers.h"
|
||||
#include "utils.h"
|
||||
#include "LoadTimeInitializer.h"
|
||||
using namespace std;
|
||||
|
||||
//static members from ConvertChar
|
||||
uint8_t ConvertChar::conversionTable[255];
|
||||
//Global function pointers in utils.h
|
||||
float (*g_compute_full_prob_float)(testcase *tc, float* before_last_log) = 0;
|
||||
double (*g_compute_full_prob_double)(testcase *tc, double* before_last_log) = 0;
|
||||
//Static members in ContextBase
|
||||
template<>
|
||||
bool ContextBase<double>::staticMembersInitializedFlag = false;
|
||||
template<>
|
||||
double ContextBase<double>::jacobianLogTable[JACOBIAN_LOG_TABLE_SIZE] = { };
|
||||
template<>
|
||||
double ContextBase<double>::matchToMatchProb[((MAX_QUAL + 1) * (MAX_QUAL + 2)) >> 1] = { };
|
||||
template<>
|
||||
bool ContextBase<float>::staticMembersInitializedFlag = false;
|
||||
template<>
|
||||
float ContextBase<float>::jacobianLogTable[JACOBIAN_LOG_TABLE_SIZE] = { };
|
||||
template<>
|
||||
float ContextBase<float>::matchToMatchProb[((MAX_QUAL + 1) * (MAX_QUAL + 2)) >> 1] = { };
|
||||
|
||||
|
||||
bool search_file_for_string(string filename, string search_string)
|
||||
{
|
||||
ifstream fptr;
|
||||
fptr.open(filename.c_str(),ios::in);
|
||||
if(fptr.is_open())
|
||||
{
|
||||
string buffer;
|
||||
buffer.clear();
|
||||
buffer.resize(4096);
|
||||
bool retvalue = false;
|
||||
while(!fptr.eof())
|
||||
{
|
||||
fptr.getline(&(buffer[0]), 4096);
|
||||
if(buffer.find(search_string) != string::npos) //found string
|
||||
{
|
||||
retvalue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
buffer.clear();
|
||||
fptr.close();
|
||||
return retvalue;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_cpuid_ecx_bit_set(int eax, int bitidx)
|
||||
{
|
||||
int ecx = 0, edx = 0, ebx = 0;
|
||||
__asm__ ("cpuid"
|
||||
:"=b" (ebx),
|
||||
"=c" (ecx),
|
||||
"=d" (edx)
|
||||
:"a" (eax)
|
||||
);
|
||||
return (((ecx >> bitidx)&1) == 1);
|
||||
}
|
||||
|
||||
bool is_avx_supported()
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
bool use_avx = _may_i_use_cpu_feature(_FEATURE_AVX);
|
||||
if(use_avx)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
//check if core supports AVX, but kernel does not and print info message
|
||||
if(!is_cpuid_ecx_bit_set(1, 28)) //core does not support AVX
|
||||
return false;
|
||||
//else fall through to end of function
|
||||
}
|
||||
#else
|
||||
if(!__builtin_cpu_supports("avx")) //core does not support AVX
|
||||
return false;
|
||||
else
|
||||
{
|
||||
//core supports AVX, check if kernel supports
|
||||
if(search_file_for_string("/proc/cpuinfo","avx"))
|
||||
return true;
|
||||
//else fall through to end of function
|
||||
|
||||
}
|
||||
#endif //__INTEL_COMPILER
|
||||
clog << "INFO: Your CPU supports AVX vector instructions, but your kernel does not. Try upgrading to a kernel that supports AVX.\n";
|
||||
clog << "INFO: Your program will run correctly, but slower than the AVX version\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_sse41_supported()
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
return (_may_i_use_cpu_feature(_FEATURE_SSE4_1) > 0);
|
||||
#else
|
||||
return __builtin_cpu_supports("sse4.1");
|
||||
#endif
|
||||
//return is_cpuid_ecx_bit_set(1, 19);
|
||||
}
|
||||
|
||||
bool is_sse42_supported()
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
return (_may_i_use_cpu_feature(_FEATURE_SSE4_2) > 0);
|
||||
#else
|
||||
return __builtin_cpu_supports("sse4.2");
|
||||
#endif
|
||||
//return is_cpuid_ecx_bit_set(1, 20);
|
||||
}
|
||||
|
||||
uint64_t get_machine_capabilities()
|
||||
{
|
||||
uint64_t machine_mask = 0ull;
|
||||
if(is_avx_supported())
|
||||
machine_mask |= (1 << AVX_CUSTOM_IDX);
|
||||
if(is_sse42_supported())
|
||||
machine_mask |= (1 << SSE42_CUSTOM_IDX);
|
||||
if(is_sse41_supported())
|
||||
machine_mask |= (1 << SSE41_CUSTOM_IDX);
|
||||
return machine_mask;
|
||||
}
|
||||
|
||||
void initialize_function_pointers(uint64_t mask)
|
||||
{
|
||||
//mask = 0ull;
|
||||
//mask = (1 << SSE41_CUSTOM_IDX);
|
||||
if(is_avx_supported() && (mask & (1<< AVX_CUSTOM_IDX)))
|
||||
{
|
||||
cerr << "Using AVX accelerated implementation of PairHMM\n";
|
||||
g_compute_full_prob_float = compute_full_prob_avxs<float>;
|
||||
g_compute_full_prob_double = compute_full_prob_avxd<double>;
|
||||
}
|
||||
else
|
||||
if(is_sse41_supported() && (mask & ((1<< SSE41_CUSTOM_IDX) | (1<<SSE42_CUSTOM_IDX))))
|
||||
{
|
||||
cerr << "Using SSE4.1 accelerated implementation of PairHMM\n";
|
||||
g_compute_full_prob_float = compute_full_prob_sses<float>;
|
||||
g_compute_full_prob_double = compute_full_prob_ssed<double>;
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "Using un-vectorized C++ implementation of PairHMM\n";
|
||||
g_compute_full_prob_float = compute_full_prob<float>;
|
||||
g_compute_full_prob_double = compute_full_prob<double>;
|
||||
}
|
||||
}
|
||||
|
||||
int normalize(char c)
|
||||
{
|
||||
return ((int) (c - 33));
|
||||
}
|
||||
|
||||
int read_testcase(testcase *tc, FILE* ifp)
|
||||
{
|
||||
char *q, *i, *d, *c, *line = NULL;
|
||||
int _q, _i, _d, _c;
|
||||
int x, size = 0;
|
||||
ssize_t read;
|
||||
|
||||
|
||||
read = getline(&line, (size_t *) &size, ifp == 0 ? stdin : ifp);
|
||||
if (read == -1)
|
||||
{
|
||||
free(line);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
tc->hap = (char *) malloc(size);
|
||||
tc->rs = (char *) malloc(size);
|
||||
q = (char *) malloc(size);
|
||||
i = (char *) malloc(size);
|
||||
d = (char *) malloc(size);
|
||||
c = (char *) malloc(size);
|
||||
|
||||
if (sscanf(line, "%s %s %s %s %s %s\n", tc->hap, tc->rs, q, i, d, c) != 6)
|
||||
return -1;
|
||||
|
||||
|
||||
tc->haplen = strlen(tc->hap);
|
||||
tc->rslen = strlen(tc->rs);
|
||||
assert(strlen(q) == (size_t)tc->rslen);
|
||||
assert(strlen(i) == (size_t)tc->rslen);
|
||||
assert(strlen(d) == (size_t)tc->rslen);
|
||||
assert(strlen(c) == (size_t)tc->rslen);
|
||||
|
||||
g_load_time_initializer.update_stat(READ_LENGTH_IDX, tc->rslen);
|
||||
g_load_time_initializer.update_stat(HAPLOTYPE_LENGTH_IDX, tc->haplen);
|
||||
g_load_time_initializer.update_stat(PRODUCT_READ_LENGTH_HAPLOTYPE_LENGTH_IDX, tc->haplen*tc->rslen);
|
||||
//assert(tc->rslen < MROWS);
|
||||
//tc->ihap = (int *) malloc(tc->haplen*sizeof(int));
|
||||
//tc->irs = (int *) malloc(tc->rslen*sizeof(int));
|
||||
|
||||
tc->q = (char *) malloc(sizeof(char) * tc->rslen);
|
||||
tc->i = (char *) malloc(sizeof(char) * tc->rslen);
|
||||
tc->d = (char *) malloc(sizeof(char) * tc->rslen);
|
||||
tc->c = (char *) malloc(sizeof(char) * tc->rslen);
|
||||
|
||||
for (x = 0; x < tc->rslen; x++)
|
||||
{
|
||||
_q = normalize(q[x]);
|
||||
_i = normalize(i[x]);
|
||||
_d = normalize(d[x]);
|
||||
_c = normalize(c[x]);
|
||||
tc->q[x] = (_q < 6) ? 6 : _q;
|
||||
//tc->q[x] = _q;
|
||||
tc->i[x] = _i;
|
||||
tc->d[x] = _d;
|
||||
tc->c[x] = _c;
|
||||
//tc->irs[x] = tc->rs[x];
|
||||
}
|
||||
//for (x = 0; x < tc->haplen; x++)
|
||||
//tc->ihap[x] = tc->hap[x];
|
||||
|
||||
free(q);
|
||||
free(i);
|
||||
free(d);
|
||||
free(c);
|
||||
free(line);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned MAX_LINE_LENGTH = 65536;
|
||||
int convToInt(std::string s)
|
||||
{
|
||||
int i;
|
||||
std::istringstream strin(s);
|
||||
strin >> i;
|
||||
return i;
|
||||
}
|
||||
|
||||
void tokenize(std::ifstream& fptr, std::vector<std::string>& tokens)
|
||||
{
|
||||
int i = 0;
|
||||
std::string tmp;
|
||||
std::vector<std::string> myVec;
|
||||
vector<char> line;
|
||||
line.clear();
|
||||
line.resize(MAX_LINE_LENGTH);
|
||||
vector<char> tmpline;
|
||||
tmpline.clear();
|
||||
tmpline.resize(MAX_LINE_LENGTH);
|
||||
myVec.clear();
|
||||
|
||||
while(!fptr.eof())
|
||||
{
|
||||
i = 0;
|
||||
bool still_read_line = true;
|
||||
unsigned line_position = 0;
|
||||
while(still_read_line)
|
||||
{
|
||||
fptr.getline(&(tmpline[0]), MAX_LINE_LENGTH);
|
||||
if(line_position + MAX_LINE_LENGTH > line.size())
|
||||
line.resize(2*line.size());
|
||||
for(unsigned i=0;i<MAX_LINE_LENGTH && tmpline[i] != '\0';++i,++line_position)
|
||||
line[line_position] = tmpline[i];
|
||||
if(fptr.eof() || !fptr.fail())
|
||||
{
|
||||
still_read_line = false;
|
||||
line[line_position++] = '\0';
|
||||
}
|
||||
}
|
||||
std::istringstream kap(&(line[0]));
|
||||
|
||||
while(!kap.eof())
|
||||
{
|
||||
kap >> std::skipws >> tmp;
|
||||
if(tmp != "")
|
||||
{
|
||||
myVec.push_back(tmp);
|
||||
++i;
|
||||
//std::cerr <<tmp <<"#";
|
||||
}
|
||||
tmp = "";
|
||||
}
|
||||
//std::cerr << "\n";
|
||||
if(myVec.size() > 0)
|
||||
break;
|
||||
}
|
||||
tokens.clear();
|
||||
//std::cerr << "Why "<<myVec.size()<<"\n";
|
||||
tokens.resize(myVec.size());
|
||||
for(i=0;i<(int)myVec.size();++i)
|
||||
tokens[i] = myVec[i];
|
||||
line.clear();
|
||||
tmpline.clear();
|
||||
}
|
||||
|
||||
int read_mod_testcase(ifstream& fptr, testcase* tc, bool reformat)
|
||||
{
|
||||
static bool first_call = true;
|
||||
vector<string> tokens;
|
||||
tokens.clear();
|
||||
tokenize(fptr, tokens);
|
||||
if(tokens.size() == 0)
|
||||
return -1;
|
||||
tc->hap = new char[tokens[0].size()+2];
|
||||
tc->haplen = tokens[0].size();
|
||||
memcpy(tc->hap, tokens[0].c_str(), tokens[0].size());
|
||||
tc->rs = new char[tokens[1].size()+2];
|
||||
tc->rslen = tokens[1].size();
|
||||
tc->q = new char[tc->rslen];
|
||||
tc->i = new char[tc->rslen];
|
||||
tc->d = new char[tc->rslen];
|
||||
tc->c = new char[tc->rslen];
|
||||
//cerr << "Lengths "<<tc->haplen <<" "<<tc->rslen<<"\n";
|
||||
memcpy(tc->rs, tokens[1].c_str(),tokens[1].size());
|
||||
assert(tokens.size() == (size_t)(2 + 4*(tc->rslen)));
|
||||
//assert(tc->rslen < MROWS);
|
||||
for(int j=0;j<tc->rslen;++j)
|
||||
tc->q[j] = (char)convToInt(tokens[2+0*tc->rslen+j]);
|
||||
for(int j=0;j<tc->rslen;++j)
|
||||
tc->i[j] = (char)convToInt(tokens[2+1*tc->rslen+j]);
|
||||
for(int j=0;j<tc->rslen;++j)
|
||||
tc->d[j] = (char)convToInt(tokens[2+2*tc->rslen+j]);
|
||||
for(int j=0;j<tc->rslen;++j)
|
||||
tc->c[j] = (char)convToInt(tokens[2+3*tc->rslen+j]);
|
||||
|
||||
if(reformat)
|
||||
{
|
||||
ofstream ofptr;
|
||||
ofptr.open("reformat/debug_dump.txt",first_call ? ios::out : ios::app);
|
||||
assert(ofptr.is_open());
|
||||
ofptr << tokens[0] << " ";
|
||||
ofptr << tokens[1] << " ";
|
||||
for(int j=0;j<tc->rslen;++j)
|
||||
ofptr << ((char)(tc->q[j]+33));
|
||||
ofptr << " ";
|
||||
for(int j=0;j<tc->rslen;++j)
|
||||
ofptr << ((char)(tc->i[j]+33));
|
||||
ofptr << " ";
|
||||
for(int j=0;j<tc->rslen;++j)
|
||||
ofptr << ((char)(tc->d[j]+33));
|
||||
ofptr << " ";
|
||||
for(int j=0;j<tc->rslen;++j)
|
||||
ofptr << ((char)(tc->c[j]+33));
|
||||
ofptr << " 0 false\n";
|
||||
|
||||
ofptr.close();
|
||||
first_call = false;
|
||||
}
|
||||
|
||||
|
||||
return tokens.size();
|
||||
}
|
||||
|
||||
double getCurrClk() {
|
||||
struct timeval tv ;
|
||||
gettimeofday(&tv, NULL);
|
||||
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
|
||||
}
|
||||
|
||||
inline unsigned long long rdtsc(void)
|
||||
{
|
||||
unsigned hi, lo;
|
||||
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
|
||||
return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 );
|
||||
}
|
||||
|
||||
void get_time(struct timespec* store_struct)
|
||||
{
|
||||
clock_gettime(CLOCK_REALTIME, store_struct);
|
||||
}
|
||||
|
||||
uint64_t diff_time(struct timespec& prev_time)
|
||||
{
|
||||
struct timespec curr_time;
|
||||
clock_gettime(CLOCK_REALTIME, &curr_time);
|
||||
return (uint64_t)((curr_time.tv_sec-prev_time.tv_sec)*1000000000+(curr_time.tv_nsec-prev_time.tv_nsec));
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_PAPI
|
||||
#include "papi.h"
|
||||
#define NUM_PAPI_COUNTERS 4
|
||||
#endif
|
||||
|
||||
void do_compute(char* filename, bool use_old_read_testcase, unsigned chunk_size, bool do_check)
|
||||
{
|
||||
FILE* fptr = 0;
|
||||
ifstream ifptr;
|
||||
if(use_old_read_testcase)
|
||||
{
|
||||
fptr = fopen(filename,"r");
|
||||
assert(fptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
ifptr.open(filename);
|
||||
assert(ifptr.is_open());
|
||||
}
|
||||
#ifdef PRINT_PER_INTERVAL_TIMINGS
|
||||
ofstream times_fptr;
|
||||
times_fptr.open("native_timed_intervals.csv",ios::out);
|
||||
#endif
|
||||
vector<testcase> tc_vector;
|
||||
tc_vector.clear();
|
||||
testcase tc;
|
||||
uint64_t vector_compute_time = 0;
|
||||
uint64_t baseline_compute_time = 0;
|
||||
uint64_t num_double_calls = 0;
|
||||
unsigned num_testcases = 0;
|
||||
bool all_ok = do_check ? true : false;
|
||||
#ifdef USE_PAPI
|
||||
uint32_t all_mask = (0);
|
||||
uint32_t no_usr_mask = (1 << 16); //bit 16 user mode, bit 17 kernel mode
|
||||
uint32_t no_kernel_mask = (1 << 17); //bit 16 user mode, bit 17 kernel mode
|
||||
PAPI_num_counters();
|
||||
int events[NUM_PAPI_COUNTERS] = { 0, 0, 0, 0 };
|
||||
char* eventnames[NUM_PAPI_COUNTERS]= { "cycles", "l1_pending_miss", "lfb_hit", "l2_hit" };
|
||||
assert(PAPI_event_name_to_code("UNHALTED_REFERENCE_CYCLES:u=1:k=1",&(events[0])) == PAPI_OK);
|
||||
assert(PAPI_event_name_to_code("L1D_PEND_MISS:OCCURRENCES", &(events[1])) == PAPI_OK);
|
||||
assert(PAPI_event_name_to_code("MEM_LOAD_UOPS_RETIRED:HIT_LFB", &(events[2])) == PAPI_OK);
|
||||
assert(PAPI_event_name_to_code("MEM_LOAD_UOPS_RETIRED:L2_HIT", &(events[3])) == PAPI_OK);
|
||||
long long values[NUM_PAPI_COUNTERS] = { 0, 0, 0, 0 };
|
||||
long long accum_values[NUM_PAPI_COUNTERS] = { 0, 0, 0, 0 };
|
||||
#endif
|
||||
while(1)
|
||||
{
|
||||
int break_value = use_old_read_testcase ? read_testcase(&tc, fptr) : read_mod_testcase(ifptr,&tc,true);
|
||||
if(break_value >= 0)
|
||||
tc_vector.push_back(tc);
|
||||
if(tc_vector.size() == BATCH_SIZE || (break_value < 0 && tc_vector.size() > 0))
|
||||
{
|
||||
vector<double> results_vec;
|
||||
vector<double> baseline_results_vec;
|
||||
results_vec.clear();
|
||||
baseline_results_vec.clear();
|
||||
results_vec.resize(tc_vector.size());
|
||||
baseline_results_vec.resize(tc_vector.size());
|
||||
g_load_time_initializer.update_stat(NUM_TESTCASES_IDX, tc_vector.size());
|
||||
g_load_time_initializer.update_stat(NUM_READS_IDX, tc_vector.size());
|
||||
g_load_time_initializer.update_stat(NUM_HAPLOTYPES_IDX, tc_vector.size());
|
||||
struct timespec start_time;
|
||||
#ifdef USE_PAPI
|
||||
assert(PAPI_start_counters(events, NUM_PAPI_COUNTERS) == PAPI_OK);
|
||||
#endif
|
||||
get_time(&start_time);
|
||||
#pragma omp parallel for schedule(dynamic,chunk_size) num_threads(12)
|
||||
#ifdef DO_REPEAT_PROFILING
|
||||
for(unsigned z=0;z<10;++z)
|
||||
#endif
|
||||
{
|
||||
for(unsigned i=0;i<tc_vector.size();++i)
|
||||
{
|
||||
testcase& tc = tc_vector[i];
|
||||
float result_avxf = g_compute_full_prob_float(&tc, 0);
|
||||
double result = 0;
|
||||
if (result_avxf < MIN_ACCEPTED) {
|
||||
double result_avxd = g_compute_full_prob_double(&tc, 0);
|
||||
result = log10(result_avxd) - log10(ldexp(1.0, 1020.0));
|
||||
++num_double_calls;
|
||||
}
|
||||
else
|
||||
result = (double)(log10f(result_avxf) - log10f(ldexpf(1.f, 120.f)));
|
||||
#ifdef DUMP_COMPUTE_VALUES
|
||||
g_load_time_initializer.debug_dump("return_values_vector.txt",to_string(result),true);
|
||||
#endif
|
||||
results_vec[i] = result;
|
||||
}
|
||||
}
|
||||
#ifdef USE_PAPI
|
||||
assert(PAPI_stop_counters(values, NUM_PAPI_COUNTERS) == PAPI_OK);
|
||||
#endif
|
||||
uint64_t curr_interval = diff_time(start_time);
|
||||
#ifdef PRINT_PER_INTERVAL_TIMINGS
|
||||
times_fptr << curr_interval << "\n";
|
||||
#endif
|
||||
vector_compute_time += curr_interval;
|
||||
#ifdef USE_PAPI
|
||||
for(unsigned k=0;k<NUM_PAPI_COUNTERS;++k)
|
||||
accum_values[k] += values[k];
|
||||
#endif
|
||||
num_testcases += tc_vector.size();
|
||||
if(do_check)
|
||||
{
|
||||
get_time(&start_time);
|
||||
#pragma omp parallel for schedule(dynamic,chunk_size)
|
||||
for(unsigned i=0;i<tc_vector.size();++i)
|
||||
{
|
||||
testcase& tc = tc_vector[i];
|
||||
double baseline_result = compute_full_prob<double>(&tc);
|
||||
baseline_result = log10(baseline_result) - log10(ldexp(1.0, 1020.0));
|
||||
baseline_results_vec[i] = baseline_result;
|
||||
}
|
||||
baseline_compute_time += diff_time(start_time);
|
||||
for(unsigned i=0;i<tc_vector.size();++i)
|
||||
{
|
||||
double baseline_result = baseline_results_vec[i];
|
||||
double abs_error = fabs(baseline_result-results_vec[i]);
|
||||
double rel_error = (baseline_result != 0) ? fabs(abs_error/baseline_result) : 0;
|
||||
if(abs_error > 1e-5 && rel_error > 1e-5)
|
||||
{
|
||||
cerr << std::scientific << baseline_result << " "<<results_vec[i]<<"\n";
|
||||
all_ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(unsigned i=0;i<tc_vector.size();++i)
|
||||
{
|
||||
delete[] tc_vector[i].rs;
|
||||
delete[] tc_vector[i].hap;
|
||||
delete[] tc_vector[i].q;
|
||||
delete[] tc_vector[i].i;
|
||||
delete[] tc_vector[i].d;
|
||||
delete[] tc_vector[i].c;
|
||||
}
|
||||
results_vec.clear();
|
||||
tc_vector.clear();
|
||||
}
|
||||
if(break_value < 0)
|
||||
break;
|
||||
}
|
||||
#ifdef DUMP_COMPUTE_VALUES
|
||||
g_load_time_initializer.debug_close();
|
||||
#endif
|
||||
if(all_ok)
|
||||
{
|
||||
cerr << "All output values within acceptable error\n";
|
||||
cerr << "Baseline double precision compute time "<<baseline_compute_time*1e-9<<"\n";
|
||||
}
|
||||
cerr << "Num testcase "<<num_testcases<< " num double invocations "<<num_double_calls<<"\n";
|
||||
cerr << "Vector compute time "<< vector_compute_time*1e-9 << "\n";
|
||||
#ifdef USE_PAPI
|
||||
for(unsigned i=0;i<NUM_PAPI_COUNTERS;++i)
|
||||
cerr << eventnames[i] << " : "<<accum_values[i]<<"\n";
|
||||
#endif
|
||||
#ifdef PRINT_PER_INTERVAL_TIMINGS
|
||||
times_fptr.close();
|
||||
#endif
|
||||
if(use_old_read_testcase)
|
||||
fclose(fptr);
|
||||
else
|
||||
ifptr.close();
|
||||
g_load_time_initializer.print_profiling();
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/*Copyright (c) 2012 The Broad Institute
|
||||
|
||||
*Permission is hereby granted, free of charge, to any person
|
||||
*obtaining a copy of this software and associated documentation
|
||||
*files (the "Software"), to deal in the Software without
|
||||
*restriction, including without limitation the rights to use,
|
||||
*copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
*copies of the Software, and to permit persons to whom the
|
||||
*Software is furnished to do so, subject to the following
|
||||
*conditions:
|
||||
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
*OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
*HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
*WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
*FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
*THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PAIRHMM_UTIL_H
|
||||
#define PAIRHMM_UTIL_H
|
||||
|
||||
#include "common_data_structure.h"
|
||||
|
||||
template<class T>
|
||||
std::string to_string(T obj)
|
||||
{
|
||||
std::stringstream ss;
|
||||
std::string ret_string;
|
||||
ss.clear();
|
||||
ss << std::scientific << obj;
|
||||
ss >> ret_string;
|
||||
ss.clear();
|
||||
return ret_string;
|
||||
}
|
||||
void debug_dump(std::string filename, std::string s, bool to_append, bool add_newline=true);
|
||||
|
||||
int read_mod_testcase(std::ifstream& fptr, testcase* tc, bool reformat=false);
|
||||
|
||||
bool is_avx_supported();
|
||||
bool is_sse42_supported();
|
||||
extern float (*g_compute_full_prob_float)(testcase *tc, float *before_last_log);
|
||||
extern double (*g_compute_full_prob_double)(testcase *tc, double* before_last_log);
|
||||
void debug_dump(std::string filename, std::string s, bool to_append, bool add_newline);
|
||||
template<class NUMBER>
|
||||
NUMBER compute_full_prob(testcase *tc, NUMBER *before_last_log=0);
|
||||
template<class NUMBER>
|
||||
NUMBER compute_full_prob_avxd(testcase *tc, NUMBER *before_last_log=0);
|
||||
template<class NUMBER>
|
||||
NUMBER compute_full_prob_avxs(testcase *tc, NUMBER *before_last_log=0);
|
||||
template<class NUMBER>
|
||||
NUMBER compute_full_prob_ssed(testcase *tc, NUMBER *before_last_log=0);
|
||||
template<class NUMBER>
|
||||
NUMBER compute_full_prob_sses(testcase *tc, NUMBER *before_last_log=0);
|
||||
|
||||
double getCurrClk();
|
||||
void get_time(struct timespec* x);
|
||||
uint64_t diff_time(struct timespec& prev_time);
|
||||
|
||||
//bit 0 is sse4.2, bit 1 is AVX
|
||||
enum ProcessorCapabilitiesEnum
|
||||
{
|
||||
SSE41_CUSTOM_IDX=0,
|
||||
SSE42_CUSTOM_IDX,
|
||||
AVX_CUSTOM_IDX
|
||||
};
|
||||
#define ENABLE_ALL_HARDWARE_FEATURES 0xFFFFFFFFFFFFFFFFull
|
||||
uint64_t get_machine_capabilities();
|
||||
void initialize_function_pointers(uint64_t mask=ENABLE_ALL_HARDWARE_FEATURES);
|
||||
void do_compute(char* filename, bool use_old_read_testcase=true, unsigned chunk_size=10000, bool do_check=true);
|
||||
|
||||
//#define DO_WARMUP
|
||||
//#define DO_REPEAT_PROFILING
|
||||
/*#define DUMP_COMPUTE_VALUES 1*/
|
||||
#define BATCH_SIZE 10000
|
||||
#define RUN_HYBRID
|
||||
/*#define PRINT_PER_INTERVAL_TIMINGS 1*/
|
||||
|
||||
#endif
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
<dependency>
|
||||
<groupId>com.intel.gkl</groupId>
|
||||
<artifactId>gkl</artifactId>
|
||||
<version>0.4.3</version>
|
||||
<version>0.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@
|
|||
<artifactId>commons-jexl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.intel.gkl</groupId>
|
||||
<artifactId>gkl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>gatk-utils</artifactId>
|
||||
|
|
|
|||
|
|
@ -62,39 +62,16 @@ public abstract class PairHMM {
|
|||
LOGLESS_CACHING,
|
||||
/* Optimized AVX implementation of LOGLESS_CACHING called through JNI */
|
||||
VECTOR_LOGLESS_CACHING,
|
||||
/* Optimized, multi-threaded AVX implementation of LOGLESS_CACHING called through JNI */
|
||||
VECTOR_LOGLESS_CACHING_OMP,
|
||||
/* Use fastest available implementation. OMP -> AVX -> LOGLESS_CACHING */
|
||||
FASTEST_AVAILABLE,
|
||||
/* Debugging for vector implementation of LOGLESS_CACHING */
|
||||
DEBUG_VECTOR_LOGLESS_CACHING,
|
||||
/* Logless caching PairHMM that stores computations in 1D arrays instead of matrices, and which proceeds diagonally over the (read x haplotype) intersection matrix */
|
||||
ARRAY_LOGLESS
|
||||
}
|
||||
|
||||
/* Instruction sets for computing VectorLoglessHMM */
|
||||
public enum HMM_SUB_IMPLEMENTATION {
|
||||
/* standard un-vectorized instructions */
|
||||
UNVECTORIZED(0x0L, false),
|
||||
/* Streaming SIMD Extensions (SSE), version 4.1 */
|
||||
SSE41(0x1L, true),
|
||||
/* Streaming SIMD Extensions (SSE), version 4.2 */
|
||||
SSE42(0x2L, true),
|
||||
/* Advanced Vector Extensions (AVX) */
|
||||
AVX(0x4L, true),
|
||||
/* For testing only, set bit beyond hardware capabilities */
|
||||
TEST_BEYOND_CAPABILITIES(0x400L, true),
|
||||
/* Enable all implementations */
|
||||
ENABLE_ALL(0xFFFFFFFFFFFFFFFFl, false);
|
||||
|
||||
/* Masks for machine capabilities */
|
||||
private final long mask;
|
||||
/* Is a specific hardware instruction set requested? */
|
||||
private final boolean isSpecificHardwareRequest;
|
||||
HMM_SUB_IMPLEMENTATION(long mask, boolean isSpecificHardwareRequest) {
|
||||
this.mask = mask;
|
||||
this.isSpecificHardwareRequest = isSpecificHardwareRequest;
|
||||
}
|
||||
long getMask() { return mask; }
|
||||
boolean getIsSpecificHardwareRequest() { return isSpecificHardwareRequest; }
|
||||
}
|
||||
|
||||
protected int maxHaplotypeLength, maxReadLength;
|
||||
protected int paddedMaxReadLength, paddedMaxHaplotypeLength;
|
||||
protected int paddedReadLength, paddedHaplotypeLength;
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue