1. Added synchronization block around loadLibrary in

VectorLoglessPairHMM
2. Edited Makefile to use static libraries where possible
This commit is contained in:
Karthik Gururaj 2014-01-27 15:34:58 -08:00
parent a15137a667
commit 0c63d6264f
2 changed files with 9 additions and 7 deletions

View File

@ -104,10 +104,11 @@ public class VectorLoglessPairHMM extends JNILoglessPairHMM {
* */ * */
private native void jniInitializeClassFieldsAndMachineMask(Class<?> readDataHolderClass, Class<?> haplotypeDataHolderClass, long mask); private native void jniInitializeClassFieldsAndMachineMask(Class<?> readDataHolderClass, Class<?> haplotypeDataHolderClass, long mask);
private static boolean isVectorLoglessPairHMMLibraryLoaded = false; private static Boolean isVectorLoglessPairHMMLibraryLoaded = false;
//The constructor is called only once inside PairHMMLikelihoodCalculationEngine //The constructor is called only once inside PairHMMLikelihoodCalculationEngine
public VectorLoglessPairHMM() { public VectorLoglessPairHMM() {
super(); super();
synchronized(isVectorLoglessPairHMMLibraryLoaded) {
//Load the library and initialize the FieldIDs //Load the library and initialize the FieldIDs
if(!isVectorLoglessPairHMMLibraryLoaded) { if(!isVectorLoglessPairHMMLibraryLoaded) {
System.loadLibrary("VectorLoglessPairHMM"); System.loadLibrary("VectorLoglessPairHMM");
@ -115,6 +116,7 @@ public class VectorLoglessPairHMM extends JNILoglessPairHMM {
jniInitializeClassFieldsAndMachineMask(JNIReadDataHolderClass.class, JNIHaplotypeDataHolderClass.class, enableAll); //need to do this only once jniInitializeClassFieldsAndMachineMask(JNIReadDataHolderClass.class, JNIHaplotypeDataHolderClass.class, enableAll); //need to do this only once
} }
} }
}
private native void jniInitializeHaplotypes(final int numHaplotypes, JNIHaplotypeDataHolderClass[] haplotypeDataArray); private native void jniInitializeHaplotypes(final int numHaplotypes, JNIHaplotypeDataHolderClass[] haplotypeDataArray);
//Hold the mapping between haplotype and index in the list of Haplotypes passed to initialize //Hold the mapping between haplotype and index in the list of Haplotypes passed to initialize

View File

@ -54,7 +54,7 @@ pairhmm-template-main: pairhmm-template-main.o $(COMMON_OBJECTS)
$(CXX) $(OMPLFLAGS) -o $@ $^ $(LDFLAGS) $(CXX) $(OMPLFLAGS) -o $@ $^ $(LDFLAGS)
libVectorLoglessPairHMM.so: $(LIBOBJECTS) libVectorLoglessPairHMM.so: $(LIBOBJECTS)
$(CXX) $(OMPLFLAGS) -shared -o $@ $(LIBOBJECTS) ${LDFLAGS} $(CXX) $(OMPLFLAGS) -shared -o $@ $(LIBOBJECTS) ${LDFLAGS} -Wl,-Bstatic -limf -lsvml -lirng -Wl,-Bdynamic #-lintlc
$(OBJECTS): %.o: %.cc $(OBJECTS): %.o: %.cc