text: #include "acc_testsuite.h"
  
  int test(){
      int err = 0;
      int multiplicitive_n = 128;
      srand(time(NULL));
      real_t * a = (real_t *)malloc(multiplicitive_n * sizeof(real_t));
      real_t * b = (real_t *)malloc(multiplicitive_n * sizeof(real_t));
  
      real_t multiplied_total = 1.0;
  
      for (int x = 0; x < multiplicitive_n; ++x){
          a[x] = rand() / (real_t) RAND_MAX;
          b[x] = rand() / (real_t) RAND_MAX;
      }
  
      #pragma acc data copyin(a[0:multiplicitive_n], b[0:multiplicitive_n]) copy(multiplied_total)
      {
          #pragma acc parallel loop reduction (*:multiplied_total)
          for (int x = 0; x < multiplicitive_n; ++x){
              multiplied_total *= a[x] + b[x];
          }
      }
  
      for (int x = 0; x < multiplicitive_n; ++x){
          multiplied_total /= (a[x] + b[x]);
      }
      if (fabs(multiplied_total - 1) > PRECISION * (2 * multiplicitive_n - 1)){
          err = 1;
      }
  
      free(a);
      free(b);
      return err;
  }
  
  
  int main()
  {
    int i;                        /* Loop index */
    int result;           /* return value of the program */
    int failed=0;                 /* Number of failed tests */
    int success=0;                /* number of succeeded tests */
    static FILE * logFile;        /* pointer onto the logfile */
    static const char * logFileName = "OpenACC_testsuite.log";        /* name of the logfile */
  
  
    /* Open a new Logfile or overwrite the existing one. */
    logFile = fopen(logFileName,"w+");
  
    printf("######## OpenACC Validation Suite V %s #####\n", ACCTS_VERSION );
    printf("## Repetitions: %3d                       ####\n",REPETITIONS);
    printf("## Array Size : %.2f MB                 ####\n",ARRAYSIZE * ARRAYSIZE/1e6);
    printf("##############################################\n");
    printf("Testing parallel_loop_reduction_multiply_general\n\n");
  
    fprintf(logFile,"######## OpenACC Validation Suite V %s #####\n", ACCTS_VERSION );
    fprintf(logFile,"## Repetitions: %3d                       ####\n",REPETITIONS);
    fprintf(logFile,"## Array Size : %.2f MB                 ####\n",ARRAYSIZE * ARRAYSIZE/1e6);
    fprintf(logFile,"##############################################\n");
    fprintf(logFile,"Testing parallel_loop_reduction_multiply_general\n\n");
  
    for ( i = 0; i < REPETITIONS; i++ ) {
      fprintf (logFile, "\n\n%d. run of parallel_loop_reduction_multiply_general out of %d\n\n",i+1,REPETITIONS);
      if (test() == 0) {
        fprintf(logFile,"Test successful.\n");
        success++;
      } else {
        fprintf(logFile,"Error: Test failed.\n");
        printf("Error: Test failed.\n");
        failed++;
      }
    }
  
    if(failed==0) {
      fprintf(logFile,"\nDirective worked without errors.\n");
      printf("Directive worked without errors.\n");
      result=0;
    } else {
      fprintf(logFile,"\nDirective failed the test %i times out of %i. %i were successful\n",failed,REPETITIONS,success);
      printf("Directive failed the test %i times out of %i.\n%i test(s) were successful\n",failed,REPETITIONS,success);
      result = (int) (((double) failed / (double) REPETITIONS ) * 100 );
    }
    printf ("Result: %i\n", result);
    return result;
  }
  
  