summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
authorJin Wang <[email protected]>2016-08-29 18:10:00 -0700
committerJin Wang <[email protected]>2016-09-02 16:16:47 -0700
commit623a88e5d5c6c3edb94404ef6e5ea100caec9deb (patch)
treef31c9c0a6ef6d0a641523222e4d4a554f6c59957 /src/cuda-sim
parent2af85e353bccad8c8536c1d5f039361884b96872 (diff)
MOD: Add macros to turn off cuda_device_runtime for CUDA < 5.0
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/cuda-sim.cc2
-rw-r--r--src/cuda-sim/cuda_device_runtime.cc10
-rw-r--r--src/cuda-sim/cuda_device_runtime.h3
-rw-r--r--src/cuda-sim/instructions.cc2
4 files changed, 13 insertions, 4 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 3f5af7e..ec51779 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -1792,7 +1792,9 @@ void gpgpu_cuda_ptx_sim_main_func( kernel_info_t &kernel, bool openCL )
);
cta.execute();
+#if (CUDART_VERSION >= 5000)
launch_all_device_kernels();
+#endif
}
//registering this kernel as done
diff --git a/src/cuda-sim/cuda_device_runtime.cc b/src/cuda-sim/cuda_device_runtime.cc
index 12c83d2..4a8ffe5 100644
--- a/src/cuda-sim/cuda_device_runtime.cc
+++ b/src/cuda-sim/cuda_device_runtime.cc
@@ -1,9 +1,15 @@
//Jin: cuda_device_runtime.cc
//Defines CUDA device runtime APIs for CDP support
+
#include <iostream>
#include <map>
+unsigned long long g_total_param_size = 0;
+unsigned long long g_max_total_param_size = 0;
+
+
+#if (CUDART_VERSION >= 5000)
#define __CUDA_RUNTIME_API_H__
#include <builtin_types.h>
@@ -59,8 +65,6 @@ public:
std::map<void *, device_launch_config_t> g_cuda_device_launch_param_map;
std::list<device_launch_operation_t> g_cuda_device_launch_op;
extern stream_manager *g_stream_manager;
-unsigned long long g_total_param_size = 0;
-unsigned long long g_max_total_param_size = 0;
//Handling device runtime api:
//void * cudaGetParameterBufferV2(void *func, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize)
@@ -313,4 +317,4 @@ void launch_all_device_kernels() {
launch_one_device_kernel();
}
}
-
+#endif
diff --git a/src/cuda-sim/cuda_device_runtime.h b/src/cuda-sim/cuda_device_runtime.h
index 385d605..6dbcd71 100644
--- a/src/cuda-sim/cuda_device_runtime.h
+++ b/src/cuda-sim/cuda_device_runtime.h
@@ -1,6 +1,6 @@
//Jin: cuda_device_runtime.h
//Defines CUDA device runtime APIs for CDP support
-
+#if (CUDART_VERSION >= 5000)
#pragma once
void gpgpusim_cuda_getParameterBufferV2(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func);
@@ -8,3 +8,4 @@ void gpgpusim_cuda_launchDeviceV2(const ptx_instruction * pI, ptx_thread_info *
void gpgpusim_cuda_streamCreateWithFlags(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func);
void launch_all_device_kernels();
void launch_one_device_kernel();
+#endif
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc
index 5d909d3..e68f9fd 100644
--- a/src/cuda-sim/instructions.cc
+++ b/src/cuda-sim/instructions.cc
@@ -1414,6 +1414,7 @@ void call_impl( const ptx_instruction *pI, ptx_thread_info *thread )
return;
}
+#if (CUDART_VERSION >= 5000)
//Jin: handle device runtime apis for CDP
else if(fname == "cudaGetParameterBufferV2") {
gpgpusim_cuda_getParameterBufferV2(pI, thread, target_func);
@@ -1427,6 +1428,7 @@ void call_impl( const ptx_instruction *pI, ptx_thread_info *thread )
gpgpusim_cuda_streamCreateWithFlags(pI, thread, target_func);
return;
}
+#endif
// read source arguements into register specified in declaration of function
arg_buffer_list_t arg_values;