+options
This commit is contained in:
@@ -151,7 +151,8 @@ static CUmodule loadModule(
|
||||
#endif
|
||||
{
|
||||
// Load the PTX from the string myPtx (64-bit)
|
||||
fprintf(stderr, "Loading ptx..\n");
|
||||
if (print_log)
|
||||
fprintf(stderr, "Loading ptx..\n");
|
||||
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);
|
||||
// PTX May also be loaded from file, as per below.
|
||||
@@ -177,7 +178,8 @@ static CUmodule loadModule(
|
||||
|
||||
// Destroy the linker invocation
|
||||
checkCudaErrors(cuLinkDestroy(*lState));
|
||||
fprintf(stderr, " loadModule took %g ms \n", 1e3*(rtc() - t0));
|
||||
if (print_log)
|
||||
fprintf(stderr, " loadModule took %g ms \n", 1e3*(rtc() - t0));
|
||||
return cudaModule;
|
||||
}
|
||||
static void unloadModule(CUmodule &cudaModule)
|
||||
|
||||
@@ -143,6 +143,7 @@ int main(int argc, char *argv[]) {
|
||||
// Binomial options, serial implementation
|
||||
//
|
||||
double binomial_serial = 1e30;
|
||||
#if 0
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
reset_and_start_timer();
|
||||
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",
|
||||
binomial_serial / binomial_ispc, binomial_serial / binomial_tasks);
|
||||
#endif
|
||||
|
||||
//
|
||||
// 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
|
||||
//
|
||||
double bs_serial = 1e30;
|
||||
#if 0
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
reset_and_start_timer();
|
||||
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",
|
||||
bs_serial / bs_ispc, bs_serial / bs_ispc_tasks);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -76,10 +76,12 @@ export void
|
||||
black_scholes_ispc_tasks(uniform float Sa[], uniform float Xa[], uniform float Ta[],
|
||||
uniform float ra[], uniform float va[],
|
||||
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);
|
||||
}
|
||||
|
||||
/********/
|
||||
|
||||
|
||||
export void
|
||||
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 va[], 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] binomial_task(Sa, Xa, Ta, ra, va, result, count);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user