#include <math.h>
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include "input.h"
const float sqrt05 =
sqrt(0.5f);
return 0.5f *
erfc(-x * sqrt05);
}
d1 = d1 + (R + (V * V) * 0.5) * T;
C = S * cnd_d1 - (X *
exp((-R) * T) * cnd_d2);
P = X *
exp((-R) * T) * (1 - cnd_d2) - (S * (1 - cnd_d1));
}
int main(int argc, char** argv) {
try {
int device = argc > 1 ? atoi(argv[1]) : 0;
printf(
"** ArrayFire Black-Scholes Example **\n"
"** by AccelerEyes **\n\n");
black_scholes(Cg, Pg, Sg, Xg, Rg, Vg, Tg);
printf("Warming up done\n");
int iter = 1000;
for (int n = 50; n <= 500; n += 50) {
for (int i = 0; i < iter; i++) {
black_scholes(Cg, Pg, Sg, Xg, Rg, Vg, Tg);
}
printf("Input Data Size = %8d. Mean GPU Time: %0.6f ms\n",
(int)dims[0], 1000 * t);
}
fprintf(stderr,
"%s\n", e.
what());
throw;
}
return 0;
}