OpenMP,PPL
CRITICAL_SECTION.cpp
[하마] 이승현 (wowlsh93@gmail.com)
2014. 8. 27. 22:41
/*
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include <boost/timer.hpp>
const int num_steps=1000;
int main()
{
boost::timer t;
int sum = 0, i = 0;
float * Data = new float[num_steps];
for(i =0 ; i < num_steps; i++)
{
Data[i] = i;
}
float max = 0;
#pragma omp parallel for
for(i = 0 ; i < num_steps; i++)
{
#pragma omp critical (MAXVALUE)
{
if(max < Data[i])
max = Data[i];
}
}
printf(" max = %f \n", max);
double t2_insert = t.elapsed();
printf("time: %.8lf \n", t2_insert);
return EXIT_SUCCESS;
}
*/