Few pointers. Try using GPUArray to store your sequences - it will allow for you to use some more advanced features of PyCUDA.
Dnia 2011-09-28, śro o godzinie 18:04 +0200, nicola.zaur...@virgilio.it pisze: > Hi everyone, > I'll explain my problem. I created the following code in python. This > code implements the Nussinov's algoritm. > > > from numpy import * > from matplotlib import * > > > seq='AACUUCUUCAA' > > > def score_bpair(seq,i,j,soglia=2): > score={('A','U'):1,('U','A'):1,('C','G'):1,('G','C'):1} > a=seq[i] > b=seq[j] > if(abs(i-j)<soglia or((a,b) not in score.keys())): > return 0 > else: > return score[(a,b)] Put above funtion into separate kernel. > > > def nussinov(seq): > > L=len(seq); > smat=zeros((L,L)); #array (L,L) > for s in xrange(1,L): > for i in xrange(0,L-s): > j=i+s > maxfork=0 > for k in xrange(i,j-1): > maxfork=max(maxfork,smat[i][k]+smat[k+1][j]) use pycuda.gpuarray.max > smat[i][j]=max((smat[i > +1][j-1]+score_bpair(seq,i,j)),maxfork) First create new array (containing values+score_bpair) and then again GPUArray.max, or GPUArray.max_subset. > smat[j][i]=smat[i][j] #completa la matrice in modo > simmetrico Check if you can create new GPUArray to get transposed view into existing one. Hope it helps, regards. -- Tomasz Rybak <bogom...@post.pl> GPG/PGP key ID: 2AD5 9860 Fingerprint A481 824E 7DD3 9C0E C40A 488E C654 FB33 2AD5 9860 http://member.acm.org/~tomaszrybak
signature.asc
Description: This is a digitally signed message part
_______________________________________________ PyCUDA mailing list PyCUDA@tiker.net http://lists.tiker.net/listinfo/pycuda