Created
January 26, 2016 22:20
-
-
Save vbeffara/747ea55626f975ca9c39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cilk/cilk.h> | |
#include <cilk/cilk_api.h> | |
#include <future> | |
struct complex_double { | |
complex_double (double r, double i) { | |
__real__ _M_value = r; | |
__imag__ _M_value = i; | |
} | |
__complex__ double _M_value; | |
}; | |
double norm (complex_double __z) { | |
return __builtin_cabs(__z._M_value); | |
} | |
void line () { | |
cilk_for (int i=0; i<10; ++i) norm(complex_double(1,1)); | |
} | |
int main () { | |
std::async (std::launch::async, []() { line (); }).get(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment