+options
This commit is contained in:
@@ -151,6 +151,7 @@ static CUmodule loadModule(
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// Load the PTX from the string myPtx (64-bit)
|
// Load the PTX from the string myPtx (64-bit)
|
||||||
|
if (print_log)
|
||||||
fprintf(stderr, "Loading ptx..\n");
|
fprintf(stderr, "Loading ptx..\n");
|
||||||
myErr = cuLinkAddData(*lState, CU_JIT_INPUT_PTX, (void*)module, strlen(module)+1, 0, 0, 0, 0);
|
myErr = cuLinkAddData(*lState, CU_JIT_INPUT_PTX, (void*)module, strlen(module)+1, 0, 0, 0, 0);
|
||||||
myErr = cuLinkAddFile(*lState, CU_JIT_INPUT_LIBRARY, cudadevrt_lib, 0,0,0);
|
myErr = cuLinkAddFile(*lState, CU_JIT_INPUT_LIBRARY, cudadevrt_lib, 0,0,0);
|
||||||
@@ -177,6 +178,7 @@ static CUmodule loadModule(
|
|||||||
|
|
||||||
// Destroy the linker invocation
|
// Destroy the linker invocation
|
||||||
checkCudaErrors(cuLinkDestroy(*lState));
|
checkCudaErrors(cuLinkDestroy(*lState));
|
||||||
|
if (print_log)
|
||||||
fprintf(stderr, " loadModule took %g ms \n", 1e3*(rtc() - t0));
|
fprintf(stderr, " loadModule took %g ms \n", 1e3*(rtc() - t0));
|
||||||
return cudaModule;
|
return cudaModule;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// Binomial options, serial implementation
|
// Binomial options, serial implementation
|
||||||
//
|
//
|
||||||
double binomial_serial = 1e30;
|
double binomial_serial = 1e30;
|
||||||
|
#if 0
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
reset_and_start_timer();
|
reset_and_start_timer();
|
||||||
const double t0 = rtc();
|
const double t0 = rtc();
|
||||||
@@ -159,6 +160,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
printf("\t\t\t\t(%.2fx speedup from ISPC, %.2fx speedup from ISPC + tasks)\n",
|
printf("\t\t\t\t(%.2fx speedup from ISPC, %.2fx speedup from ISPC + tasks)\n",
|
||||||
binomial_serial / binomial_ispc, binomial_serial / binomial_tasks);
|
binomial_serial / binomial_ispc, binomial_serial / binomial_tasks);
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Black-Scholes options pricing model, ispc implementation, 1 thread
|
// Black-Scholes options pricing model, ispc implementation, 1 thread
|
||||||
@@ -200,6 +202,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// Black-Scholes options pricing model, serial implementation
|
// Black-Scholes options pricing model, serial implementation
|
||||||
//
|
//
|
||||||
double bs_serial = 1e30;
|
double bs_serial = 1e30;
|
||||||
|
#if 0
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
reset_and_start_timer();
|
reset_and_start_timer();
|
||||||
const double t0 = rtc();
|
const double t0 = rtc();
|
||||||
@@ -216,6 +219,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
printf("\t\t\t\t(%.2fx speedup from ISPC, %.2fx speedup from ISPC + tasks)\n",
|
printf("\t\t\t\t(%.2fx speedup from ISPC, %.2fx speedup from ISPC + tasks)\n",
|
||||||
bs_serial / bs_ispc, bs_serial / bs_ispc_tasks);
|
bs_serial / bs_ispc, bs_serial / bs_ispc_tasks);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,10 +76,12 @@ export void
|
|||||||
black_scholes_ispc_tasks(uniform float Sa[], uniform float Xa[], uniform float Ta[],
|
black_scholes_ispc_tasks(uniform float Sa[], uniform float Xa[], uniform float Ta[],
|
||||||
uniform float ra[], uniform float va[],
|
uniform float ra[], uniform float va[],
|
||||||
uniform float result[], uniform int count) {
|
uniform float result[], uniform int count) {
|
||||||
uniform int nTasks = max((int)64, (int)count/16384);
|
uniform int nTasks = 2048; //count/16384; //max((int)64, (int)count/16384);
|
||||||
launch[nTasks] bs_task(Sa, Xa, Ta, ra, va, result, count);
|
launch[nTasks] bs_task(Sa, Xa, Ta, ra, va, result, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********/
|
||||||
|
|
||||||
|
|
||||||
export void
|
export void
|
||||||
black_scholes_ispc(uniform float Sa[], uniform float Xa[], uniform float Ta[],
|
black_scholes_ispc(uniform float Sa[], uniform float Xa[], uniform float Ta[],
|
||||||
@@ -149,6 +151,6 @@ binomial_put_ispc_tasks(uniform float Sa[], uniform float Xa[],
|
|||||||
uniform float Ta[], uniform float ra[],
|
uniform float Ta[], uniform float ra[],
|
||||||
uniform float va[], uniform float result[],
|
uniform float va[], uniform float result[],
|
||||||
uniform int count) {
|
uniform int count) {
|
||||||
uniform int nTasks = max((int)64, (int)count/16384);
|
uniform int nTasks = 2048; //count/16384; //max((int)64, (int)count/16384);
|
||||||
launch[nTasks] binomial_task(Sa, Xa, Ta, ra, va, result, count);
|
launch[nTasks] binomial_task(Sa, Xa, Ta, ra, va, result, count);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user