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,15 +104,17 @@ 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();
//Load the library and initialize the FieldIDs synchronized(isVectorLoglessPairHMMLibraryLoaded) {
if(!isVectorLoglessPairHMMLibraryLoaded) { //Load the library and initialize the FieldIDs
System.loadLibrary("VectorLoglessPairHMM"); if(!isVectorLoglessPairHMMLibraryLoaded) {
isVectorLoglessPairHMMLibraryLoaded = true; System.loadLibrary("VectorLoglessPairHMM");
jniInitializeClassFieldsAndMachineMask(JNIReadDataHolderClass.class, JNIHaplotypeDataHolderClass.class, enableAll); //need to do this only once isVectorLoglessPairHMMLibraryLoaded = true;
jniInitializeClassFieldsAndMachineMask(JNIReadDataHolderClass.class, JNIHaplotypeDataHolderClass.class, enableAll); //need to do this only once
}
} }
} }

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