comparison src/gpu/ptx/vm/gpu_ptx.cpp @ 11606:4f69a5189e77

Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
author bharadwaj
date Wed, 11 Sep 2013 17:02:40 -0400
parents 91e5f927af63
children bff2b88444f5
comparison
equal deleted inserted replaced
11605:3676540f71cf 11606:4f69a5189e77
47 gpu::Ptx::cuda_cu_launch_kernel_func_t gpu::Ptx::_cuda_cu_launch_kernel; 47 gpu::Ptx::cuda_cu_launch_kernel_func_t gpu::Ptx::_cuda_cu_launch_kernel;
48 gpu::Ptx::cuda_cu_module_get_function_func_t gpu::Ptx::_cuda_cu_module_get_function; 48 gpu::Ptx::cuda_cu_module_get_function_func_t gpu::Ptx::_cuda_cu_module_get_function;
49 gpu::Ptx::cuda_cu_module_load_data_ex_func_t gpu::Ptx::_cuda_cu_module_load_data_ex; 49 gpu::Ptx::cuda_cu_module_load_data_ex_func_t gpu::Ptx::_cuda_cu_module_load_data_ex;
50 gpu::Ptx::cuda_cu_memcpy_dtoh_func_t gpu::Ptx::_cuda_cu_memcpy_dtoh; 50 gpu::Ptx::cuda_cu_memcpy_dtoh_func_t gpu::Ptx::_cuda_cu_memcpy_dtoh;
51 gpu::Ptx::cuda_cu_memfree_func_t gpu::Ptx::_cuda_cu_memfree; 51 gpu::Ptx::cuda_cu_memfree_func_t gpu::Ptx::_cuda_cu_memfree;
52
53 void gpu::probe_linkage() {
54 #if defined(__APPLE__) || defined(LINUX)
55 set_gpu_linkage(gpu::Ptx::probe_linkage());
56 #else
57 set_gpu_linkage(false);
58 #endif
59 }
60
61 void gpu::initialize_gpu() {
62 if (gpu::has_gpu_linkage()) {
63 set_initialized(gpu::Ptx::initialize_gpu());
64 }
65 }
66
67 void * gpu::generate_kernel(unsigned char *code, int code_len, const char *name) {
68 if (gpu::has_gpu_linkage()) {
69 return (gpu::Ptx::generate_kernel(code, code_len, name));
70 } else {
71 return NULL;
72 }
73 }
74
75 bool gpu::execute_kernel(address kernel, PTXKernelArguments & ptxka, JavaValue& ret) {
76 if (gpu::has_gpu_linkage()) {
77 return (gpu::Ptx::execute_kernel(kernel, ptxka, ret));
78 } else {
79 return false;
80 }
81 }
82 52
83 bool gpu::Ptx::initialize_gpu() { 53 bool gpu::Ptx::initialize_gpu() {
84 54
85 /* Initialize CUDA driver API */ 55 /* Initialize CUDA driver API */
86 int status = _cuda_cu_init(0); 56 int status = _cuda_cu_init(0);