comparison src/gpu/ptx/vm/gpu_ptx.cpp @ 10882:6a2d65cb5d7d

fix: gpu_ptx.cpp did not compile on windows
author Christian Wirth <christian.wirth@oracle.com>
date Fri, 26 Jul 2013 11:22:13 +0200
parents d55f24eac4b1
children 5fcb30bcb90a
comparison
equal deleted inserted replaced
10881:f9215ee02538 10882:6a2d65cb5d7d
267 static char const cuda_library_name[] = "/usr/local/cuda/lib/libcuda.dylib"; 267 static char const cuda_library_name[] = "/usr/local/cuda/lib/libcuda.dylib";
268 #else 268 #else
269 static char const cuda_library_name[] = ""; 269 static char const cuda_library_name[] = "";
270 #endif 270 #endif
271 271
272 #define STD_BUFFER_SIZE 1024
273
272 bool gpu::Ptx::probe_linkage() { 274 bool gpu::Ptx::probe_linkage() {
273 if (cuda_library_name != NULL) { 275 if (cuda_library_name != NULL) {
274 void *handle = dlopen(cuda_library_name, RTLD_LAZY); 276 char *buffer = (char*)malloc(STD_BUFFER_SIZE);
277 void *handle = os::dll_load(cuda_library_name, buffer, STD_BUFFER_SIZE);
278 free(buffer);
275 if (handle != NULL) { 279 if (handle != NULL) {
276 _cuda_cu_init = 280 _cuda_cu_init =
277 CAST_TO_FN_PTR(cuda_cu_init_func_t, dlsym(handle, "cuInit")); 281 CAST_TO_FN_PTR(cuda_cu_init_func_t, os::dll_lookup(handle, "cuInit"));
278 _cuda_cu_ctx_create = 282 _cuda_cu_ctx_create =
279 CAST_TO_FN_PTR(cuda_cu_ctx_create_func_t, dlsym(handle, "cuCtxCreate")); 283 CAST_TO_FN_PTR(cuda_cu_ctx_create_func_t, os::dll_lookup(handle, "cuCtxCreate"));
280 _cuda_cu_ctx_detach = 284 _cuda_cu_ctx_detach =
281 CAST_TO_FN_PTR(cuda_cu_ctx_detach_func_t, dlsym(handle, "cuCtxDetach")); 285 CAST_TO_FN_PTR(cuda_cu_ctx_detach_func_t, os::dll_lookup(handle, "cuCtxDetach"));
282 _cuda_cu_ctx_synchronize = 286 _cuda_cu_ctx_synchronize =
283 CAST_TO_FN_PTR(cuda_cu_ctx_synchronize_func_t, dlsym(handle, "cuCtxSynchronize")); 287 CAST_TO_FN_PTR(cuda_cu_ctx_synchronize_func_t, os::dll_lookup(handle, "cuCtxSynchronize"));
284 _cuda_cu_device_get_count = 288 _cuda_cu_device_get_count =
285 CAST_TO_FN_PTR(cuda_cu_device_get_count_func_t, dlsym(handle, "cuDeviceGetCount")); 289 CAST_TO_FN_PTR(cuda_cu_device_get_count_func_t, os::dll_lookup(handle, "cuDeviceGetCount"));
286 _cuda_cu_device_get_name = 290 _cuda_cu_device_get_name =
287 CAST_TO_FN_PTR(cuda_cu_device_get_name_func_t, dlsym(handle, "cuDeviceGetName")); 291 CAST_TO_FN_PTR(cuda_cu_device_get_name_func_t, os::dll_lookup(handle, "cuDeviceGetName"));
288 _cuda_cu_device_get = 292 _cuda_cu_device_get =
289 CAST_TO_FN_PTR(cuda_cu_device_get_func_t, dlsym(handle, "cuDeviceGet")); 293 CAST_TO_FN_PTR(cuda_cu_device_get_func_t, os::dll_lookup(handle, "cuDeviceGet"));
290 _cuda_cu_device_compute_capability = 294 _cuda_cu_device_compute_capability =
291 CAST_TO_FN_PTR(cuda_cu_device_compute_capability_func_t, dlsym(handle, "cuDeviceComputeCapability")); 295 CAST_TO_FN_PTR(cuda_cu_device_compute_capability_func_t, os::dll_lookup(handle, "cuDeviceComputeCapability"));
292 _cuda_cu_device_get_attribute = 296 _cuda_cu_device_get_attribute =
293 CAST_TO_FN_PTR(cuda_cu_device_get_attribute_func_t, dlsym(handle, "cuDeviceGetAttribute")); 297 CAST_TO_FN_PTR(cuda_cu_device_get_attribute_func_t, os::dll_lookup(handle, "cuDeviceGetAttribute"));
294 _cuda_cu_module_get_function = 298 _cuda_cu_module_get_function =
295 CAST_TO_FN_PTR(cuda_cu_module_get_function_func_t, dlsym(handle, "cuModuleGetFunction")); 299 CAST_TO_FN_PTR(cuda_cu_module_get_function_func_t, os::dll_lookup(handle, "cuModuleGetFunction"));
296 _cuda_cu_module_load_data_ex = 300 _cuda_cu_module_load_data_ex =
297 CAST_TO_FN_PTR(cuda_cu_module_load_data_ex_func_t, dlsym(handle, "cuModuleLoadDataEx")); 301 CAST_TO_FN_PTR(cuda_cu_module_load_data_ex_func_t, os::dll_lookup(handle, "cuModuleLoadDataEx"));
298 _cuda_cu_launch_kernel = 302 _cuda_cu_launch_kernel =
299 CAST_TO_FN_PTR(cuda_cu_launch_kernel_func_t, dlsym(handle, "cuLaunchKernel")); 303 CAST_TO_FN_PTR(cuda_cu_launch_kernel_func_t, os::dll_lookup(handle, "cuLaunchKernel"));
300 if (TraceGPUInteraction) { 304 if (TraceGPUInteraction) {
301 tty->print_cr("[CUDA] Success: library linkage"); 305 tty->print_cr("[CUDA] Success: library linkage");
302 } 306 }
303 return true; 307 return true;
304 } else { 308 } else {