type=int, default=None, help="The device to use, e.g. CUDA device.") parser.add_argument( "-m", "--method", type=str, default="L-BFGS-B", help= "The optimization algorithm to use. Valid values are COBYLA and L-BFGS-B.") args = parser.parse_args() if args.device is not None: smat.set_backend_options(device=args.device) print "Using device", smat.get_backend_info().device print "Using method", args.method, "with float64" # Load some sample bio data. Specifically this is a subset of the # RNAcompete protein binding affinities from Ray et al., Nature, 2013. y = numpy.load('data/rnac/rnac_subset.npz')['y'] n, m = y.shape def objective_function(x, y, lib): # The test objective function below happens to be that corresponding to # "Variance Stabilization" (Huber et al., Bioinformatics, 2002). # The specific objective is not important. # The point is that the parameters can be sent to the GPU, # evaluated, pulled back, and STILL be much faster than CPU.
import numpy import numpy.random import smat import smat.util import argparse import scipy.optimize parser = argparse.ArgumentParser(description="Train a 784-1000-1000-10 neural net on MNIST and print out the error rates.") parser.add_argument("-d","--device",type=int,default=None,help="The device to use, e.g. CUDA device.") parser.add_argument("-m","--method",type=str,default="L-BFGS-B",help="The optimization algorithm to use. Valid values are COBYLA and L-BFGS-B.") args = parser.parse_args() if args.device is not None: smat.set_backend_options(device=args.device) print "Using device",smat.get_backend_info().device print "Using method",args.method,"with float64" # Load some sample bio data. Specifically this is a subset of the # RNAcompete protein binding affinities from Ray et al., Nature, 2013. y = numpy.load('data/rnac/rnac_subset.npz')['y'] n,m = y.shape def objective_function(x,y,lib): # The test objective function below happens to be that corresponding to # "Variance Stabilization" (Huber et al., Bioinformatics, 2002). # The specific objective is not important. # The point is that the parameters can be sent to the GPU, # evaluated, pulled back, and STILL be much faster than CPU. # Shorthand for some functions that we're getting from lib=smat/numpy
continue A = smat.ones((n,k),dtype=dt) B = smat.ones((k,m),dtype=dt) smat.dot(A,B) #smat.dot_nt(A,B.T) #smat.dot_tn(A.T,B) #smat.dot_tt(A.T,B.T) print n,m,k quit() ''' parser = argparse.ArgumentParser(description="Run the smat unit tests and/or performance tests.") parser.add_argument("-p","--perf",action="store_true",default=False,help="Run performance tests instead of unit tests.") parser.add_argument("-d","--device",type=int,default=None,help="The device to use, e.g. CUDA device.") parser.add_argument("-b","--backend",type=str,default=None,help="The backend to use. Currently only \"cuda\" is supported.") args = parser.parse_args() if args.backend is not None: smat.set_backend(args.backend) if args.device is not None: smat.set_backend_options(device=args.device) print smat.get_backend_info() print smat.get_heap_status() if args.perf: smat.tests.perftest() else: smat.tests.unittest()
# supplementary software release for DeepBind. Users of DeepBind # are encouraged to instead use the latest source code and binaries # for scoring sequences at # http://tools.genes.toronto.edu/deepbind/ # import argparse import smat import smat.tests smat.set_backend_options(device=0) parser = argparse.ArgumentParser(description="Run the smat unit tests and/or performance tests.") parser.add_argument("-p","--perf",action="store_true",default=False,help="Run performance tests instead of unit tests.") parser.add_argument("-d","--device",type=int,default=None,help="The device to use, e.g. CUDA device.") parser.add_argument("-b","--backend",type=str,default=None,help="The backend to use. Currently only \"cuda\" is supported.") args = parser.parse_args() if args.backend is not None: smat.set_backend(args.backend) if args.device is not None: smat.set_backend_options(device=args.device) print smat.get_backend_info() print smat.get_heap_status() if args.perf: smat.tests.perftest() else: smat.tests.unittest()