#include <iostream>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include "input.h"
{
static float sqrt2 = sqrtf(2.0f);
array y = temp * (0.5f +
erf(x/sqrt2)/2) + (1-temp) * (0.5f -
erf((-x)/sqrt2)/2);
return y;
}
{
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 = 100;
for (int n = 50; n <= 500; n += 50) {
printf("Input Data Size = %d x %d\n", (int)dims[0], (int)dims[1]);
for (int i = 0; i < iter; i++) {
black_scholes(Cg, Pg, Sg,Xg,Rg,Vg,Tg);
}
printf(
"Mean GPU Time = %0.6fms\n\n\n", 1000 *
timer::stop()/iter);
}
fprintf(stderr,
"%s\n", e.
what());
throw;
}
return 0;
}