Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- play2 강좌
- 스위프트
- 하이브리드앱
- play 강좌
- 스칼라 동시성
- 하이퍼레저 패브릭
- Akka
- 스칼라 강좌
- hyperledger fabric
- 스칼라
- 플레이프레임워크
- akka 강좌
- 파이썬
- 파이썬 머신러닝
- 엔터프라이즈 블록체인
- 이더리움
- CORDA
- Adapter 패턴
- Hyperledger fabric gossip protocol
- Play2
- 파이썬 데이터분석
- 파이썬 강좌
- Play2 로 웹 개발
- 블록체인
- 그라파나
- Golang
- 안드로이드 웹뷰
- 주키퍼
- Actor
- 파이썬 동시성
Archives
- Today
- Total
HAMA 블로그
OP_TEST_REDUCTION.cpp 본문
/*
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include <boost/timer.hpp>
int num_steps=500000000;
#define OPENMP
int main()
{
int i;
double x, step, sum = 0.0;
step = 1.0/(double) num_steps;
boost::timer t;
#ifdef NOOPENMP
for (i=0; i<num_steps; i++)
{
x = (i+0.5) * step;
sum += 4.0/(1.0 + x*x);
}
#endif
#ifdef OPENMP
#pragma omp parallel for
for (i=0; i<num_steps; i++)
{
x = (i+0.5) * step;
sum += 4.0/(1.0 + x*x);
}
#endif
#ifdef OPENMP_RE
#pragma omp parallel for private(x) reduction(+:sum)
for (i=0; i<num_steps; i++)
{
x = (i+0.5) * step;
sum += 4.0/(1.0 + x*x);
}
#endif
double t2_insert = t.elapsed();
printf("time: %.8lf \n", t2_insert);
printf("PI = %.8f (sum = %.8f)\n", step*sum, sum);
return EXIT_SUCCESS;
}
*/
'OpenMP,PPL' 카테고리의 다른 글
FOR_reduction.cpp (0) | 2014.08.27 |
---|---|
FOR_default.cpp (0) | 2014.08.27 |
CRITICAL_SECTION.cpp (0) | 2014.08.27 |
Comments