Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // tbb_intro.cpp
- // CplusplusPractice
- //
- // Created by masai on 2015/05/31.
- // Copyright (c) 2015年 masai. All rights reserved.
- //
- #include <iostream>
- #include <cmath>
- #include <tbb/tbb.h>
- double *output;
- double *input;
- int main(){
- const int size = 20000000;
- output = new double[size];
- input = new double[size];
- for(int i = 0; i < size; ++i){
- input[i] = i;
- }
- tbb::parallel_for(0, size, 1, [=](int i){
- output[i] = sqrt(sin(input[i]*sin(input[i]) + cos(input[i])*cos(input[i])));
- }
- );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement