From f2d7b79e26f8766a220ab07f8de3df603de9263c Mon Sep 17 00:00:00 2001 From: Tor Aamodt Date: Mon, 24 Dec 2012 10:13:40 -0800 Subject: enable CUBIN parsing on Mac OS X [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 14882] --- libcuda/cuda_runtime_api.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'libcuda/cuda_runtime_api.cc') diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index 4739f64..7535fa3 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -137,6 +137,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + extern void synchronize(); extern void exit_simulation(); @@ -1260,17 +1264,23 @@ extern "C" FILE *cuobjdump_in; //! executable instead of the application binary. //! std::string get_app_binary(){ + char self_exe_path[1025]; +#ifdef __APPLE__ + uint32_t size = sizeof(self_exe_path); + if( _NSGetExecutablePath(self_exe_path,&size) != 0 ) { + printf("GPGPU-Sim ** ERROR: _NSGetExecutablePath input buffer too small\n"); + exit(1); + } +#else std::stringstream exec_link; - // exec_link << "/proc/" << getpid() << "/exe"; exec_link << "/proc/self/exe"; - char self_exe_path[1025]; ssize_t path_length = readlink(exec_link.str().c_str(), self_exe_path, 1024); assert(path_length != -1); self_exe_path[path_length] = '\0'; +#endif printf("self exe links to: %s\n", self_exe_path); - return self_exe_path; } -- cgit v1.3