Skip to content
Permalink
Browse files

added input for nblocks and nthreads

  • Loading branch information
yuz12012 committed Apr 22, 2017
1 parent 69daa27 commit 12017fa886b1ecf0be2efa0a224a26586066d7e4
Showing with 11 additions and 4 deletions.
  1. +11 −4 parallel/para_gibbs.cu
@@ -92,10 +92,17 @@ int main(int argc, char **argv){

curandState *devStates;
float a, b, *n, *dev_n, *dev_theta, *dev_log_theta;
int K, *y, *dev_y, nBlocks, trials = 1000;
int K, *y, *dev_y, nBlocks,nThreads, trials = 1000;

if(argc > 2)
if(argc>4){
trials = atoi(argv[2]);
nBlocks = atoi(argv[3]);
nThreads = atoi(argv[4]);
}
else if(argc > 2)
trials = atoi(argv[2]);
nBlocks = 64;
nThreads = 1;

load_data(argc, argv, &K, &y, &n);

@@ -124,13 +131,13 @@ int main(int argc, char **argv){
/*------ Setup random number generators (one per thread) ---------*/

//nBlocks = (K + THREADS_PER_BLOCK - 1) / THREADS_PER_BLOCK;
nBlocks = 1;
//nBlocks = 1;
setup_kernel<<<nBlocks, THREADS_PER_BLOCK>>>(devStates, 0, K);
rnorm();

printf("alpha, beta\n");
//seqMetroProcess<<<nBlocks,1>>>(K,nBlocks,dev_y,dev_n,devStates,dev_theta,dev_log_theta,a,b,trials);
seqMetroProcess<<<nBlocks,128>>>(K,nBlocks,dev_y,dev_n,devStates,dev_theta,dev_log_theta,a,b,trials);
seqMetroProcess<<<nBlocks,nThreads>>>(K,nBlocks,dev_y,dev_n,devStates,dev_theta,dev_log_theta,a,b,trials);

//mergePosterior<<<nBlocks,1>>>();
/*------ Free Memory -------------------------------------------*/

0 comments on commit 12017fa

Please sign in to comment.
You can’t perform that action at this time.