Commits

Christos Kannas committed 1a71ef2

Update: Testing.

  • Participants
  • Parent commits d746daf
  • Branches CUDA

Comments (0)

Files changed (1)

       /* For each reaction equation find which species are used */
       int spc_idx[EqnNr * SpcNr];
 
+      fprintf(stderr, ">>> CUDA - constant device variables <<<\n");
+
       C_Inline("/* Column compressed Stoichiometric matrix */");
       C_Inline("%s float d_STOICM[NSTOICM] = STOICM;", CUDA_C_variable_qualifiers[1]);
       C_Inline("%s int d_CCOL_STOICM[CNEQN] = CCOL_STOICM;", CUDA_C_variable_qualifiers[1]);
 
       C_Inline("/* For each reaction equation find which species are used */");
       C_Inline("%s int Spc_Idx[%d] = {", CUDA_C_variable_qualifiers[1], (EqnNr * SpcNr));
-      for(j = 0; j < EqnNr; j++){
+      fprintf(stderr, ">>> CUDA - EqnNr: %d, SpcNr: %d <<<\n", EqnNr, SpcNr);
+      for(j = 0; j < EqnNr; ++j){
+          fprintf(stderr, ">>> CUDA - Eqn %d, SpcNr %d <<<\n", j, SpcNr);
           if( useAggregate ){
-              for(i = 0; i < SpcNr; i++)
+              for(i = 0; i < SpcNr; ++i){
                   /* If used keep a record of how many times*/
                   if( Stoich[i][j] != 0 )
                       spc_idx[j * EqnNr + i] = (int)Stoich_Left[i][j];
                   else
                       spc_idx[j * EqnNr + i] = 0;
+                  C_Inline("\t%d,", spc_idx[j * EqnNr + i]);
+                  fprintf(stderr, "\t>>> CUDA - Spc %d/%d %d <<<\n", i, SpcNr, spc_idx[j * EqnNr + i]);
+              }
           }
           else {
-              for(i = 0; i < SpcNr; i++) 
+              for(i = 0; i < SpcNr; ++i){ 
                   /* If used keep a record of how many times*/
                   if( Stoich_Right[i][j] != 0 )
                       spc_idx[j * EqnNr + i] = (int)Stoich_Left[i][j];
                   else
                       spc_idx[j * EqnNr + i] = 0;
+                  C_Inline("\t%d,", spc_idx[j * EqnNr + i]);
+                  fprintf(stderr, "\t>>> CUDA - Spc %d/%d %d <<<\n", i, SpcNr, spc_idx[j * EqnNr + i]);
+              }
           }
-          C_Inline("\t%d,", spc_idx[j * EqnNr + i]);
+          //C_Inline("\t%d,", spc_idx[j * EqnNr + i]);
+          //fprintf(stderr, ">>> CUDA - Eqn %d <<<\n", j);
       }
       C_Inline("};");
       NewLines(1);
 
+      fprintf(stderr, ">>> CUDA - Kernel Functions <<<\n");
+
       /* CUDA Device Function */
       /* Computation of equation rates, vector A */
       C_Inline("/* CUDA Kernel for Fun_A */");
 
   /* Fun for CUDA */
   if(useLang == CUDA_C_LANG){
+      fprintf(stderr, ">>> CUDA - Fun <<<\n");
       FunctionBegin( F_VAR, V, F, RCT, Vdot );
       /* CUDA required variables */
       C_Inline("\t/* CUDA required variables */");
       C_Inline("\t/* Free GPU Timing Events */");
       C_Inline("\tFreeEvents();");
       FunctionEnd( F_VAR );
+
+      fprintf(stderr, ">>> CUDA - End <<<\n");
   }
   else{
       if( useAggregate )
       else
         FunctionEnd( FSPLIT_VAR );
   }
-
+  fprintf(stderr, ">>> Free <<<\n");
   FreeVariable( F_VAR );
   FreeVariable( FSPLIT_VAR );
 }