Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. //
  2. // tbb_intro.cpp
  3. // CplusplusPractice
  4. //
  5. // Created by masai on 2015/05/31.
  6. // Copyright (c) 2015年 masai. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. #include <cmath>
  11. #include <tbb/tbb.h>
  12.  
  13. double *output;
  14. double *input;
  15.  
  16. int main(){
  17. const int size = 20000000;
  18.  
  19. output = new double[size];
  20. input = new double[size];
  21.  
  22. for(int i = 0; i < size; ++i){
  23. input[i] = i;
  24. }
  25.  
  26. tbb::parallel_for(0, size, 1, [=](int i){
  27. output[i] = sqrt(sin(input[i]*sin(input[i]) + cos(input[i])*cos(input[i])));
  28. }
  29. );
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement