Skip to content

Instantly share code, notes, and snippets.

@vbeffara
Created January 26, 2016 22:20
Show Gist options
  • Save vbeffara/747ea55626f975ca9c39 to your computer and use it in GitHub Desktop.
Save vbeffara/747ea55626f975ca9c39 to your computer and use it in GitHub Desktop.
#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