gatk-3.8/public/c++/VectorPairHMM/JNI_README

42 lines
2.4 KiB
Plaintext

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 a global init function in the library to determine fields ids for the
members of classes JNIReadDataHolder and JNIHaplotypeDataHolders.
2. When the library is loaded, it initializes two global function pointers to point to the
function implementation that is supported on the machine on which the program is being
run. The two pointers are for float and double respectively. This initialization is done
only once for the whole program.
3. initialize(): To initialized the region for PairHMM. Pass haplotype bases to native
code through the JNIHaplotypeDataHolders class. Since the haplotype list is common across
multiple samples in computeReadLikelihoods(), we can store 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.
Note: Debug code has been moved to a separate class DebugJNILoglessPairHMM.java.
On the C++ side, the primary 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.
Compiling:
Make sure you have icc (Intel C compiler) available. Currently, gcc does not seem to
support all AVX intrinsics.
Type 'make'. This should create a library called libVectorLoglessPairHMM.so
Running:
If libVectorLoglessPairHMM.so is compiled using icc, make sure that the Intel Composer XE
libraries are in your LD_LIBRARY_PATH :
source <COMPOSER_XE_DIR>/bin/compilervars.sh intel64
See run.sh in this directory on how to invoke HaplotypeCaller with the native library. The
argument -Djava.library.path is needed if the native implementation is selected, else
unnecessary.