+speed-up binomial options via use of shared memory

This commit is contained in:
Evghenii
2013-11-15 20:46:55 +01:00
parent 4421fb7e19
commit 1d94667a15
2 changed files with 6 additions and 1 deletions

View File

@@ -213,7 +213,7 @@ static void memcpyH2D(CUdeviceptr d_buf, void * h_buf, const size_t size)
checkCudaErrors(cuMemcpyHtoD(d_buf, h_buf, size));
}
#define deviceLaunch(func,params) \
checkCudaErrors(cuFuncSetCacheConfig((func), CU_FUNC_CACHE_PREFER_L1)); \
checkCudaErrors(cuFuncSetCacheConfig((func), CU_FUNC_CACHE_PREFER_SHARED)); \
checkCudaErrors( \
cuLaunchKernel( \
(func), \

View File

@@ -97,7 +97,12 @@ black_scholes_ispc_tasks( float Sa[], float Xa[], float Ta[],
__device__
static inline float
binomial_put(float S, float X, float T, float r, float v) {
#if 0
float V[BINOMIAL_NUM];
#else
__shared__ float VSH[BINOMIAL_NUM*4];
float *V = VSH + warpIdx*BINOMIAL_NUM;
#endif
float dt = T / BINOMIAL_NUM;
float u = exp(v * sqrt(dt));