Skip to content

Commit

Permalink
Add for loop for mutliple iters of GPU kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Nov 22, 2024
1 parent e94a424 commit dfc7187
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions demos/CUDA/BlackScholes/BlackScholes.cu
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ void launch(float* h_CallResultCPU, float* h_CallResultGPU,
printf("Executing Black-Scholes GPU kernel (%i iterations)...\n",
NUM_ITERATIONS);

BlackScholesGPU<<<DIV_UP((OPT_N / 2), 128), 128 /*480, 128*/>>>(
(float2*)d_CallResult, (float2*)d_PutResult, (float2*)d_StockPrice,
(float2*)d_OptionStrike, (float2*)d_OptionYears, RISKFREE, VOLATILITY,
OPT_N);
for (int i = 0; i < NUM_ITERATIONS; i++) {
BlackScholesGPU<<<DIV_UP((OPT_N / 2), 128), 128 /*480, 128*/>>>(
(float2*)d_CallResult, (float2*)d_PutResult, (float2*)d_StockPrice,
(float2*)d_OptionStrike, (float2*)d_OptionYears, RISKFREE, VOLATILITY,
OPT_N);
}

// Both call and put is calculated

Expand Down

0 comments on commit dfc7187

Please sign in to comment.