Thursday, June 13, 2019

BEAST phylogeny - BEAGLE installation

Running a computational process on GPU is much faster than CPU. Just wanted to test this BEAST phylogeny tool. It was an amazing experience. GPU is way much faster. Just to get a glimpse of the GPU speed on 95 sample data each sequence  of 5 MB:


GPU is the winner!! But installation took time.

Here are the steps.

Follow the steps from :

https://github.com/beagle-dev/beagle-lib

If the beast -beagle info gives you only the message as below, then that means your cuda is not properly installed.

--- BEAGLE RESOURCES ---

0 : CPU


    Flags: PRECISION_SINGLE PRECISION_DOUBLE COMPUTATION_SYNCH EIGEN_REAL EIGEN_COMPLEX SCALING_MANUAL SCALING_AUTO SCALING_ALWAYS SCALERS_RAW SCALERS_LOG VECTOR_SSE VECTOR_NONE THREADING_NONE PROCESSOR_CPU FRAMEWORK_CPU

I use ubuntu. So, I followed this tut:
 https://github.com/beagle-dev/beagle-lib/wiki/LinuxInstallInstructions

For my purpose, I have installed cuda toolkit from here:
https://developer.nvidia.com/cuda-downloads

$ sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.168-418.67_1.0-1_amd64.deb
(Reading database ... 396141 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1804-10-1-local-10.1.168-418.67_1.0-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1804-10-1-local-10.1.168-418.67 (1.0-1) over (1.0-1) ...
Setting up cuda-repo-ubuntu1804-10-1-local-10.1.168-418.67 (1.0-1) ...



once the cuda is installed, we need to check if it is properly installed. Follow the instructions to check if it is properly installed.

https://xcat-docs.readthedocs.io/en/stable/advanced/gpu/nvidia/verify_cuda_install.html

If deviceQuery, bandwidthTest commands give similar result, then cuda is successfully installed.

Else if you receive an error like when you run  ./bin/x86_64/linux/release/deviceQuery
-> no CUDA-capable device is detected

That means either you need to switch the graphics cards or you need to select the appropriate driver. In my case, I had only one graphics card,

When I typed,

$  nvidia-smi -a
NVIDIA: API mismatch: the NVIDIA kernel module has version 295.59,
but this NVIDIA driver component has version 304.54.  Please make
sure that the kernel module and all NVIDIA driver components
have the same version.

You can check in the page, what graphics card you have and how to switch over (not my case).
For my case, I needed to select the appropriate driver since there is a mismatch.

so, I ran this command:

$ sudo ubuntu-drivers devices


So, I was recommended to use nvidia-driver-430 for my case, where as I was using driver-418.




So, I selected to driver-430, Apply changes and restart the system



$ ./bin/x86_64/linux/release/deviceQuery
./bin/x86_64/linux/release/deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "Quadro P2000"
  CUDA Driver Version / Runtime Version          10.1 / 10.1
  CUDA Capability Major/Minor version number:    6.1
.....


Result = PASS

$ ./bin/x86_64/linux/release/bandwidthTest
[CUDA Bandwidth Test] - Starting...
Running on...

 Device 0: Quadro P2000
 Quick Mode
.......
Result = PASS

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

It now works!!!!

Test beast with beagle now, you should see both CPU as well as GPU card in the resources list.

--- BEAGLE RESOURCES ---

0 : CPU
    Flags: PRECISION_SINGLE PRECISION_DOUBLE COMPUTATION_SYNCH EIGEN_REAL EIGEN_COMPLEX SCALING_MANUAL SCALING_AUTO SCALING_ALWAYS SCALERS_RAW SCALERS_LOG VECTOR_SSE VECTOR_NONE THREADING_NONE PROCESSOR_CPU FRAMEWORK_CPU

1 : Quadro P2000
    Global memory (MB): 5058
    Clock speed (Ghz): 1.48
    Number of cores: 1024
    Flags: PRECISION_SINGLE PRECISION_DOUBLE COMPUTATION_SYNCH COMPUTATION_ASYNCH EIGEN_REAL EIGEN_COMPLEX SCALING_MANUAL SCALING_AUTO SCALING_ALWAYS SCALERS_RAW SCALERS_LOG VECTOR_NONE THREADING_NONE PROCESSOR_GPU FRAMEWORK_CUDA

Thats it!