Universidad de Costa Rica

Escuela de Ciencias de la Computación e Informática

CI-0117 Programación paralela y concurrente

Prácticas

CI0117 / Practicas / Semana-13


/**
 *
 *
**/

#include <omp.h>
#include <stdio.h>
#include <stdlib.h>

bool isPrime( long num ) {
   bool flag=false;

   return flag;

}

/**
 *  Find the numbers
**/
void doWork( int worker ) {

}


int main( int cantidad, char ** parametros ) {
   long valor, worker, workers, limite, encontrados;
   double inicio, fin;

   limite = 100;
   if ( cantidad > 1 ) {
      limite = atol( parametros[ 1 ] );
   }

   workers = 8;
   if ( cantidad > 2 ) {
      workers = atol( parametros[ 2 ] );
   }

   inicio = omp_get_wtime();
   encontrados = 0;
   for ( worker = 0; worker < workers; ++worker ) {
      doWork( worker );
   }
   fin = omp_get_wtime();
   printf( "Sumas de pares encontradas %d, tiempo %gms\n", (int) encontrados, (fin - inicio)/1000 );

}