36 #include <cuda_runtime_api.h>
61 namespace aln {
void test(
int argc,
char* argv[]); }
62 namespace html {
void test(); }
66 using namespace nvbio;
90 int main(
int argc,
char* argv[])
96 cudaGetDeviceCount(&device_count);
97 log_verbose(stderr,
" cuda devices : %d\n", device_count);
104 if (strcmp( argv[arg],
"-device" ) == 0)
106 cuda_device = atoi(argv[++arg]);
112 if (strcmp( argv[arg],
"-string-set" ) == 0)
114 else if (strcmp( argv[arg],
"-scan" ) == 0)
116 else if (strcmp( argv[arg],
"-sum-tree" ) == 0)
118 else if (strcmp( argv[arg],
"-aln" ) == 0)
120 else if (strcmp( argv[arg],
"-html" ) == 0)
122 else if (strcmp( argv[arg],
"-cache" ) == 0)
124 else if (strcmp( argv[arg],
"-packed-stream" ) == 0)
126 else if (strcmp( argv[arg],
"-bwt" ) == 0)
128 else if (strcmp( argv[arg],
"-rank" ) == 0)
130 else if (strcmp( argv[arg],
"-fm-index" ) == 0)
132 else if (strcmp( argv[arg],
"-qgram" ) == 0)
134 else if (strcmp( argv[arg],
"-alloc" ) == 0)
136 else if (strcmp( argv[arg],
"-syncblocks" ) == 0)
138 else if (strcmp( argv[arg],
"-condition" ) == 0)
140 else if (strcmp( argv[arg],
"-work-queue" ) == 0)
142 else if (strcmp( argv[arg],
"-sequence" ) == 0)
144 else if (strcmp( argv[arg],
"-wavelet" ) == 0)
146 else if (strcmp( argv[arg],
"-bloom-filter" ) == 0)
156 if (cuda_device == -1)
159 cudaDeviceProp best_device_prop;
160 cudaGetDeviceProperties( &best_device_prop, best_device );
162 for (
int device = 0; device < device_count; ++device)
164 cudaDeviceProp device_prop;
165 cudaGetDeviceProperties( &device_prop, device );
166 log_verbose(stderr,
" device %d has compute capability %d.%d\n", device, device_prop.major, device_prop.minor);
167 log_verbose(stderr,
" SM count : %u\n", device_prop.multiProcessorCount);
168 log_verbose(stderr,
" SM clock rate : %u Mhz\n", device_prop.clockRate / 1000);
169 log_verbose(stderr,
" memory clock rate : %.1f Ghz\n",
float(device_prop.memoryClockRate) * 1.0e-6f);
171 if (device_prop.major >= best_device_prop.major &&
172 device_prop.minor >= best_device_prop.minor)
174 best_device_prop = device_prop;
175 best_device = device;
178 cuda_device = best_device;
180 log_verbose(stderr,
" chosen device %d\n", cuda_device);
182 cudaDeviceProp device_prop;
183 cudaGetDeviceProperties( &device_prop, cuda_device );
184 log_verbose(stderr,
" device name : %s\n", device_prop.name);
185 log_verbose(stderr,
" compute capability : %d.%d\n", device_prop.major, device_prop.minor);
187 cudaSetDevice( cuda_device );
191 cudaDeviceSetLimit( cudaLimitMallocHeapSize, 128*1024*1024 );
193 argc = argc >= arg ? argc-arg : 0;