09 Cuda
Transcript of 09 Cuda
-
7/30/2019 09 Cuda
1/5
Parallel Programming for Bioinformatics
CUDA
Software Project:Protein-protein docking by simulated annealing
2
A CUDA software project
Write a CUDA program to perform simulated annealingcalculations on a CUDA enabled graphics adapter
Parts of the program
read in pdb-structures of two proteins (C++)
perform simulated annealing on CUDA card
randomly change rotation vector
randomly change translation vector
evaluate new energy
accept new position based on Metropolis criterion
output of docked structures (C++)
-
7/30/2019 09 Cuda
2/5
3
Simulated annealing part
Start with a given temprature t
Perform n steps at same temperature level
For each step
change randomly in small steps
translation
orientation
of smaller protein
evaluate energy between both molecules
if better than best known, store orientation and energy as new best
accept as new position according to Metropolis criterion
Decrease temperature by factorf= 0.9 Stop algorithm if no improvement of best overall energy for last
x steps
4
Changing translation and rotation
Use Gaussian distributed numbers
Create one number for each degree of freedom
x, y, z, s, vx, vy, vz
Add random number to each variable independently
normalize new quaternion vector
Apply transformation to original coordinates
rotation
translation
-
7/30/2019 09 Cuda
3/5
5
Orientation of moving molecule
Orientation
described by quaternion q = [s, vx, vy, vz]=[s, v]
Quaternion
represents rotation ofs radians about axis [vx, vy, vz]
Creating quaternion
create random number for each entry in q
normalize quaternion such that |q| = 1
Changing quaternions
q = q0 x q1 = [s0s1v0 * v1, s0v1 + s1v0 + v0 x v1]
Calculating rotation matrix R
+
+
+
=
22
22
22
2212222
2222122
2222221
yxxzyyzx
xzyzxzyx
yzxzyxzy
vvsvvvsvvv
svvvvvsvvv
svvvsvvvvv
R
6
Interaction energy
The total energy of a conformation is given by the sum over allEij with ibeing atoms of moving protein andjbeing atoms ofreceptor protein
( )
+
+=13375.3
90836.1exp26067.11
51471.0
83634.2exp1
355472303382.0
2x
x
.Eij
-
7/30/2019 09 Cuda
4/5
7
Random number generator
unsi gned z1, z2, z3, z4;f l oat Hybr i dTaus( ){
r et ur n 2. 3283064365387e- 10 * (TausSt ep( z1, 13, 19, 12, 4294967294UL) ^TausSt ep( z2, 2, 25, 4, 4294967288UL) ^TausSt ep( z3, 3, 11, 17, 4294967280UL) ^LCGSt ep( z4, 1664525, 1013904223UL)
) ;}
unsi gned TausSt ep( unsi gned &z, i nt S1, i nt S2, i nt S3,unsi gned M)
{unsi gned b = ( ( z
-
7/30/2019 09 Cuda
5/5
9
First steps in software project
Write a simple(!) CUDA program to perform simulatedannealing in global memory
Parse two pdb structures and store positions in two arrays off l oat 3
Perform annealing on CPU
Use the GSL for random number creation on the CPU
Write a CUDA kernel for
changing atom positions
evaluating energy