From 0d5627c2f146fd3d4a515dbc3223f7ccc5931d7d Mon Sep 17 00:00:00 2001 From: Karthik Gururaj Date: Wed, 26 Feb 2014 10:53:51 -0800 Subject: [PATCH] Followed Khalid's suggestion for packing libVectorLoglessCaching into the jar file with Maven --- .gitignore | 36 ++++ ...GraphBasedLikelihoodCalculationEngine.java | 4 + .../haplotypecaller/HaplotypeCaller.java | 2 +- .../PairHMMLikelihoodCalculationEngine.java | 3 +- .../RandomLikelihoodCalculationEngine.java | 5 + .../utils/pairhmm/DebugJNILoglessPairHMM.java | 4 +- .../utils/pairhmm/JNILoglessPairHMM.java | 0 .../utils/pairhmm/VectorLoglessPairHMM.java | 2 - public/c++/VectorPairHMM/Makefile | 8 +- ...ting_utils_pairhmm_VectorLoglessPairHMM.cc | 2 - public/c++/VectorPairHMM/run.sh | 3 +- public/c++/VectorPairHMM/utils.cc | 7 +- public/c++/VectorPairHMM/utils.h | 7 + public/c++/pom.xml | 167 ++++++++++++++++++ public/sting-root/pom.xml | 6 +- 15 files changed, 240 insertions(+), 16 deletions(-) rename protected/{java/src => gatk-protected/src/main/java}/org/broadinstitute/sting/utils/pairhmm/DebugJNILoglessPairHMM.java (99%) rename protected/{java/src => gatk-protected/src/main/java}/org/broadinstitute/sting/utils/pairhmm/JNILoglessPairHMM.java (100%) rename protected/{java/src => gatk-protected/src/main/java}/org/broadinstitute/sting/utils/pairhmm/VectorLoglessPairHMM.java (99%) create mode 100644 public/c++/pom.xml diff --git a/.gitignore b/.gitignore index a2ff166e5..3ecbc1485 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /*.bed *~ /*.vcf +/*.vcf.idx /*.txt /*.csh /.* @@ -40,3 +41,38 @@ perf verify maven-metadata-local.xml dependency-reduced-pom.xml +private/gatk-private/private/ +private/gatk-private/public/ +private/gatk-private/target/ +private/na12878kb-utils/public/ +private/na12878kb-utils/target/ +private/queue-private/private/ +private/queue-private/public/ +private/queue-private/target/ +private/scala/ +private/testdata +protected/gatk-protected/private/ +protected/gatk-protected/public/ +protected/gatk-protected/target/ +public/external-example/target/ +public/gatk-framework/private/ +public/gatk-framework/public/ +public/gatk-framework/target/ +public/gatk-package/private/ +public/gatk-package/public/ +public/gatk-package/target/ +public/gatk-queue-extgen/public/ +public/gatk-queue-extgen/target/ +public/gsalib/public/ +public/gsalib/target/ +public/queue-framework/private/ +public/queue-framework/public/ +public/queue-framework/target/ +public/queue-package/private/ +public/queue-package/public/ +public/queue-package/target/ +public/scala/ +public/sting-utils/public/ +public/sting-utils/target/ +public/testdata +target/ diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GraphBasedLikelihoodCalculationEngine.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GraphBasedLikelihoodCalculationEngine.java index 8a35ccb05..8b37e265d 100644 --- a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GraphBasedLikelihoodCalculationEngine.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GraphBasedLikelihoodCalculationEngine.java @@ -155,4 +155,8 @@ public class GraphBasedLikelihoodCalculationEngine implements LikelihoodCalculat } } } + + @Override + public void close() { + } } diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java index 276103277..7844741df 100644 --- a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java @@ -1043,7 +1043,7 @@ public class HaplotypeCaller extends ActiveRegionWalker, In referenceConfidenceModel.close(); //TODO remove the need to call close here for debugging, the likelihood output stream should be managed //TODO (open & close) at the walker, not the engine. - likelihoodCalculationEngine.close(); + likelihoodCalculationEngine.close(); logger.info("Ran local assembly on " + result + " active regions"); } diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/PairHMMLikelihoodCalculationEngine.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/PairHMMLikelihoodCalculationEngine.java index c534764a5..344366869 100644 --- a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/PairHMMLikelihoodCalculationEngine.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/PairHMMLikelihoodCalculationEngine.java @@ -170,9 +170,10 @@ public class PairHMMLikelihoodCalculationEngine implements LikelihoodCalculation @Override public void close() { if ( likelihoodsStream != null ) likelihoodsStream.close(); - pairHMMThreadLocal.get().close(); + pairHMMThreadLocal.get().close(); } + private void writeDebugLikelihoods(final GATKSAMRecord processedRead, final Haplotype haplotype, final double log10l){ if ( WRITE_LIKELIHOODS_TO_FILE ) { likelihoodsStream.printf("%s %s %s %s %s %s %f%n", diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/RandomLikelihoodCalculationEngine.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/RandomLikelihoodCalculationEngine.java index b8dba7b86..d5d424ca9 100644 --- a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/RandomLikelihoodCalculationEngine.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/RandomLikelihoodCalculationEngine.java @@ -79,4 +79,9 @@ public class RandomLikelihoodCalculationEngine implements LikelihoodCalculationE return result; } + + @Override + public void close() { + } + } diff --git a/protected/java/src/org/broadinstitute/sting/utils/pairhmm/DebugJNILoglessPairHMM.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/utils/pairhmm/DebugJNILoglessPairHMM.java similarity index 99% rename from protected/java/src/org/broadinstitute/sting/utils/pairhmm/DebugJNILoglessPairHMM.java rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/utils/pairhmm/DebugJNILoglessPairHMM.java index dc0ee23f7..beaca115a 100644 --- a/protected/java/src/org/broadinstitute/sting/utils/pairhmm/DebugJNILoglessPairHMM.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/utils/pairhmm/DebugJNILoglessPairHMM.java @@ -55,7 +55,7 @@ import org.broadinstitute.sting.utils.haplotype.Haplotype; import org.broadinstitute.sting.utils.sam.GATKSAMRecord; import org.broadinstitute.variant.variantcontext.Allele; import org.broadinstitute.sting.utils.exceptions.UserException; - +import static org.broadinstitute.sting.utils.pairhmm.PairHMMModel.*; import java.util.List; import java.util.Map; @@ -258,7 +258,7 @@ public class DebugJNILoglessPairHMM extends LoglessPairHMM { relative_error = 0; else relative_error = Math.abs(abs_error/mLikelihoodArray[i]); - if(abs_error > 1e-6 && relative_error > 1e-6) + if(abs_error > 1e-5 && relative_error > 1e-5) { toDump = true; break; diff --git a/protected/java/src/org/broadinstitute/sting/utils/pairhmm/JNILoglessPairHMM.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/utils/pairhmm/JNILoglessPairHMM.java similarity index 100% rename from protected/java/src/org/broadinstitute/sting/utils/pairhmm/JNILoglessPairHMM.java rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/utils/pairhmm/JNILoglessPairHMM.java diff --git a/protected/java/src/org/broadinstitute/sting/utils/pairhmm/VectorLoglessPairHMM.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/utils/pairhmm/VectorLoglessPairHMM.java similarity index 99% rename from protected/java/src/org/broadinstitute/sting/utils/pairhmm/VectorLoglessPairHMM.java rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/utils/pairhmm/VectorLoglessPairHMM.java index 29d3a729d..50600d850 100644 --- a/protected/java/src/org/broadinstitute/sting/utils/pairhmm/VectorLoglessPairHMM.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/utils/pairhmm/VectorLoglessPairHMM.java @@ -67,8 +67,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; - - /** * Created with IntelliJ IDEA. * User: rpoplin, carneiro diff --git a/public/c++/VectorPairHMM/Makefile b/public/c++/VectorPairHMM/Makefile index 269cecbd2..f88b38401 100644 --- a/public/c++/VectorPairHMM/Makefile +++ b/public/c++/VectorPairHMM/Makefile @@ -58,7 +58,7 @@ $(AVX_OBJECTS): CXXFLAGS=$(COMMON_COMPILATION_FLAGS) -xAVX $(SSE_OBJECTS): CXXFLAGS=$(COMMON_COMPILATION_FLAGS) -xSSE4.2 OBJECTS=$(NO_VECTOR_OBJECTS) $(AVX_OBJECTS) $(SSE_OBJECTS) -all: $(BIN) Sandbox.class +all: $(BIN) Sandbox.class copied_lib -include $(addprefix $(DEPDIR)/,$(SOURCES:.cc=.d)) @@ -79,5 +79,11 @@ $(OBJECTS): %.o: %.cc 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 diff --git a/public/c++/VectorPairHMM/org_broadinstitute_sting_utils_pairhmm_VectorLoglessPairHMM.cc b/public/c++/VectorPairHMM/org_broadinstitute_sting_utils_pairhmm_VectorLoglessPairHMM.cc index 2d8dbaf3d..cd1656e7c 100644 --- a/public/c++/VectorPairHMM/org_broadinstitute_sting_utils_pairhmm_VectorLoglessPairHMM.cc +++ b/public/c++/VectorPairHMM/org_broadinstitute_sting_utils_pairhmm_VectorLoglessPairHMM.cc @@ -191,8 +191,6 @@ inline JNIEXPORT void JNICALL Java_org_broadinstitute_sting_utils_pairhmm_Vector } } -//#define DO_WARMUP -//#define DO_REPEAT_PROFILING //Do compute over vector of testcase structs inline void compute_testcases(vector& tc_array, unsigned numTestCases, double* likelihoodDoubleArray, unsigned maxNumThreadsToUse) diff --git a/public/c++/VectorPairHMM/run.sh b/public/c++/VectorPairHMM/run.sh index a6930678b..b52dddc46 100755 --- a/public/c++/VectorPairHMM/run.sh +++ b/public/c++/VectorPairHMM/run.sh @@ -8,7 +8,8 @@ then fi #-Djava.library.path is needed if you are using JNI_LOGLESS_CACHING, else not needed -java -Djava.library.path=${GSA_ROOT_DIR}/public/c++/VectorPairHMM -jar $GSA_ROOT_DIR/dist/GenomeAnalysisTK.jar -T HaplotypeCaller \ +#java -Djava.library.path=${GSA_ROOT_DIR}/public/c++/VectorPairHMM -jar $GSA_ROOT_DIR/target/GenomeAnalysisTK.jar -T HaplotypeCaller \ +java -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 \ diff --git a/public/c++/VectorPairHMM/utils.cc b/public/c++/VectorPairHMM/utils.cc index 832335d88..387a6b4a0 100644 --- a/public/c++/VectorPairHMM/utils.cc +++ b/public/c++/VectorPairHMM/utils.cc @@ -306,15 +306,12 @@ uint64_t diff_time(struct timespec& prev_time) return (uint64_t)((curr_time.tv_sec-prev_time.tv_sec)*1000000000+(curr_time.tv_nsec-prev_time.tv_nsec)); } -#define DUMP_COMPUTE_VALUES 1 -//#define DO_REPEATS + #ifdef USE_PAPI #include "papi.h" #define NUM_PAPI_COUNTERS 4 #endif -#define BATCH_SIZE 10000 -#define RUN_HYBRID void do_compute(char* filename, bool use_old_read_testcase, unsigned chunk_size, bool do_check) { FILE* fptr = 0; @@ -370,7 +367,7 @@ void do_compute(char* filename, bool use_old_read_testcase, unsigned chunk_size, #endif get_time(&start_time); #pragma omp parallel for schedule(dynamic,chunk_size) num_threads(12) -#ifdef DO_REPEATS +#ifdef DO_REPEAT_PROFILING for(unsigned z=0;z<10;++z) #endif { diff --git a/public/c++/VectorPairHMM/utils.h b/public/c++/VectorPairHMM/utils.h index 98115e283..c1288d9e5 100644 --- a/public/c++/VectorPairHMM/utils.h +++ b/public/c++/VectorPairHMM/utils.h @@ -40,4 +40,11 @@ enum ProcessorCapabilitiesEnum 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 + #endif diff --git a/public/c++/pom.xml b/public/c++/pom.xml new file mode 100644 index 000000000..c64f81ede --- /dev/null +++ b/public/c++/pom.xml @@ -0,0 +1,167 @@ + + + 4.0.0 + + + org.broadinstitute.sting + sting-root + 2.8-SNAPSHOT + ../../public/sting-root + + + pairhmm-native + pom + PairHMM Native Libraries + + Builds a platform dependent version of pairhmm. During install, copies it into sting-utils. + + + UTF-8 + ${sourceEncoding} + ${sourceEncoding} + ${project.basedir}/../.. + ${sting.basedir}/public/sting-utils + + ${sting-utils.basedir}/src/main/resources/org/broadinstitute/sting/utils/pairhmm + + + + x86_64 + so + -Wall + -dynamiclib + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + + display-info + + validate + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + + exec + + compile + + make + VectorPairHMM + + ${pairhmm.build.architecture} + ${pairhmm.build.extension} + ${pairhmm.build.cxxflags} + ${pairhmm.build.ldflags} + ${project.build.directory} + + + + + + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + default-install + + copy-resources + + install + + ${pairhmm.resources.directory} + + + ${project.build.directory} + + **/* + + + + + + + + + + + com.google.code.sortpom + maven-sortpom-plugin + + false + custom_1 + \n + ${sourceEncoding} + true + scope + 4 + false + + + + + + + + + mac_x86_64 + + + mac + x86_64 + + + + mac_x86_64 + jnilib + -dynamiclib + + + + + linux_x86_64 + + + linux + amd64 + + + + linux_x86_64 + jnilib + -fPIC + -shared + + + + + diff --git a/public/sting-root/pom.xml b/public/sting-root/pom.xml index 84edd9be5..39227e4ba 100644 --- a/public/sting-root/pom.xml +++ b/public/sting-root/pom.xml @@ -332,7 +332,11 @@ maven-assembly-plugin 2.4 - + + org.apache.maven.plugins + maven-enforcer-plugin + 1.3.1 +